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

Help with my Loop

Status
Not open for further replies.
Level 2
Joined
Apr 5, 2009
Messages
18
So like, skipping the intros since i can see no such forum here, i've tried modifying this trigger in several ways and such but i can't seem to get it to work.

You see what its suppose to do (according to my understanding) is loop through the numbers 1 - 10, doing whatever i set it to do, until it reaches 10 or is stopped by a condition etc.

Now the problem lies with the 'wait' parts. For one reason or another, the trigger just stops when it reaches either of the 'wait''s. Ive tried removing them and it looped through with no problems, so I've surmised that the problem lies with the 'wait''s although it could just as easily be the fact that i don't completely understand how the loop works and therefore am doing something wrong... halp me plz :thumbs_up:

  • Inverted Harmony Main
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Inverted Harmony (item)
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Target unit of ability being cast)) Greater than or equal to 1.00
              • And - All (Conditions) are true
                • Conditions
                  • (Mana of (Target unit of ability being cast)) Greater than (Life of (Target unit of ability being cast))
            • Then - Actions
              • Unit - Set mana of (Target unit of ability being cast) to ((Mana of (Target unit of ability being cast)) - 100.00)
              • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
              • Wait 1.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of (Target unit of ability being cast)) Greater than or equal to 1.00
                  • And - All (Conditions) are true
                    • Conditions
                      • (Life of (Target unit of ability being cast)) Greater than (Mana of (Target unit of ability being cast))
                • Then - Actions
                  • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - 100.00)
                  • Unit - Set mana of (Target unit of ability being cast) to ((Mana of (Target unit of ability being cast)) + 100.00)
                  • Wait 1.00 seconds
                • Else - Actions
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Create a timer and start it in that trigger, then create another trigger with the effects you want.
Increase an integer variable by 1 every time that trigger is activated, if the integer is under 10, start the timer again.

I hope you understand, it isn't really hard ^^
(Timers are always better than wait, because waits are actually 'random' numbers around the number you choose).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well, it could work but afaik the way is not efficient at all and kind of removes the MUI-factor of the looping? :eek:

You can make it MUI as well, but it's like you say: it's not easy and not really efficient =/
It was the first thing that popped into my mind ^^

Well, doesn't matter anyway, you've given a good system - problem should be solved :p
 
Status
Not open for further replies.
Top