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

Sometimes they stop attacking

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
Sometimes the orbs don't attack and after some time they start again to attack.
I can't figure out why do they do that.


  • Lightning Sphere Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • Set LS_Duration[1] = 20.00
      • Set LS_Duration[2] = 30.00
      • Set LS_Duration[3] = 40.00
      • Set LS_Duration[4] = 50.00
      • Set LS_Duration[5] = 60.00
      • Set LS_SphereType[1] = Lightning Sphere (Level 1)
      • Set LS_SphereType[2] = Lightning Sphere (Level 2)
      • Set LS_SphereType[3] = Lightning Sphere (Level 3)
      • Set LS_SphereType[4] = Lightning Sphere (Level 4)
      • Set LS_SphereType[5] = Lightning Sphere (Level 5)
      • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
      • -------- ------------------------------------------------------------------------------------- --------
  • Lightning Sphere
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Sphere
    • Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • Set LS_MaxIndex = (LS_MaxIndex + 1)
      • Set LS_TrigUnit[LS_MaxIndex] = (Triggering unit)
      • Set LS_SpellLvl[LS_MaxIndex] = (Level of Lightning Sphere for LS_TrigUnit[LS_MaxIndex])
      • Set LS_Point[1] = (Position of LS_TrigUnit[LS_MaxIndex])
      • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • Set LS_Angle1[LS_MaxIndex] = 72.00
      • Set LS_Point[2] = (LS_Point[1] offset by 150.00 towards LS_Angle1[LS_MaxIndex] degrees)
      • Unit - Create 1 LS_SphereType[LS_SpellLvl[LS_MaxIndex]] for (Owner of LS_TrigUnit[LS_MaxIndex]) at LS_Point[2] facing Default building facing degrees
      • Set LS_Sphere1[LS_MaxIndex] = (Last created unit)
      • Unit - Add a LS_Duration[LS_SpellLvl[LS_MaxIndex]] second Generic expiration timer to LS_Sphere1[LS_MaxIndex]
      • Custom script: call RemoveLocation(udg_LS_Point[2])
      • -------- = --------
      • Set LS_Angle2[LS_MaxIndex] = 144.00
      • Set LS_Point[2] = (LS_Point[1] offset by 150.00 towards LS_Angle2[LS_MaxIndex] degrees)
      • Unit - Create 1 LS_SphereType[LS_SpellLvl[LS_MaxIndex]] for (Owner of LS_TrigUnit[LS_MaxIndex]) at LS_Point[2] facing Default building facing degrees
      • Set LS_Sphere2[LS_MaxIndex] = (Last created unit)
      • Unit - Add a LS_Duration[LS_SpellLvl[LS_MaxIndex]] second Generic expiration timer to LS_Sphere2[LS_MaxIndex]
      • Custom script: call RemoveLocation(udg_LS_Point[2])
      • -------- = --------
      • Set LS_Angle3[LS_MaxIndex] = 216.00
      • Set LS_Point[2] = (LS_Point[1] offset by 150.00 towards LS_Angle3[LS_MaxIndex] degrees)
      • Unit - Create 1 LS_SphereType[LS_SpellLvl[LS_MaxIndex]] for (Owner of LS_TrigUnit[LS_MaxIndex]) at LS_Point[2] facing Default building facing degrees
      • Set LS_Sphere3[LS_MaxIndex] = (Last created unit)
      • Unit - Add a LS_Duration[LS_SpellLvl[LS_MaxIndex]] second Generic expiration timer to LS_Sphere3[LS_MaxIndex]
      • Custom script: call RemoveLocation(udg_LS_Point[2])
      • -------- = --------
      • Set LS_Angle4[LS_MaxIndex] = 288.00
      • Set LS_Point[2] = (LS_Point[1] offset by 150.00 towards LS_Angle4[LS_MaxIndex] degrees)
      • Unit - Create 1 LS_SphereType[LS_SpellLvl[LS_MaxIndex]] for (Owner of LS_TrigUnit[LS_MaxIndex]) at LS_Point[2] facing Default building facing degrees
      • Set LS_Sphere4[LS_MaxIndex] = (Last created unit)
      • Unit - Add a LS_Duration[LS_SpellLvl[LS_MaxIndex]] second Generic expiration timer to LS_Sphere4[LS_MaxIndex]
      • Custom script: call RemoveLocation(udg_LS_Point[2])
      • -------- = --------
      • Set LS_Angle5[LS_MaxIndex] = 360.00
      • Set LS_Point[2] = (LS_Point[1] offset by 150.00 towards LS_Angle5[LS_MaxIndex] degrees)
      • Unit - Create 1 LS_SphereType[LS_SpellLvl[LS_MaxIndex]] for (Owner of LS_TrigUnit[LS_MaxIndex]) at LS_Point[2] facing Default building facing degrees
      • Set LS_Sphere5[LS_MaxIndex] = (Last created unit)
      • Unit - Add a LS_Duration[LS_SpellLvl[LS_MaxIndex]] second Generic expiration timer to LS_Sphere5[LS_MaxIndex]
      • Custom script: call RemoveLocation(udg_LS_Point[2])
      • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LS_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on Lightning Sphere Loop <gen>
        • Else - Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_LS_Point[1])
      • Custom script: set udg_LS_Point[1] = null
      • Custom script: set udg_LS_Point[2] = null
      • -------- ------------------------------------------------------------------------------------- --------
  • Lightning Sphere Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • For each (Integer LS_Loop) from 1 to LS_MaxIndex, do (Actions)
        • Loop - Actions
          • -------- ------------------------------------------------------------------------------------- --------
          • Set LS_Point[0] = (Position of LS_TrigUnit[LS_Loop])
          • Set LS_Point[1] = (Position of LS_Sphere1[LS_Loop])
          • Set LS_Point[2] = (Position of LS_Sphere2[LS_Loop])
          • Set LS_Point[3] = (Position of LS_Sphere3[LS_Loop])
          • Set LS_Point[4] = (Position of LS_Sphere4[LS_Loop])
          • Set LS_Point[5] = (Position of LS_Sphere5[LS_Loop])
          • -------- ------------------------------------------------------------------------------------- --------
          • -------- ------------------------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Life of LS_Sphere1[LS_Loop]) Less than or equal to 0.00
                  • (Life of LS_Sphere2[LS_Loop]) Less than or equal to 0.00
                  • (Life of LS_Sphere3[LS_Loop]) Less than or equal to 0.00
                  • (Life of LS_Sphere4[LS_Loop]) Less than or equal to 0.00
                  • (Life of LS_Sphere5[LS_Loop]) Less than or equal to 0.00
            • Then - Actions
              • -------- ------------------------------------------------------------------------------------- --------
              • Unit - Kill LS_Sphere1[LS_Loop]
              • Unit - Kill LS_Sphere2[LS_Loop]
              • Unit - Kill LS_Sphere3[LS_Loop]
              • Unit - Kill LS_Sphere4[LS_Loop]
              • Unit - Kill LS_Sphere5[LS_Loop]
              • -------- ------------------------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------------------------- --------
              • Set LS_TrigUnit[LS_Loop] = LS_TrigUnit[LS_MaxIndex]
              • Set LS_TrigUnit[LS_MaxIndex] = No unit
              • Set LS_Sphere1[LS_Loop] = LS_Sphere1[LS_MaxIndex]
              • Set LS_Sphere1[LS_MaxIndex] = No unit
              • Set LS_Sphere2[LS_Loop] = LS_Sphere2[LS_MaxIndex]
              • Set LS_Sphere2[LH_MaxIndex] = No unit
              • Set LS_Sphere3[LS_Loop] = LS_Sphere3[LS_MaxIndex]
              • Set LS_Sphere3[LS_MaxIndex] = No unit
              • Set LS_Sphere4[LS_Loop] = LS_Sphere4[LS_MaxIndex]
              • Set LS_Sphere4[LS_MaxIndex] = No unit
              • Set LS_Sphere5[LS_Loop] = LS_Sphere5[LS_MaxIndex]
              • Set LS_Sphere5[LS_MaxIndex] = No unit
              • Set LS_SpellLvl[LS_Loop] = LS_SpellLvl[LS_MaxIndex]
              • Set LS_Angle1[LS_Loop] = LS_Angle1[LS_MaxIndex]
              • Set LS_Angle2[LS_Loop] = LS_Angle2[LS_MaxIndex]
              • Set LS_Angle3[LS_Loop] = LS_Angle3[LS_MaxIndex]
              • Set LS_Angle4[LS_Loop] = LS_Angle4[LS_MaxIndex]
              • Set LS_Angle5[LS_Loop] = LS_Angle5[LS_MaxIndex]
              • Set LS_MaxIndex = (LS_MaxIndex - 1)
              • Set LS_Loop = (LS_Loop - 1)
              • -------- ------------------------------------------------------------------------------------- --------
            • Else - Actions
              • -------- ------------------------------------------------------------------------------------- --------
              • Set LS_Angle1[LS_Loop] = (LS_Angle1[LS_Loop] - 5.00)
              • Set LS_Angle2[LS_Loop] = (LS_Angle2[LS_Loop] - 5.00)
              • Set LS_Angle3[LS_Loop] = (LS_Angle3[LS_Loop] - 5.00)
              • Set LS_Angle4[LS_Loop] = (LS_Angle4[LS_Loop] - 5.00)
              • Set LS_Angle5[LS_Loop] = (LS_Angle5[LS_Loop] - 5.00)
              • Set LS_PointMove[1] = (LS_Point[0] offset by 150.00 towards LS_Angle1[LS_Loop] degrees)
              • Set LS_PointMove[2] = (LS_Point[0] offset by 150.00 towards LS_Angle2[LS_Loop] degrees)
              • Set LS_PointMove[3] = (LS_Point[0] offset by 150.00 towards LS_Angle3[LS_Loop] degrees)
              • Set LS_PointMove[4] = (LS_Point[0] offset by 150.00 towards LS_Angle4[LS_Loop] degrees)
              • Set LS_PointMove[5] = (LS_Point[0] offset by 150.00 towards LS_Angle5[LS_Loop] degrees)
              • -------- ------------------------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------------------------- --------
              • Custom script: call SetUnitX(udg_LS_Sphere1[udg_LS_Loop], GetLocationX(udg_LS_PointMove[1]))
              • Custom script: call SetUnitY(udg_LS_Sphere1[udg_LS_Loop], GetLocationY(udg_LS_PointMove[1]))
              • Custom script: call SetUnitX(udg_LS_Sphere2[udg_LS_Loop], GetLocationX(udg_LS_PointMove[2]))
              • Custom script: call SetUnitY(udg_LS_Sphere2[udg_LS_Loop], GetLocationY(udg_LS_PointMove[2]))
              • Custom script: call SetUnitX(udg_LS_Sphere3[udg_LS_Loop], GetLocationX(udg_LS_PointMove[3]))
              • Custom script: call SetUnitY(udg_LS_Sphere3[udg_LS_Loop], GetLocationY(udg_LS_PointMove[3]))
              • Custom script: call SetUnitX(udg_LS_Sphere4[udg_LS_Loop], GetLocationX(udg_LS_PointMove[4]))
              • Custom script: call SetUnitY(udg_LS_Sphere4[udg_LS_Loop], GetLocationY(udg_LS_PointMove[4]))
              • Custom script: call SetUnitX(udg_LS_Sphere5[udg_LS_Loop], GetLocationX(udg_LS_PointMove[5]))
              • Custom script: call SetUnitY(udg_LS_Sphere5[udg_LS_Loop], GetLocationY(udg_LS_PointMove[5]))
              • -------- ------------------------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------------------------- --------
              • Custom script: call RemoveLocation(udg_LS_PointMove[1])
              • Custom script: call RemoveLocation(udg_LS_PointMove[2])
              • Custom script: call RemoveLocation(udg_LS_PointMove[3])
              • Custom script: call RemoveLocation(udg_LS_PointMove[4])
              • Custom script: call RemoveLocation(udg_LS_PointMove[5])
              • -------- ------------------------------------------------------------------------------------- --------
          • -------- ------------------------------------------------------------------------------------- --------
          • -------- ------------------------------------------------------------------------------------- --------
          • Custom script: call RemoveLocation(udg_LS_Point[0])
          • Custom script: call RemoveLocation(udg_LS_Point[1])
          • Custom script: call RemoveLocation(udg_LS_Point[2])
          • Custom script: call RemoveLocation(udg_LS_Point[3])
          • Custom script: call RemoveLocation(udg_LS_Point[4])
          • Custom script: call RemoveLocation(udg_LS_Point[5])
          • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LS_MaxIndex Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • -------- ------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------- --------
      • Custom script: set udg_LS_Point[0] = null
      • Custom script: set udg_LS_Point[1] = null
      • Custom script: set udg_LS_Point[2] = null
      • Custom script: set udg_LS_Point[3] = null
      • Custom script: set udg_LS_Point[4] = null
      • Custom script: set udg_LS_Point[5] = null
      • Custom script: set udg_LS_PointMove[1] = null
      • Custom script: set udg_LS_PointMove[2] = null
      • Custom script: set udg_LS_PointMove[3] = null
      • Custom script: set udg_LS_PointMove[4] = null
      • Custom script: set udg_LS_PointMove[5] = null
      • -------- ------------------------------------------------------------------------------------- --------
 
