• 🏆 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] Why these triggers dont work together?

Status
Not open for further replies.
Level 8
Joined
Aug 4, 2008
Messages
279
Well, I made a map with gravity and moving.
When i test it, its ok, sometimes the press bug, but when i play with other players, dont work anything, why?

  • Falling P1
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set ConstantLocation[(Player number of (Owner of Humans[1]))] = (Position of Humans[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at ConstantLocation[(Player number of (Owner of Humans[1]))]) Equal to Icecrown Glacier - Rough Dirt
        • Then - Actions
          • Set TempLocation[(Player number of (Owner of Humans[1]))] = (ConstantLocation[(Player number of (Owner of Humans[1]))] offset by 10.00 towards 270.00 degrees)
          • Unit - Move Humans[1] instantly to TempLocation[(Player number of (Owner of Humans[1]))]
          • Custom script: call RemoveLocation (udg_ConstantLocation[(GetPlayerId(GetOwningPlayer(udg_Humans[1])))])
          • Custom script: call RemoveLocation (udg_TempLocation[(GetPlayerId(GetOwningPlayer(udg_Humans[1])))])
        • Else - Actions
          • Unit - Order Humans[1] to Hold Position
          • Custom script: call RemoveLocation (udg_ConstantLocation[(GetPlayerId(GetOwningPlayer(udg_Humans[1])))])
          • Custom script: call RemoveLocation (udg_TempLocation[(GetPlayerId(GetOwningPlayer(udg_Humans[1])))])
  • LeftMove
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
      • Player - Player 2 (Blue) Presses the Left Arrow key
      • Player - Player 3 (Teal) Presses the Left Arrow key
      • Player - Player 4 (Purple) Presses the Left Arrow key
      • Player - Player 5 (Yellow) Presses the Left Arrow key
      • Player - Player 6 (Orange) Presses the Left Arrow key
      • Player - Player 7 (Green) Presses the Left Arrow key
      • Player - Player 8 (Pink) Presses the Left Arrow key
      • Player - Player 9 (Gray) Presses the Left Arrow key
      • Player - Player 10 (Light Blue) Presses the Left Arrow key
      • Player - Player 11 (Dark Green) Presses the Left Arrow key
    • Conditions
      • PlatformState[(Player number of (Triggering player))] Equal to True
    • Actions
      • Unit Group - Add Humans[(Player number of (Triggering player))] to LeftKeyPress
  • ReleaseLeft
    • Events
      • Player - Player 1 (Red) Releases the Left Arrow key
      • Player - Player 2 (Blue) Releases the Left Arrow key
      • Player - Player 3 (Teal) Releases the Left Arrow key
      • Player - Player 4 (Purple) Releases the Left Arrow key
      • Player - Player 5 (Yellow) Releases the Left Arrow key
      • Player - Player 6 (Orange) Releases the Left Arrow key
      • Player - Player 7 (Green) Releases the Left Arrow key
      • Player - Player 8 (Pink) Releases the Left Arrow key
      • Player - Player 9 (Gray) Releases the Left Arrow key
      • Player - Player 10 (Light Blue) Releases the Left Arrow key
      • Player - Player 11 (Dark Green) Releases the Left Arrow key
    • Conditions
    • Actions
      • Unit Group - Remove Humans[(Player number of (Triggering player))] from LeftKeyPress
  • MovingLeft
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LeftKeyPress and do (Actions)
        • Loop - Actions
          • Set PointLeft[(Player number of (Owner of Humans[(Player number of (Triggering player))]))] = ((Position of Humans[(Player number of (Triggering player))]) offset by 14.00 towards 180.00 degrees)
          • Unit - Make Humans[(Player number of (Triggering player))] face 180.00 over 0.00 seconds
          • Unit - Move Humans[(Player number of (Triggering player))] instantly to PointLeft[(Player number of (Owner of Humans[(Player number of (Triggering player))]))]
          • Custom script: call RemoveLocation (udg_PointLeft[GetConvertedPlayerId(GetOwningPlayer(udg_Humans[GetConvertedPlayerId(GetTriggerPlayer())]))])
 
Last edited:
Level 16
Joined
Jul 21, 2008
Messages
1,121
There are lots of problems with this trigger.

First of all Set ConstantLocation = (Position of Humans[1]) + Set TempLocation = (ConstantLocation offset by 10.00 towards 270.00 degrees) leaks 66-68 times in a second.

Secondly, every time you press left arrow key the new event is registered so it may fire the trigger many times. It would be better if you just made when player presses the button, your moving unit is added to move group and when he releases it, the unit is removed from same group group. Now, if the moving unit is in group, move him just like in LeftP1Loop1 trigger.

You could also make one trigger for all players.

I have got a short example here:
  • Left Press
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
      • Player - Player 2 (Blue) Presses the Left Arrow key
      • Player - Player 3 (Teal) Presses the Left Arrow key
    • Conditions
    • Actions
      • Unit Group - Add Player[(Player number of (Triggering player))] to MovingGroup
  • Left Release
    • Events
      • Player - Player 1 (Red) Releases the Left Arrow key
      • Player - Player 2 (Blue) Releases the Left Arrow key
      • Player - Player 3 (Teal) Releases the Left Arrow key
    • Conditions
    • Actions
      • Unit Group - Remove Player[(Player number of (Triggering player))] from MovingGroup
  • Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Here you move all units --------
      • Unit Group - Pick every unit in MovingGroup and do (Actions)
        • Loop - Actions
          • -------- Your moving actions for a single unit --------
          • -------- Refer to each unit as a Picked Unit --------
 
Status
Not open for further replies.
Top