• 🏆 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!

[Spell] Trigger executes as one shot

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
I've got a little system where the program lets the player do some parkour moves when we are close to certain "units". I've tried an implementation of this but I think it can be improved. Anyways, naturally I have some problems again, here are my triggers, why does this trigger work as one shot? Am I missing something?

The problem is, when I first run into the obstacle the loop works just fine but it won't work after the first time.


Notes:
-isParkour boolean is to know if we are doing a parkour move in order not to mess up things
-isWalking boolean is to know if our character is running or walking. If he is walking he can't do parkour.
-The movespeed settings are for the movement system which are no problem for us in the loop or init.


  • Speed Vault
    • Events
      • Unit - A unit comes within 150.00 of Wooden Fence Unit 0021 <gen>
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to Achilles
          • isParkour Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsWalking Equal to False
        • Then - Actions
          • Set isParkour = True
          • Set moveSpeed = 0.00
          • Animation - Reset Achilles's animation
          • Custom script: call SetUnitAnimationByIndex(udg_Achilles, 142)
          • Trigger - Turn on Speed Vault Loop <gen>
        • Else - Actions


Notes:
-The bottom if statement is working too, it is to get our character back to running or walking depending on his previous state.

  • Speed Vault Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set parkLoc1 = (Position of Achilles)
      • Set parkLoc2 = (parkLoc1 offset by (322.00 x 0.03) towards (Facing of Achilles) degrees)
      • Unit - Move Achilles instantly to parkLoc2
      • Custom script: call RemoveLocation(udg_parkLoc1)
      • Custom script: call RemoveLocation(udg_parkLoc2)
      • Set speedVaultDist = (speedVaultDist + 3.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • speedVaultDist Greater than or equal to 150.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set isParkour = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsWalking Equal to True
            • Then - Actions
              • Set moveSpeed = 150.00
              • Custom script: call SetUnitAnimationByIndex(udg_Achilles, 1)
            • Else - Actions
              • Set moveSpeed = 322.00
              • Custom script: call SetUnitAnimationByIndex(udg_Achilles, 128)
        • Else - Actions


Another question I can ask will be this; is there a way to get unit types to execute the parkour movements instead of making events for each of the units?
 
Level 4
Joined
Jul 26, 2016
Messages
88
Hi there!

Not 100% sure of what the error might be, but put a Display Text trigger after every conditional branch (into every then and else) that allows you to see which branches execute, so as to better understand which condition is causing the problem, for example:

  • Speed Vault
    • Events
      • Unit - A unit comes within 150.00 of Wooden Fence Unit 0021 <gen>
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to Achilles
          • isParkour Equal to False
    • Actions
      • Display Text to all players - "Achilles triggered, and isParkour is False"
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsWalking Equal to False
        • Then - Actions
          • Display Text to all players - "is not walking"
          • Set isParkour = True
          • Set moveSpeed = 0.00
          • Animation - Reset Achilles's animation
          • Custom script: call SetUnitAnimationByIndex(udg_Achilles, 142)
          • Trigger - Turn on Speed Vault Loop <gen>
        • Else - Actions
          • Display Text to all players - "is walking"
Do the same with your loop trigger, and if you've done that and still cannot find the root of your problem, post which parts of the triggers execute and which parts do not, and we can try to help you better.
 
Status
Not open for further replies.
Top