Level 11
Joined
Dec 19, 2012
Messages
411
Well, i didn't read through all the trigger, just a quick review and saw your trigger is very inefficiency and leaks. ( sorry about that this didn't related to the question )

In On Cast trigger, LS_Angel1/2/3/4/5 with array is totally pointless since they all using the same data for each unit. Set LS_Angel with array is enough and also declare them inside Init trigger.

Polar Offset leaks one location at (LS_Point[1] offset by...) this should store into variable.

Most of your functions are totally repeat with the same actions, please use integer loop.

Anything use over 2 times should store into a variable like (Owner of LS_TrigUnit[LS_MaxIndex]) to prevent unneeded calls.


I think this post should post in Triggers&Scripts Forum...
 
Last edited:
Level 11
Joined
Dec 19, 2012
Messages
411
Where it leaks? Please point out the line because I can't find it.

Polar Offset has 2 leak, 1 point is center of... another point is center of offset by...

No, it's not because 1st sphere is at 72°, 2nd is at 144 etc..
Without those 5 variables all 5 spheres would move with same angle, but with this all 5 have different angles.

Well you're right :D I really got bit lazy to check the others trigger, sorry about that didn't notice the loop integer got use these angel.


Can't use loop because I have 5 different variables.

Although it has different variables, but all increased by 1, like 1, 2, 3 etc.. this can be easily done by loop and shorten your time to make trigger.
 
