wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-20-2006, 01:31 AM   #16
MasterofSickness
User
 
MasterofSickness's Avatar
 
Join Date: Feb 2006
Posts: 218

MasterofSickness is on a distinguished road (23)

Default

Quote:
...for some strange reason when I was testing the AOE thing, it said that "set udg_SpellDamage=null" was unreadable? Integers can't be nulled? Or is there no need to?
Ignitedstar, you can clear the integer variable with using "0" instead of "null":
Trigger:
Custom script: set udg_SpellDamage=0
But there is no need to!!!
The following local variables clear themself at the end of every trigger automatically:
Code:
types that dont need to be nulifyed: string, real, integer, code, boolean
__________________
my nicknames:
20002006200720102012
Master of SicknessDesignatusKakarotEdwardElricSourceSeeker

Last edited by MasterofSickness : 08-20-2006 at 02:35 AM.
MasterofSickness is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-20-2006, 01:45 AM   #17
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,755

Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

Oh, really? O_o

Oh, cool. Oh well, I learned something new today.
__________________
Current Activity: It's a secret, now.
Evaluation: I actually logged in?!?!
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

1 Corinthians 13:1-2

Current Works:
None.
Ignitedstar is offline   Reply With Quote
Old 08-20-2006, 02:43 AM   #18
Moss
User
 
Moss's Avatar
 
Join Date: Jan 2004
Posts: 425

Moss is on a distinguished road (11)

Default

IgnitedStar's trigger is multi-instancable. It uses globals but that is fine because there are no waits and all the variables are set at the time of casting. If there were waits then somebody else could cast the spell during that interval and change the values of those global variables, which would screw the first instance up.

Also, if you want to be anal about memory leaks you should set the position of Caster to a Temp_Point variable and nullify that at the end of the trigger as well. Maybe this spell doesn't get cast lots, being a suicidal spell, but still it is good to avoid memory leaking habits.

To heal allied units you could just reuse the Temp_Group variable to select allies in the same range (from the position of the Temp_Point) and then use the Spell_Damage variable unchanged to set the units life to their current life + Spell_Damage. Just make sure you nullify the Temp_Group each time you use it.

Does setting to null actually work? I always thought you had to use the special functions like "call DestroyGroup(udg_Temp_Group)".
__________________

Last edited by Moss : 08-20-2006 at 02:45 AM.
Moss is offline   Reply With Quote
Old 08-20-2006, 02:56 AM   #19
MasterofSickness
User
 
MasterofSickness's Avatar
 
Join Date: Feb 2006
Posts: 218

MasterofSickness is on a distinguished road (23)

Default

Sorry, but I made a little mistake in my last post:
Quote:
The following variables clear themself at the end of every trigger automatically:
This refers to local variables only (variables created with JASS)
I edited it.
If you use a global variable (the udg_*) then you don't need to null their values AFAIK, because global variables will stay in memory.
When you change the value of a global variable, then the old one will be overwritten and if you set them to null, then the variable will have no value, but it still will stay in memory for later use.
So if you want to use for example an integer in a trigger that can be multi-instanceable then you have to use Custom scripts if you want to stay in GUI:
Trigger:
Custom script: local integer SpellDamage=0
But if you use this, then you have to use custom scipts for every funtion that uses this local integer... So, if you want to make good trigger you have to use a little JASS.
For the beginning I just would creat my functions I want in JASS with normal GUI and then move them in a new trigger and convert the whole new trigger to JASS. After that you can copy the respectively lines of code and paste it in a custom script in your original trigger. Now you just have to change the custom script so that you use local variable. Example:
Trigger:
Custom script: local integer SpellDamage=0
Set SpellDamage = 1
This would not work, because:
In line 1 SpellDamage is a local variable and
in line 2 SpellDamage is a global variable!

You would have to use the following if you want to use the local variable SpellDamage (the custom script):
Trigger:
Custom script: local integer SpellDamage=0
Custom script: set SpellDamage=1
And as explained above, SpellDamage would be cleared from memory at the trigger's end, because it is an integer.

Note:
Local variables must be declared at the beginning of your trigger!
Local variables can only be used in their respectively trigger! If you want to use a variable from another trigger, then you either have to use global variables (udg_*) or gamecache.


@ Moss:
Quote:
Does setting to null actually work? I always thought you had to use the special functions like "call DestroyGroup(udg_Temp_Group)"
You have to use both. First you have to destroy the group, then you have to set it to null.
But as already mentioned, I don't think that you have to set a global variable to null, because you can use it later on...
__________________
my nicknames:
20002006200720102012
Master of SicknessDesignatusKakarotEdwardElricSourceSeeker

Last edited by MasterofSickness : 08-20-2006 at 03:15 AM.
MasterofSickness is offline   Reply With Quote
Old 08-20-2006, 05:12 AM   #20
Ignitedstar
Moderator
 
Ignitedstar's Avatar


RP Section Moderator
 
Join Date: Jul 2005
Posts: 1,755

Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)Ignitedstar has a spectacular aura about (102)

Send a message via MSN to Ignitedstar Send a message via Yahoo to Ignitedstar
Default

MasterofSickness is giving us lectures?

Oh well. MasterofSickness, all of that stuff is good to know. I'll document it somewhere.
__________________
Current Activity: It's a secret, now.
Evaluation: I actually logged in?!?!
"If I speak in the tongues of men and of angels, but have not love,
I am only a resounding gong or a clanging cymbal.
If I have the gift of prophecy and can fathom all mysteries and all knowledge,
and if I have a faith that can move mountains, but have not love, I am nothing."

1 Corinthians 13:1-2

Current Works:
None.
Ignitedstar is offline   Reply With Quote
Old 08-20-2006, 05:49 AM   #21
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

Quote:
Originally Posted by Ignitedstar
MasterofSickness is giving us lectures?

What's wrong with that?
__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.
Alevice is offline   Reply With Quote
Old 08-20-2006, 01:07 PM   #22
MasterofSickness
User
 
MasterofSickness's Avatar
 
Join Date: Feb 2006
Posts: 218

MasterofSickness is on a distinguished road (23)

Default

@ Ignitedstar
Quote:
Sorry for boring you, but I thought it would be very helpful for you to know that.
When I started to learn JASS (or just needed some Custom Scripts), I could not get enough information and I learned it by searching through "every" thread here in the forum.
It was hard, but because of many people who replied in long and very detailed posts (not to bore, but to inform) it went very well.
So I thought that I can help you and others too, I didn't want to appear as the guy who says: "Hey you! Look how good I am and what you have to learn from me!"
I'm more the one who tries to be the exactly opposite.
Quote:
Oh well. MasterofSickness, all of that stuff is good to know. I'll document it somewhere.
Yes, do that! When you remain faithful to Wc3Campaigns and to Wc3Editing, then one day you will be happy about posts like this.

@ Alevice:
Thanks for reply, Alevice.
You remember... "Secret PM" Haha *lol* (sorry if you were seriously scared, it was just fun of me)
__________________
my nicknames:
20002006200720102012
Master of SicknessDesignatusKakarotEdwardElricSourceSeeker

Last edited by MasterofSickness : 08-20-2006 at 01:15 PM.
MasterofSickness is offline   Reply With Quote
Old 08-21-2006, 06:57 AM   #23
WTFish
User
 
Join Date: Jan 2004
Posts: 390

WTFish is on a distinguished road (22)

Default

Sweet, thanks for all the responses. All that tricky jass-y stuff cleared up, lol.
WTFish is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 05:31 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services