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

Status
Not open for further replies.
Level 3
Joined
Feb 13, 2014
Messages
26
I'm trying to an event like
  • Events
    • Player - Player 1 (Red) types a chat message containing test as An exact match
only that I want to change Player 1 with Convert player index to player so I can assign a variable

What I'm trying to do is a trigger that goes on when Red types a message then when Blue types.. and so on with out having to make multiple copies of the trigger for each player.

But when I try to assign the variable I get a gray Box even though I have my integer variable created ( it acts as if it doesn't exist)
1AcMHngOQRkX8eJmtxfveZ


I even tried a work around with a dummy hero


  • Debug Copy
    • Events
      • Player - (Player((Hero level of Select 0011 <gen>))) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • Hero - Set Select 0011 <gen> Hero-level to ((Hero level of Select 0011 <gen>) + 1), Hide level-up graphics
      • Player Group - Add (Player((TempInteger + 1))) to PlayerGroup
      • Set TempInteger = (TempInteger + 1)
      • Trigger - Run Hero select Initialization Copy <gen> (checking conditions)


this last one doesn't work either, well it does for the first run
-Player 1 types... but then the event get set to player 1 indefinitely instead of changing to player 2 after its first run.

looking at how it behaves I'm guessing you cant have events like that depending on variables?
 
You can either make an event for each player:
  • Events
    • Player - Player 1 (Red) types...
    • Player - Player 2 (Blue) types...
    • Player - Player 3 (Teal) types...
    • etc.
And then refer to the player in the "Actions" portion as "Triggering Player".

Or you can register the event in a separate trigger:
  • Trigger - Add to Some Trigger <gen> the event "Player - (Owner of (Triggering Unit)) types a chat message...
(that is just off the top of my head, it might not be exactly what the function looks like). Or you can even create a loop if you want to make it for every player.

You can't have it vary in the sense that one event will refer to a variable as the player (it must always be fixed--either Player 1 (Red), Player 2 (Blue) etc.), but you can create multiple events (as shown above) and combine it with "Triggering player" to get a similar effect.
 
Level 3
Joined
Feb 13, 2014
Messages
26
Thanks! I knew about multiple events xD but you made me see the way

  • Debug Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing test as An exact match
      • Player - Player 2 (Blue) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering player) Equal to (Player((TempInteger + 1)))
        • Then - Actions
          • Player Group - Add (Player((TempInteger + 1))) to PlayerGroup
          • Set TempInteger = (TempInteger + 1)
          • Trigger - Run Hero select Initialization Copy <gen> (checking conditions)
        • Else - Actions
Works like a charm thanks
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The events in the event block in GUI are created at map init and when you write "Player - playerVar types a chat message containing test as An exact match" for example (if GUI even allows that), it does not register the variable but like any action evaluates the variable to get its current value and passes that.
 
Status
Not open for further replies.
Top