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

Problem in Loop actions (the timer)

Status
Not open for further replies.
Level 4
Joined
Apr 15, 2016
Messages
61
  • Shadow MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shadow
    • Actions
      • Set C_Start = (C_Start + 1)
      • Set C_Caster[C_Start] = (Triggering unit)
      • Unit - Add Ghost Stealth to C_Caster[C_Start]
      • Set C_Timer[C_Start] = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • C_Start Equal to 1
        • Then - Actions
          • Trigger - Turn on Shadow Period <gen>
        • Else - Actions
  • Shadow Period
    • Events
      • Time - Elapsed game time is 0.03 seconds
    • Conditions
    • Actions
      • For each (Integer C_CIndex) from 1 to C_Start, do (Actions)
        • Loop - Actions
          • Set C_Timer[C_CIndex] = (C_Timer[C_CIndex] + 0.03)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • C_Timer[C_CIndex] Equal to 5.00
            • Then - Actions
              • Unit - Remove Ghost Stealth from C_Caster[C_CIndex]
              • Set C_Caster[C_CIndex] = C_Caster[C_Start]
              • Set C_Timer[C_CIndex] = C_Timer[C_Start]
              • Set C_Start = (C_Start - 1)
              • Set C_CIndex = (C_CIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • C_Start Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions

Seriously, what's wrong with this trigger ? The "Unit - Remove ability" part is not working. The unit becomes invisible FOREVER.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
How come nobody noticed it?
Uhm?
0.03 isn't a factor of 5.00. The counter will go from 4.98 -> 5.01, meaning that the condition will never be met. Change "Equal to" to "Greater than or equal to".

The only way to use 0.031250 in GUI is to tick down every 1/32 of a second.
You could also just do this:
  • Set PeriodicTimer = (1.00 / 32.00)
  • Trigger - Add to Loop <gen> the event (Time - Every PeriodicTimer seconds of game time)
 
Status
Not open for further replies.
Top