• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] -ms command

Status
Not open for further replies.
Level 2
Joined
Jul 7, 2013
Messages
10
Hello! I am making an AoS map and I'm making the "ms command" just like in DotA that will tell you your current movement speed. I am using only 1 array unit-variable for all the players. However, I tested it and only Player 1's command works. Here are the triggers:
  • Selects Centurion
    • Events
      • Unit - A unit enters Centurion <gen>
    • Conditions
      • (Dummy Centurion <gen> contains Centurion 0076 <gen>) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 1 (Red) at (Center of Good Heroes <gen>) facing Default building facing degrees
          • Set Hero[1] = (Last created unit)
          • Selection - Select Hero[1] for Player 1 (Red)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 2 (Blue) at (Center of Good Heroes <gen>) facing Default building facing degrees
          • Set Hero[2] = (Last created unit)
          • Selection - Select Hero[2] for Player 2 (Blue)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 3 (Teal)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 3 (Teal) at (Center of Good Heroes <gen>) facing Default building facing degrees
          • Set Hero[3] = (Last created unit)
          • Selection - Select Hero[3] for Player 3 (Teal)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 4 (Purple)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 4 (Purple) at (Center of Good Heroes <gen>) facing Default building facing degrees
          • Set Hero[4] = (Last created unit)
          • Selection - Select Hero[4] for Player 4 (Purple)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 5 (Yellow)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 5 (Yellow) at (Center of Good Heroes <gen>) facing Default building facing degrees
          • Set Hero[5] = (Last created unit)
          • Selection - Select Hero[5] for Player 5 (Yellow)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 7 (Green)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 7 (Green) at (Center of Evil Heroes <gen>) facing Default building facing degrees
          • Set Hero[7] = (Last created unit)
          • Selection - Select Hero[7] for Player 7 (Green)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 8 (Pink)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 8 (Pink) at (Center of Evil Heroes <gen>) facing Default building facing degrees
          • Set Hero[8] = (Last created unit)
          • Selection - Select Hero[8] for Player 8 (Pink)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 9 (Gray) at (Center of Evil Heroes <gen>) facing Default building facing degrees
          • Set Hero[9] = (Last created unit)
          • Selection - Select Hero[9] for Player 9 (Gray)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 10 (Light Blue)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 10 (Light Blue) at (Center of Evil Heroes <gen>) facing Default building facing degrees
          • Set Hero[10] = (Last created unit)
          • Selection - Select Hero[10] for Player 10 (Light Blue)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Unit - Create 1 Centurion for Player 11 (Dark Green) at (Center of Evil Heroes <gen>) facing Default building facing degrees
          • Set Hero[11] = (Last created unit)
          • Selection - Select Hero[11] for Player 11 (Dark Green)
          • Unit - Remove (Entering unit) from the game
          • Unit - Remove Centurion 0076 <gen> from the game
        • Else - Actions
  • MS 1
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: (((Proper name of Hero[1]) + 's) + ( movement speed is + (String((Current movement speed of Hero[1])))))
  • MS 2
    • Events
      • Player - Player 2 (Blue) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: (((Proper name of Hero[2]) + 's) + ( movement speed is + (String((Current movement speed of Hero[2])))))
And the same with all players. How do I make it work with all players? BTW, i'm new :)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
u are leaking locations which will cause lag in ur game later.
never use entering unit use triggering unit instead.
also the condition u use at the top only allows one unit to trigger that first thing that creates the units for each of the players. u have to add the other units to the conditions or the other players wont be able to get the unit.

u should look at the things that leak tutorial found on the triggers and scripts page. u should also look at my tutorial things a GUIer should know as it will help u learn a lot about efficient coding in GUI and a lot about other useful things in GUI.

ur MS trigger can be all in one trigger like this.
  • MS trig
    • 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
    • Conditions
    • Actions
      • Set tempPlayer = (triggering player)
      • Set tempInt = ( player number of tempPlayer)
      • Game - Display to (All allies of tempPlayer) the text: (String((Current movement speed of Hero[tempInt])))
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
deathismyfriend; said:
ur MS trigger can be all in one trigger like this.
  • MS trig
    • 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
    • Conditions
    • Actions
      • Set tempPlayer = (triggering player)
      • Set tempInt = ( player number of tempPlayer)
      • Game - Display to (All allies of tempPlayer) the text: (String((Current movement speed of Hero[tempInt])))
deathismyfriend; said:
anything u use twice or more store into a variable and use the variable.
Now you fail me :p
 
Status
Not open for further replies.
Top