HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

LoopProblem,

07-19-2004, 09:20 PM#1
Arohk
i have a little problem whit an ability trigger that should create 1 dummy unit every 0.30 seconds on the position of the caster
so it looks like the way the caster run burns behind him, also after 10 seconds the first dummy unit should die, after 0.30 seconds the next, and so on.
here is my trigger i cant find the problem :\

FireEffect = Spezial Effect Variable
DummyUnit=Unit[array 30"] variable

Code:
    Event
        Unit - Caster 0001 <gen> Start the effect of an ability
    Conditions
        (Ability being cast) equal to Roar
    Aktions
        Spezialeffekt - Create a special effect attached to the origin of Caster 0001 <gen> using Doodads\Cinematic\TownBurningFireEmitter\TownBurningFireEmitter.mdl
        Set FireEffect = (Last created special effect)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'-Bedingungen
                (Level of Roar  for Caster 0001 <gen>) equal to 1
            'THEN'-Aktionen
                For each (Integer A) from 1 to 10, do (Actions)
                    Schleifen - Aktionen
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            'IF'-Bedingungen
                                (Life of Caster 0001 <gen>) Greater than 0.00
                            'THEN'-Aktionen
                                Wait 0.30 seconds
                                Unit - Create 1 Dummy Unit for (Owner of Caster 0001 <gen>) at (Position of Caster 0001<gen>) facing 0 degrees
                                Set DummyUnit[(Integer A)] = (Last created unit)
                            'ELSE'-Aktionen
                                Do nothing
                Wait 10.00 seconds
                Spezialeffekt - Destroy FireEffect
                For each (Integer B) from 1 to 10, do (Actions)
                    Schleifen - Aktionen
                        Unit - Kill DummyUnit[(Integer B)]
                        Wait 0.30 seconds
            'ELSE'-Aktionen
                Do nothing
07-19-2004, 10:53 PM#2
Rafael Br
Using wait actions on loops cause bugs, remove the wait actions, or use a timmer, it should work then.
07-19-2004, 11:53 PM#3
th15
Yea, what Rafael said. The only way to do loops with waits effectively is to loop the entire trigger using either a periodic time event or a "Trigger- run this trigger" action.
07-20-2004, 08:12 AM#4
Dark_Uber
I'm not positive what your trying to do, but if all you need is to have the dummy units die after 10 seconds you could just give it a 10 second expiration timer. You may do this by a trigger "Add 10 sec experation timer to (last created unit)" Hope this helps... :D
07-20-2004, 12:01 PM#5
Yukitan
Hmmm I am sorry I clicked on the wrong button.
07-20-2004, 01:43 PM#6
Anitarf
Yeah, the "die after 10 seconds" can be done with expirations, a lot simpler. And as others said, loops and waits don't mix, because while you wait, another trigger may run and mix up the loop variable. Try using, instead of integer A or B, some other integer variable that isn't used in any other trigger.