• 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.

[Trigger] Define variables in one trigger but use them in another.

Status
Not open for further replies.
Level 6
Joined
May 31, 2008
Messages
218
Is is possible to define a whole number of variables in a trigger and then use those variables in another trigger without defining them again? like making the second trigger read the first trigger and therefore retrive all variables.
 
Level 11
Joined
May 16, 2007
Messages
288
If they're global variables (variables created with the variable window in the trigger editor or through a global block in a code) yes, you can use them in other triggers, but if they're local variables you'll have to pass them to a global variable or set them again if you want the second trigger to be able to use them.
If you're using GUI, then you shouldn't worry about this since variables will always be global unless you used custom script to create locals.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Globals are always usable and changable no mater the function that is run unless they are constant, in which case they will always be readable but not changable.

locals exist only within the function they were defined in, and passed parameters can also be considered as locals as far as the way they can be referenced and changed.
 
Status
Not open for further replies.
Top