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

Nested loops

Status
Not open for further replies.
Level 5
Joined
Oct 24, 2007
Messages
90
EDIT: Nevermind... there was an error somewhere else in the code... It doesn't bug!
I should retest stuff more before I ask in forums I guess.


Hello there, I was wondering (I've had this problem before) if nested-in loops with sleep functions inside bugged. For example:

JASS:
loop
    set Count = Count + 1
    set IchoronLoc = GetUnitLoc(Ichoron)
    set VortexDistance = VortexDistance - 33.
    set VortexRotation[1] = VortexRotation[1] + 10.
    set VortexRotation[2] = VortexRotation[2] + 10.
    set VortexRotation[3] = VortexRotation[3] + 10.
    set VortexRotation[4] = VortexRotation[4] + 10.
    set VortexRotation[5] = VortexRotation[5] + 10.
    exitwhen Count == 18
    call TriggerSleepAction(.01)
endloop

That piece could be shortened into this:

JASS:
loop
    set Count = Count + 1
    set IchoronLoc = GetUnitLoc(Ichoron)
    set VortexDistance = VortexDistance - 33.
    loop
        set Count2 = Count2 + 1
        set VortexRotation[Count2] = VortexRotation[Count2] + 10.
        exitwhen Count2 == 5
    endloop
    exitwhen Count == 18
    call TriggerSleepAction(.01)
endloop

That used to bug for me and execute all the actions inside the main loop instantly. Anyone know if/why it bugs?

PS: I know that piece makes no sense by itself... there's effects after it though, it's an example :p
 
Last edited:
Status
Not open for further replies.
Top