Why Doesn't This Spell Work When I Add Another Loop?

Fluffball

Well-Known Member
Reaction score
35
Ok, as the title suggests, the spell is supposed to make a 2000 by 2000 region around the caster, make him invul, no collision, all that stuff, it works fine, but when i added the 2nd and 3rd loop, he only moves to the point once, and the effects continue, and even more interestingly, he casts the spell Holy Smash. Heres the spell (With and without)


With
Code:
Charge of the Light
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Charge of Light 
    Actions
        If (MUIFix Less than 15) then do (Set MUIFix = (MUIFix + 1)) else do (Set MUIFix = 0)
        Set TempPlayer[MUIFix] = (Owner of (Triggering unit))
        Set TempBool = False
        Set TempCaster = (Casting unit)
        Unit - Change ownership of (Triggering unit) to Player 11 (Dark Green) and Retain color
        Unit - Set TempCaster movement speed to 1000.00
        Unit - Turn collision for TempCaster Off
        Unit - Add Immolation  to TempCaster
        Unit - Set level of Immolation  for TempCaster to (Level of Charge of Light  for TempCaster)
        Unit - Add Heal Aura  to TempCaster
        Unit - Set level of Immolation  for TempCaster to (Level of Charge of Light  for TempCaster)
        Unit - Make TempCaster Invulnerable
        Set TempRegion = (Region centered at (Position of TempCaster) with size (2000.00, 2000.00))
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                Set TempPoint = (Random point in TempRegion)
                Set TempRegion2 = (Region centered at TempPoint with size (250.00, 250.00))
                Unit - Order TempCaster to Move To TempPoint
                For each (Integer A) from 1 to 15, do (Actions)
                    Loop - Actions
                        Wait 1.00 seconds
                        Set TempPoint2 = (Position of (Triggering unit))
                        For each (Integer B) from 1 to 4, do (Actions)
                            Loop - Actions
                                Special Effect - Create a special effect at (TempPoint2 offset by 50.00 towards (90.00 x (Real((Integer B)))) degrees) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
                                Special Effect - Destroy (Last created special effect)
                Wait until ((TempRegion2 contains TempCaster) Equal to True), checking every 0.10 seconds
        Unit - Add Holy Smash  to TempCaster
        Unit - Set level of Holy Smash  for TempCaster to 1
        Unit - Order TempCaster to Human Mountain King - Thunder Clap
        Unit - Remove Holy Smash  from TempCaster
        Unit - Remove Heal Aura  from TempCaster
        Unit - Remove Immolation  from TempCaster
        Unit - Turn collision for TempCaster On
        Unit - Make TempCaster Vulnerable
        Unit - Set TempCaster movement speed to (Default movement speed of TempCaster)
        Unit - Change ownership of TempCaster to TempPlayer[MUIFix] and Change color

Without:

Code:
Charge of the Light
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Charge of Light 
    Actions
        If (MUIFix Less than 15) then do (Set MUIFix = (MUIFix + 1)) else do (Set MUIFix = 0)
        Set TempPlayer[MUIFix] = (Owner of (Triggering unit))
        Set TempBool = False
        Set TempCaster = (Casting unit)
        Unit - Change ownership of (Triggering unit) to Player 11 (Dark Green) and Retain color
        Unit - Set TempCaster movement speed to 1000.00
        Unit - Turn collision for TempCaster Off
        Unit - Add Immolation  to TempCaster
        Unit - Set level of Immolation  for TempCaster to (Level of Charge of Light  for TempCaster)
        Unit - Add Heal Aura  to TempCaster
        Unit - Set level of Immolation  for TempCaster to (Level of Charge of Light  for TempCaster)
        Unit - Make TempCaster Invulnerable
        Set TempRegion = (Region centered at (Position of TempCaster) with size (2000.00, 2000.00))
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                Set TempPoint = (Random point in TempRegion)
                Set TempRegion2 = (Region centered at TempPoint with size (250.00, 250.00))
                Unit - Order TempCaster to Move To TempPoint
                Wait until ((TempRegion2 contains TempCaster) Equal to True), checking every 0.10 seconds
        Unit - Add Holy Smash  to TempCaster
        Unit - Set level of Holy Smash  for TempCaster to 1
        Unit - Order TempCaster to Human Mountain King - Thunder Clap
        Unit - Remove Holy Smash  from TempCaster
        Unit - Remove Heal Aura  from TempCaster
        Unit - Remove Immolation  from TempCaster
        Unit - Turn collision for TempCaster On
        Unit - Make TempCaster Vulnerable
        Unit - Set TempCaster movement speed to (Default movement speed of TempCaster)
        Unit - Change ownership of TempCaster to TempPlayer[MUIFix] and Change color
 

vypur85

Hibernate
Reaction score
803
Code:
        For each [B](Integer A)[/B] from 1 to 10, do (Actions)
            Loop - Actions
                Set TempPoint = (Random point in TempRegion)
                Set TempRegion2 = (Region centered at TempPoint with size (250.00, 250.00))
                Unit - Order TempCaster to Move To TempPoint
                For each [B](Integer A)[/B] from 1 to 15, do (Actions)
                    Loop - Actions
                        Wait 1.00 seconds
                        Set TempPoint2 = (Position of (Triggering unit))
                        For each (Integer B) from 1 to 4, do (Actions)
                            Loop - Actions
                                Special Effect - Create a special effect at (TempPoint2 offset by 50.00 towards (90.00 x (Real((Integer B)))) degrees) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
                                Special Effect - Destroy (Last created special effect)
                Wait until ((TempRegion2 contains TempCaster) Equal to True), checking every 0.10 seconds

You're using 1 Integer A loop inside another Integer A loop. And it's not a good idea to use waits inside Integer A/B loops. Use custom integer variable loop instead.
 

Fluffball

Well-Known Member
Reaction score
35
Thanks, +rep

Btw, how do you make a custom loop? I can't find it in the Variables section. JASS?
 
A

Andy

Guest
Rather than (Integer A), you use:
For each (Integer [Variable]) from x to x, do (Actions)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top