Level 18
Joined
May 11, 2012
Messages
2,103
Polar Offset has 2 leak, 1 point is center of... another point is center of offset by...



Well you're right :D I really got bit lazy to check the others trigger, sorry about that didn't notice the loop integer got use these angel.




Although it has different variables, but all increased by 1, like 1, 2, 3 etc.. this can be easily done by loop and shorten your time to make trigger.

I'm sorry haha, I just don't see it haha
In which trigger it is?

;)

I still use different variables, I can't seem to find a way to do this with loop? :D
 
Level 11
Joined
Dec 19, 2012
Messages
411
I'm sorry haha, I just don't see it haha
In which trigger it is?

;)

I still use different variables, I can't seem to find a way to do this with loop? :D

Oh yea, how to do this with loop? :p

Since you have 5 LS_Sphere for each unit after casted a spell, with constant. So at start you could Set LS_IndexMax = (LS_IndexMax + 5), so the 0, 1, 2, 3, 4 array size will be reserved for 5 sphere. If a unit done cast and wan replace just set LS_Sphere[LS_Loop] = LS_Sphere[(LS_IndexMax - 5)] , for replacing sphere just do 5-5, 6-5 etc... I gave you the idea and later that use your brain to figure out how to make loop :D i tired now and going to sleep.
 
Status
Not open for further replies.
Top