• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Problem in Loop actions (the timer)

Status
Not open for further replies.
Level 6
Joined
Apr 15, 2016
Messages
118
  • 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.
 
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.
Back
Top