• 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] Command -ms

Status
Not open for further replies.
Level 3
Joined
Jun 19, 2014
Messages
26
Hello again,

How to show a game message only for a single a player? In this case, the movement speed of the selected unit. Here is what I did, but it shows the message for all players (also prevents the selected units from casting spells till you type -ms again).
  • Movement Speed
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as An exact match
      • Player - Player 2 (Blue) types a chat message containing -ms as An exact match
      • Player - Player 3 (Teal) types a chat message containing -ms as An exact match
      • Player - Player 4 (Purple) types a chat message containing -ms as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -ms as An exact match
      • Player - Player 6 (Orange) types a chat message containing -ms as An exact match
      • Player - Player 7 (Green) types a chat message containing -ms as An exact match
      • Player - Player 8 (Pink) types a chat message containing -ms as An exact match
      • Player - Player 9 (Gray) types a chat message containing -ms as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -ms as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -ms as An exact match
      • Player - Player 12 (Brown) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Set Selection = (Units currently selected by (Triggering player))
      • Unit Group - Pick every unit in Selection and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Game - Display to (All players matching ((Owner of (Picked unit)) Equal to (Triggering player))) the text: ((Name of (Picked unit)) + ( movement speed: + (String((Integer((Current movement speed of (Picked unit))))))))
            • Else - Actions
              • Do nothing
 
Level 3
Joined
Jun 19, 2014
Messages
26
Thanks, it worked now. I didn't know that function. +rep
Here is the fixed trigger if someone wants:

  • Movement Speed
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as An exact match
      • Player - Player 2 (Blue) types a chat message containing -ms as An exact match
      • Player - Player 3 (Teal) types a chat message containing -ms as An exact match
      • Player - Player 4 (Purple) types a chat message containing -ms as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -ms as An exact match
      • Player - Player 6 (Orange) types a chat message containing -ms as An exact match
      • Player - Player 7 (Green) types a chat message containing -ms as An exact match
      • Player - Player 8 (Pink) types a chat message containing -ms as An exact match
      • Player - Player 9 (Gray) types a chat message containing -ms as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -ms as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -ms as An exact match
      • Player - Player 12 (Brown) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Set Selection = (Units currently selected by (Triggering player))
      • Unit Group - Pick every unit in Selection and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Game - Display to (Player group((Triggering player))) the text: ((Name of (Picked unit)) + ( movement speed: + (String((Integer((Current movement speed of (Picked unit))))))))
            • Else - Actions
              • Do nothing
      • Custom script: call DestroyGroup(udg_Selection)
It show the movement speed for every unit selected by the player and owned by himself.
 
Level 3
Joined
Jun 19, 2014
Messages
26
So, I have to set the variable before, isn't? And Do Nothing leaks too? I'll remove all the "Do Nothing"s I made.
 
Status
Not open for further replies.
Top