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

A quick question regarding player groups

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
If I set this variable at Map Ini...

  • Set Player_Group = (Player group((Owner of (Triggering unit))))
Can I use it for all future triggers like so?

  • Game - Display to Player_Group for 0.70 seconds the text: Test
Or do I need to set the variable for each trigger it is used in since (Owner of ((Triggering Unit)) gets registered for whatever trigger the variable is in and not other triggers unless being set there too?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Or do I need to set the variable for each trigger it is used in since (Owner of ((Triggering Unit)) gets registered for whatever trigger the variable is in and not other triggers unless being set there too?
If you look at the produced JASS code all is obvious. It is evaluated when the variable is set. The result is the variable will be constant unless you set it to something else. Since there is no triggering unit at map initialization it would be a player group consisting of only Player 0.

It is possible to make dynamically evaluated statements via use of the trigger execute functionality which pauses the current thread until the trigger completes. However this is slow but does allow for dynamic linking since you can assign triggers as a variable and pass arguments to/from them with some globals. What you are asking looks more like you want to write a function to do all that stuff which you just call where required (static linking).
 
Level 8
Joined
Jul 17, 2004
Messages
283
Yeah, makes sense. So in short, I need to assign the Player Group variable when using (Owner of (Triggering unit)) at the beginning of each trigger it's used in.

Thank you
 
Status
Not open for further replies.
Top