• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Whats wrong with this?

Status
Not open for further replies.
Level 12
Joined
Dec 10, 2008
Messages
850
So, latley, I've been really wanting to re-do a few spells, and I've run into a problem... The lightning effects WILL NOT destroy. At all, its like it never reachs that line, but after some debugging, it works. It's never happend before, until now.

JASS:
scope Light initializer InitTrig_Light
     
    globals
        private constant string  Lightning = "HWSB" //RAWCODE!
        private constant integer SPELL_ID  = 'A003'
        private constant string  Effect1   = "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl"
        private constant integer DAMBASE   = 100 // This is the base damage. It is multiplyed by the level later
        private constant real    Real1     = 45 //Change the Real stuff up to Real4 to change were the lightning is created(Degrees)
        private constant real    Real2     = 135
        private constant real    Real3     = 225
        private constant real    Real4     = 315
        private constant real    Real5     = 400 // Change this to increase or decrease how far away the lightning is
        private constant real    Real6     = 750 // This changes the size of the area were units are grouped and effects are created
        private constant real    Real7     = 500//Change this to set the height of the lightnings in the air.
        private constant real    Real8     = 250//Change this to set the height were the lightning meets above the caster.Set it heigher them Rea7 to make it over the cube.
        private boolexpr BOOL // Don't touch this
    endglobals
     
    private function FilterFunc takes nothing returns boolean        
        local unit u = GetFilterUnit()        
        local boolean ok = GetWidgetLife(u) > .405 and IsUnitEnemy(u,GetOwningPlayer(GetTriggerUnit()))        
        set u = null        
        return ok    
    endfunction 

     private function Light_Conditions takes nothing returns boolean
          return GetSpellAbilityId() == SPELL_ID
     endfunction

     private function Light_Actions takes nothing returns nothing
          local unit      C     = GetSpellAbilityUnit()
          local location  CL    = GetUnitLoc(C)
          local real      CR    = GetUnitX(C)
          local real      RC    = GetUnitY(C)
          local rect      R     = RectFromCenterSizeBJ(CL,Real6,Real6)
          local player    Y     = GetOwningPlayer(C)
          local integer   Level = GetUnitAbilityLevel(C,SPELL_ID)
          local integer   Index
          local real      X1    = CR + Real5 * Cos(Real1*bj_DEGTORAD)
          local real      X2    = CR + Real5 * Cos(Real2*bj_DEGTORAD)
          local real      X3    = CR + Real5 * Cos(Real3*bj_DEGTORAD)
          local real      X4    = CR + Real5 * Cos(Real4*bj_DEGTORAD)
          local real      Y1    = RC + Real5 * Sin(Real1*bj_DEGTORAD)
          local real      Y2    = RC + Real5 * Sin(Real2*bj_DEGTORAD)
          local real      Y3    = RC + Real5 * Sin(Real3*bj_DEGTORAD)
          local real      Y4    = RC + Real5 * Sin(Real4*bj_DEGTORAD)
          local real      Z1    = GetUnitFlyHeight(C)+Real7
          local real      Z2    = GetUnitFlyHeight(C)+Real8
          local lightning array L
          local real      M1
          local real      M2
          local real      X5
          local real      Y5
          local integer   P     =1
          local real Damage = DAMBASE * Level
          local location  M
          local integer   PE    =30*Level
          local unit      U
          local group     G = CreateGroup()
          set L[1]    = AddLightning(Lightning,true,X1,Y1,X2,Y2)
          set L[2]    = AddLightning(Lightning,true,X2,Y2,X3,Y3)
          set L[3]    = AddLightning(Lightning,true,X3,Y3,X4,Y4)
          set L[4]    = AddLightning(Lightning,true,X4,Y4,X1,Y1)
          set L[5]    = AddLightningEx(Lightning,true,X1,Y1,0,X1,Y1,Z1)
          set L[6]    = AddLightningEx(Lightning,true,X2,Y2,0,X2,Y2,Z1)
          set L[7]    = AddLightningEx(Lightning,true,X3,Y3,0,X3,Y3,Z1)
          set L[8]    = AddLightningEx(Lightning,true,X4,Y4,0,X4,Y4,Z1)
          set L[9]    = AddLightningEx(Lightning,true,X1,Y1,Z1,X2,Y2,Z1)
          set L[10]   = AddLightningEx(Lightning,true,X2,Y2,Z1,X3,Y3,Z1)
          set L[11]   = AddLightningEx(Lightning,true,X3,Y3,Z1,X4,Y4,Z1)
          set L[12]   = AddLightningEx(Lightning,true,X4,Y4,Z1,X1,Y1,Z1)
          set L[13]   = AddLightningEx(Lightning,true,X1,Y1,Z1,CR,RC,Z2)
          set L[14]   = AddLightningEx(Lightning,true,X2,Y2,Z1,CR,RC,Z2)
          set L[15]   = AddLightningEx(Lightning,true,X3,Y3,Z1,CR,RC,Z2)
          set L[16]   = AddLightningEx(Lightning,true,X4,Y4,Z1,CR,RC,Z2)
          set L[17]   = AddLightningEx(Lightning,true,X1,Y1,0,CR,RC,Z2)
          set L[18]   = AddLightningEx(Lightning,true,X2,Y2,0,CR,RC,Z2)
          set L[19]   = AddLightningEx(Lightning,true,X3,Y3,0,CR,RC,Z2)
          set L[20]   = AddLightningEx(Lightning,true,X4,Y4,0,CR,RC,Z2)
          call GroupEnumUnitsInRange(G,CR,RC,Real6,BOOL)
          loop
               exitwhen P==PE
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               call RemoveLocation(M)      
               call TriggerSleepAction(.3)
               set P=P+1
          endloop
          loop
               exitwhen U== null
               set U = FirstOfGroup(G)
               call GroupRemoveUnit(G,U)
               call UnitDamageTarget(C,U,Damage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
          endloop
          call RemoveRect(R)
          set P = 0
          loop
               exitwhen P==20
               call DestroyLightning(L)
               set P = P+1
          endloop
          call DestroyGroup(G)
          set C=null
     endfunction

//===========================================================================
     private function InitTrig_Light takes nothing returns nothing
          local trigger I = CreateTrigger()
          call TriggerRegisterAnyUnitEventBJ(I,EVENT_PLAYER_UNIT_SPELL_CAST)
          call TriggerAddCondition(I,Condition(function Light_Conditions))
          call TriggerAddAction(I,function Light_Actions)
          set I=null
          call Preload(Effect1)
          set BOOL = Filter(function FilterFunc)
     endfunction
endscope

JASS:
scope Lightning initializer InitTrig_Lightning

     globals
          private constant integer SPELL_ID  = 'A000'
          private constant string  Effect1   = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl"
          private constant string  Effect2   = "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl"
          private constant string  Lightning = "CHIM"//RAWCODE!
          private constant integer DAMBASE   = 100 // This is the base damage. It is multiplyed by the level later
          private constant real    Real1     = 45// Everything up to Real8 is the degree of were the lighgtning meets
          private constant real    Real2     = 90
          private constant real    Real3     = 135
          private constant real    Real4     = 180
          private constant real    Real5     = 225
          private constant real    Real6     = 270
          private constant real    Real7     = 315
          private constant real    Real8     = 360
          private constant real    Real9     = 400// How far away the effects are
          private constant real    Real10    = 750// The regions size for the effects
          private constant real    Real11    = 500// Change this to set the height were the ightning meets
          private boolexpr BOOL // Don't touch this
     endglobals
     
     private function FilterFunc takes nothing returns boolean        
        local unit u = GetFilterUnit()        
        local boolean ok = GetWidgetLife(u) > .405 and IsUnitEnemy(u,GetOwningPlayer(GetTriggerUnit()))        
        set u = null        
        return ok    
     endfunction 
     
     private function Lightning_Conditions takes nothing returns boolean
          return GetSpellAbilityId() == SPELL_ID
     endfunction

     private function Lightning_Actions takes nothing returns nothing
          local unit      C  = GetSpellAbilityUnit()
          local location  CL = GetUnitLoc(C)
          local real      CR = GetUnitX(C)
          local real      RC = GetUnitY(C)
          local player    Y  = GetOwningPlayer(C)
          local integer   Level = GetUnitAbilityLevel(C,SPELL_ID)
          local rect      R  = RectFromCenterSizeBJ(CL,Real10,Real10)
          local real      X1 = CR + Real9 * Cos(Real1 * bj_DEGTORAD)
          local real      X2 = CR + Real9 * Cos(Real2 * bj_DEGTORAD)
          local real      X3 = CR + Real9 * Cos(Real3 * bj_DEGTORAD)
          local real      X4 = CR + Real9 * Cos(Real4 * bj_DEGTORAD)
          local real      X5 = CR + Real9 * Cos(Real5 * bj_DEGTORAD)
          local real      X6 = CR + Real9 * Cos(Real6 * bj_DEGTORAD)
          local real      X7 = CR + Real9 * Cos(Real7 * bj_DEGTORAD)
          local real      X8 = CR + Real9 * Cos(Real8 * bj_DEGTORAD)
          local real      Y1 = RC + Real9 * Sin(Real1 * bj_DEGTORAD)
          local real      Y2 = RC + Real9 * Sin(Real2 * bj_DEGTORAD)
          local real      Y3 = RC + Real9 * Sin(Real3 * bj_DEGTORAD)
          local real      Y4 = RC + Real9 * Sin(Real4 * bj_DEGTORAD)
          local real      Y5 = RC + Real9 * Sin(Real5 * bj_DEGTORAD) 
          local real      Y6 = RC + Real9 * Sin(Real6 * bj_DEGTORAD)
          local real      Y7 = RC + Real9 * Sin(Real7 * bj_DEGTORAD)
          local real      Y8 = RC + Real9 * Sin(Real8 * bj_DEGTORAD)
          local real      Z  = GetUnitFlyHeight(C)+Real11
          local location  M
          local integer   P  =1
          local integer   PE = 30*Level
          local real Damage = DAMBASE * Level
          local group Group = CreateGroup()
          local unit U
          local lightning array G
          set G[1] = AddLightning (Lightning,true,X1,Y1,X2,Y2)
          set G[2] = AddLightning (Lightning,true,X2,Y2,X3,Y3)
          set G[3] = AddLightning (Lightning,true,X3,Y3,X4,Y4)
          set G[4] = AddLightning (Lightning,true,X4,Y4,X5,Y5)
          set G[5] = AddLightning (Lightning,true,X5,Y5,X6,Y6)
          set G[6] = AddLightning (Lightning,true,X6,Y6,X7,Y7)
          set G[7] = AddLightning (Lightning,true,X7,Y7,X8,Y8)
          set G[8] = AddLightning (Lightning,true,X8,Y8,X1,Y1)
          set G[9] = AddLightningEx(Lightning,true,X1,Y1,0,CR,RC,Z)
          set G[10] = AddLightningEx(Lightning,true,X2,Y2,0,CR,RC,Z)
          set G[11] = AddLightningEx(Lightning,true,X3,Y3,0,CR,RC,Z)
          set G[12] = AddLightningEx(Lightning,true,X4,Y4,0,CR,RC,Z)
          set G[13] = AddLightningEx(Lightning,true,X5,Y5,0,CR,RC,Z)
          set G[14] = AddLightningEx(Lightning,true,X6,Y6,0,CR,RC,Z)
          set G[15] = AddLightningEx(Lightning,true,X7,Y7,0,CR,RC,Z)
          set G[16] = AddLightningEx(Lightning,true,X8,Y8,0,CR,RC,Z)
          set G[17] = AddLightningEx(Lightning,true,X1,Y1,0,X1,Y1,Z)
          set G[18] = AddLightningEx(Lightning,true,X2,Y2,Z,X2,Y2,Z)
          set G[19] = AddLightningEx(Lightning,true,X3,Y3,0,X3,Y3,Z)
          set G[20] = AddLightningEx(Lightning,true,X4,Y4,0,X4,Y4,Z)
          set G[21] = AddLightningEx(Lightning,true,X5,Y5,0,X5,Y5,Z)
          set G[22] = AddLightningEx(Lightning,true,X5,Y5,0,X5,Y5,Z)
          set G[23] = AddLightningEx(Lightning,true,X6,Y6,0,X6,Y6,Z)
          set G[24] = AddLightningEx(Lightning,true,X7,Y7,0,X7,Y7,Z)
          set G[25] = AddLightningEx(Lightning,true,X8,Y8,0,X8,Y8,Z)
          call GroupEnumUnitsInRange(Group,CR,RC,Real10,BOOL)
          loop
               exitwhen P==PE
               call DestroyEffect(AddSpecialEffect(Effect2,X1,Y1))
               call DestroyEffect(AddSpecialEffect(Effect2,X2,Y2))
               call DestroyEffect(AddSpecialEffect(Effect2,X3,Y3))
               call DestroyEffect(AddSpecialEffect(Effect2,X4,Y4))
               call DestroyEffect(AddSpecialEffect(Effect2,X5,Y5))
               call DestroyEffect(AddSpecialEffect(Effect2,X6,Y6))
               call DestroyEffect(AddSpecialEffect(Effect2,X7,Y7))
               call DestroyEffect(AddSpecialEffect(Effect2,X8,Y8))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))    
               call RemoveLocation(M)
               call TriggerSleepAction(.2)
               set P=P+1
          endloop
          loop
               exitwhen U== null
               set U = FirstOfGroup(Group)
               call GroupRemoveUnit(Group,U)
               call UnitDamageTarget(C,U,Damage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
          endloop
          set P=0
          call RemoveRect(R)
          loop
               exitwhen P==26
               call DestroyLightning(G)
          endloop
          call DestroyGroup(Group)
          set C=null
     endfunction

//===========================================================================
     private function InitTrig_Lightning takes nothing returns nothing
          local trigger I = CreateTrigger()
          call TriggerRegisterAnyUnitEventBJ(I, EVENT_PLAYER_UNIT_SPELL_CAST )
          call TriggerAddCondition(I,Condition( function Lightning_Conditions ) )
          call TriggerAddAction(I, function Lightning_Actions )
          call Preload(Lightning)
          call Preload(Effect1)
          call Preload(Effect2)
          call Preload(Lightning)
          set BOOL = Filter(function FilterFunc)
     endfunction
endscope

JASS:
scope Fire initializer InitTrig_Fire

     globals
          private constant integer SPELL_ID = 'A002'
          private constant string  Effect1  = "Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl" 
          private constant string  Lightning1  = "AFOD"//RAWCODE!
          private constant string  Lightning2  = "SPLK"//RAWCODE!
          private constant integer DAMBASE   = 100 // This is the base damage. It is multiplyed by the level later
          private constant real    Real1     = 45 // Everything up to Real8 changes the area were the lightning meets
          private constant real    Real2     = 90
          private constant real    Real3     = 135
          private constant real    Real4     = 180
          private constant real    Real5     = 225
          private constant real    Real6     = 270
          private constant real    Real7     = 315
          private constant real    Real8     = 360
          private constant real    Real9     = 400// This is the distance from the caster
          private constant real    Real10    = 750// This is the size of the region for the effects
          private constant real    Real11    = 500// This is the height above the caster were the effects meet
          private boolexpr BOOL //Don't touch this
     endglobals
     
        private function FilterFunc takes nothing returns boolean        
        local unit u = GetFilterUnit()        
        local boolean ok = GetWidgetLife(u) > .405 and IsUnitEnemy(u,GetOwningPlayer(GetTriggerUnit()))        
        set u = null        
        return ok    
    endfunction 

     private function Fire_Conditions takes nothing returns boolean
          return GetSpellAbilityId() == SPELL_ID
     endfunction

     private function Fire_Actions takes nothing returns nothing
          local unit            C  = GetSpellAbilityUnit()
          local location        CL = GetUnitLoc(C)
          local real            RC = GetUnitX(C)
          local real            CR = GetUnitY(C)
          local player          Y  = GetOwningPlayer(C)
          local integer         Level = GetUnitAbilityLevel(C,SPELL_ID)
          local rect            R  = RectFromCenterSizeBJ(CL,Real10,Real10)
          local real            X1 = RC + Real9 * Cos(Real1 * bj_DEGTORAD)
          local real            X2 = RC + Real9 * Cos(Real2 * bj_DEGTORAD)
          local real            X3 = RC + Real9 * Cos(Real3 * bj_DEGTORAD)
          local real            X4 = RC + Real9 * Cos(Real4 * bj_DEGTORAD)
          local real            X5 = RC + Real9 * Cos(Real5 * bj_DEGTORAD)
          local real            X6 = RC + Real9 * Cos(Real6 * bj_DEGTORAD)
          local real            X7 = RC + Real9 * Cos(Real7 * bj_DEGTORAD)
          local real            X8 = RC + Real9 * Cos(Real8 * bj_DEGTORAD)
          local real            Y1 = CR + Real9 * Sin(Real1 * bj_DEGTORAD)
          local real            Y2 = CR + Real9 * Sin(Real2 * bj_DEGTORAD)
          local real            Y3 = CR + Real9 * Sin(Real3 * bj_DEGTORAD)
          local real            Y4 = CR + Real9 * Sin(Real4 * bj_DEGTORAD)
          local real            Y5 = CR + Real9 * Sin(Real5 * bj_DEGTORAD) 
          local real            Y6 = CR + Real9 * Sin(Real6 * bj_DEGTORAD)
          local real            Y7 = CR + Real9 * Sin(Real7 * bj_DEGTORAD)
          local real            Y8 = CR + Real9 * Sin(Real8 * bj_DEGTORAD)
          local real            Z1 = GetUnitFlyHeight(C) + Real11
          local lightning array G
          local location        M 
          local integer         P  =1
          local unit            U
          local real Damage = DAMBASE * Level
          local group Group = CreateGroup()
          set G[1] = AddLightning(Lightning1,true,X1,Y1,X3,Y3)
          set G[2] = AddLightning(Lightning1,true,X3,Y3,X5,Y5)
          set G[3] = AddLightning(Lightning1,true,X5,Y5,X7,Y7)
          set G[4] = AddLightning(Lightning1,true,X7,Y7,X1,Y1)
          set G[5] = AddLightning(Lightning2,true,X2,Y2,X4,Y4)
          set G[6] = AddLightning(Lightning2,true,X4,Y4,X6,Y6)
          set G[7] = AddLightning(Lightning2,true,X6,Y6,X8,Y8)
          set G[8] = AddLightning(Lightning2,true,X8,Y8,X2,Y2)
          set G[9] = AddLightningEx(Lightning1,true,X1,Y1,0,RC,CR,Z1)
          set G[10] = AddLightningEx(Lightning2,true,X2,Y2,0,RC,CR,Z1)
          set G[11] = AddLightningEx(Lightning1,true,X3,Y3,0,RC,CR,Z1)
          set G[12] = AddLightningEx(Lightning2,true,X4,Y4,0,RC,CR,Z1)
          set G[13] = AddLightningEx(Lightning1,true,X5,Y5,0,RC,CR,Z1)
          set G[14] = AddLightningEx(Lightning2,true,X6,Y6,0,RC,CR,Z1)
          set G[15] = AddLightningEx(Lightning1,true,X7,Y7,0,RC,CR,Z1)
          set G[16] = AddLightningEx(Lightning2,true,X8,Y8,0,RC,CR,Z1)
          call GroupEnumUnitsInRange(Group,CR,RC,Real10,BOOL)
          loop
               exitwhen P==30
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))
               set M = GetRandomLocInRect(R)
               call DestroyEffect(AddSpecialEffectLoc(Effect1,M))        
               call RemoveLocation(M)
               call TriggerSleepAction(.2)
               set P=P+1
          endloop
          loop
               exitwhen U== null
               set U = FirstOfGroup(Group)
               call GroupRemoveUnit(Group,U)
               call UnitDamageTarget(C,U,Damage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
          endloop
          call RemoveRect(R)
          set P = 16
          loop
              exitwhen P==0
              call DestroyLightning(G)
              set P=P-1
          endloop
          call RemoveLocation(CL)
          set C=null
     endfunction

//===========================================================================
     private function InitTrig_Fire takes nothing returns nothing
          local trigger I = CreateTrigger()
          call TriggerRegisterAnyUnitEventBJ(I, EVENT_PLAYER_UNIT_SPELL_CAST )
          call TriggerAddCondition(I, Condition( function Fire_Conditions ) )
          call TriggerAddAction(I,function Fire_Actions)
          call Preload(Effect1)
          call Preload(Lightning1)
          call Preload(Lightning2)
          set BOOL = Filter(function FilterFunc)
     endfunction
endscope

(yes, theres TSA's, but thats next on the chopping block)
 
Add a debug in there checking the levels value, if it's 0 for some reason then the loop will crash the thread.

P(1) will never be PE(0) if it is. Also your loop won't work as u is already null, this may be the cause of your problem.

Make your loop look like this;

JASS:
      loop
           set U = FirstOfGroup(G)
           exitwhen U== null
           call GroupRemoveUnit(G,U)
           call UnitDamageTarget(C,U,Damage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
      endloop
 
Level 8
Joined
Feb 15, 2009
Messages
463
and the lightning destroying loop will also not work because u forget to set P = P +1
also try to use the 0 array slot

get your loops like this:
JASS:
local integer index = -1
local integer end = 15

loop
    set index = index + 1
    exitwhen index > end //or a number ,don't use == ,use >= or > instead
    //do actions...
endloop

also you should work with your variables in an array(like the X and Y) to be able to initialize them and then create lightnings faster in loops
this is much less writing and faster code
 
Level 8
Joined
Feb 15, 2009
Messages
463
man i talk about this
JASS:
          set P=0
          call RemoveRect(R)
          loop
               exitwhen P==26
               call DestroyLightning(G)
          endloop

and there he forget to set P = P + 1 sp i gave him an example how to do this so i gave an example if you want it soecified triggerhappy here u get

JASS:
set P = 0
loop
   exitwhen P >=26
   call DestroyLightning(G)
   set G = null
set P = P + 1
endloop

also setting the lightning to null should not be forgotten
 
I was talking about setting an end variable that just simply holds an integer that didn't come from a function return.

Doing this is pretty useless;

JASS:
local integer index = -1
local integer end = 15

loop
    set index = index + 1
    exitwhen index > end //or a number ,don't use == ,use >= or > instead
    //do actions...
endloop

While doing this saves function calls;

JASS:
local integer index = -1
local integer end = GetUnitAbilityLevel(...)

loop
    set index = index + 1
    exitwhen index > end
endloop
 
Status
Not open for further replies.
Top