• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Variable

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
The same variable can be used for multiple (let's say 30) triggers?

  • Set Variable = Casting Unit
EDIT: I'll be more specif, these are the variables
  • Set DamageEventType = 1
  • Set DMGS_Ability = (Ability being cast)
This is a system, Damage Modification System. I'm asking if the same variable can be used more than twice because this system has this action in other trigger
  • If - Conditions
    • DMGS_Ability Equal to Your_abilitiy
so the DMGS_Ability must be an ability, but if we want this system working with all abilities ? We have to trigger DMGS_Ability all abilities, am I right ? So it's used for multiple functions. Or am I wrong ?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
If it is global then yes. Whether or not the results are what you want is another question entirely.

WC3 trigger system will only ever execute a single trigger at a time and does so atomicly (no pre-emption). Certain native calls may result in a new thread being scheduled which can cause problems. This means that the only time you need to be concerned is if the variable is used to retain data between execution jobs or if the current job spawns another job that uses the variable.

For this reason you should try and use locals when possible (locals are a pure JASS feature that WC3 GUI hides from you).
 
  • Like
Reactions: hdm

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
If it is global then yes. Whether or not the results are what you want is another question entirely.

WC3 trigger system will only ever execute a single trigger at a time and does so atomicly (no pre-emption). Certain native calls may result in a new thread being scheduled which can cause problems. This means that the only time you need to be concerned is if the variable is used to retain data between execution jobs or if the current job spawns another job that uses the variable.

For this reason you should try and use locals when possible (locals are a pure JASS feature that WC3 GUI hides from you).

Er.... What ? Sorry, it's my fault, I am not "that" experienced. I couldn't understand very well this.
 
He means if you are using a variable in one trigger (fx. setting a unit variable to Casting unit).
Then thats fine if you only need that variable in that trigger. If you never need to use the data from the variable you set in one trigger, in another, then you are fine by using the same variable. Because when a trigger is run it will finish before anything else happens.

But if you store the casting unit in a variable because you need it in another trigger, then you can run into problems because the variable can get overwritten by another trigger using the same variable.

Hope that was a little easier to understand then DSG's techno mumbo jumbo.
 

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
That's what I was needing, thanks guys. I can't rep Solu9 cuz "I need spread more rep before rping for you"
 
Status
Not open for further replies.
Top