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

Spell Ability leaks/laggs heavy

Status
Not open for further replies.
Level 2
Joined
Apr 23, 2018
Messages
15
Hello folks,

i am developing a map here on Hive and now i am at a point where i need help fixing my current spell i am working on. It leaks/laggs heavy and i would be pleased if someone could take a look and help me pointing out the obvious stuff that could be responsible for that. I tried myself some custom scripts to reduce leaks but it will not work somehow, i am obviously doing it wrong and need someone who can tell me how to do it properly. Help is greatly appreciated!

The spell in general picks every 0.25 seconds all nearby enemy units in range of a specific unit and adds them to a unit group, the picked units get damage and a lightning effect is created and afterwards destroyed. When a timer expires the specific unit is moved away and the spell ends.

Casting the ability:

  • Ball Lightning
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to |cffFFC53ABall Lightning
    • Actions
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Unit - Change ownership of Dummy CASTER combat Ball Lightning also effect 0111 <gen> to (Owner of HeroPickedUnit[10]) and Retain color
      • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Position of HeroPickedUnit[10]), facing (Target point of ability being cast)
      • Wait 0.20 seconds
      • Unit - Order Dummy CASTER combat Ball Lightning also effect 0111 <gen> to Move To (Target point of ability being cast)
      • Countdown Timer - Start Timer_Ball_Lightning as a One-shot timer that will expire in 5.00 seconds
      • Unit Group - Remove all units from ball_unit_group_first
      • Unit Group - Remove all units from ball_lightning_unitgroup
      • Set ball_lightning_effect_counter = 0
      • Trigger - Turn on ball lightning periodic pick <gen>
  • [Trigger/]
  • -------
  • -------
  • Timer/ability ends when:
  • -------
  • -------
  • [Trigger]timer endss
    • Events
      • Time - Timer_Ball_Lightning expires
    • Conditions
    • Actions
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 80.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 60.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 40.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 20.00% transparency
      • Trigger - Turn off ball lightning periodic pick <gen>
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 10.00% transparency
      • Wait 0.15 seconds
      • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Center of ball lightning resting place <gen>)
      • Unit Group - Remove all units from ball_lightning_unitgroup
      • For each (Integer ball_lightning_FOR) from 1 to ball_lightning_effect_counter, do (Actions)
        • Loop - Actions
          • Lightning - Destroy ball_lightning_effects[ball_lightning_FOR]
  • [Trigger/]
  • --------
  • --------
  • Periodic stuff done while ability timer is running:
  • --------
  • --------
  • [Trigger]ball lightning periodic pick
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 250.00 of (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of HeroPickedUnit[10])) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 1
                • Then - Actions
                  • Unit Group - Add (Picked unit) to ball_lightning_unitgroup
                  • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 15.00 damage of attack type Hero and damage type Normal
                  • Floating Text - Create floating text that reads (15 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 2
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to ball_lightning_unitgroup
                      • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 20.00 damage of attack type Hero and damage type Normal
                      • Floating Text - Create floating text that reads (20 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                      • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 3
                        • Then - Actions
                          • Unit Group - Add (Picked unit) to ball_lightning_unitgroup
                          • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 25.00 damage of attack type Hero and damage type Normal
                          • Floating Text - Create floating text that reads (25 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                          • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                          • Floating Text - Change (Last created floating text): Disable permanence
                          • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 4
                            • Then - Actions
                              • Unit Group - Add (Picked unit) to ball_lightning_unitgroup
                              • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 30.00 damage of attack type Hero and damage type Normal
                              • Floating Text - Create floating text that reads (25 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                              • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                              • Floating Text - Change (Last created floating text): Disable permanence
                              • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 5
                                • Then - Actions
                                  • Unit Group - Add (Picked unit) to ball_lightning_unitgroup
                                  • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 35.00 damage of attack type Hero and damage type Normal
                                  • Floating Text - Create floating text that reads (35 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                                  • Floating Text - Change (Last created floating text): Disable permanence
                                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                                • Else - Actions
                                  • Do nothing
            • Else - Actions
              • Do nothing
      • Set ball_unit_group_first = (Last created unit group)
      • Custom script: call DestroyGroup(udg_ball_unit_group_first)
      • Unit Group - Pick every unit in ball_lightning_unitgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of HeroPickedUnit[10])) Equal to True
            • Then - Actions
              • Set ball_lightning_effect_counter = (ball_lightning_effect_counter + 1)
              • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>) to target (Position of (Picked unit))
              • Set ball_lightning_effects[(ball_lightning_effect_counter + 1)] = (Last created lightning effect)
              • Set tem_pos_bal_lightning_pickunit = (Position of (Picked unit))
              • Custom script: call RemoveLocation(udg_tem_pos_bal_lightning_pickunit)
              • Unit Group - Remove (Picked unit) from ball_lightning_unitgroup
            • Else - Actions
              • Do nothing
      • Set tempUnitGroup_ball_lightning = (Last created unit group)
      • Wait 0.15 seconds
      • For each (Integer ball_lightning_FOR) from 1 to ball_lightning_effect_counter, do (Actions)
        • Loop - Actions
          • Lightning - Destroy ball_lightning_effects[ball_lightning_FOR]
      • Custom script: call DestroyGroup(udg_tempUnitGroup_ball_lightning)

I need some help fixing my leak/lagg problem with this spell. Thank you very much, i hope i can learn from it and fix my other spells too!

greetings
Ahne
 
Last edited:
Level 5
Joined
Apr 7, 2018
Messages
69
sry i was in rush didnt had much time i just looked at it and i saw few memory leaks and asumed that you dont know about them

for example
  • Unit Group - Pick every unit in (Units within 250.00 of (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>)) and do (Actions)
  • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Center of ball lightning resting place <gen>)
  • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>) to target (Position of (Picked unit))
  • Unit - Order Dummy CASTER combat Ball Lightning also effect 0111 <gen> to Move To (Target point of ability being cast)
there might be more i will post later
 
Last edited:
Level 2
Joined
Apr 23, 2018
Messages
15
Yes i tried to fix them but it didnt worked as expected..still leaks and laggs, thats why i need someone to look over them and show me how to do it properly.
 
Level 5
Joined
Apr 7, 2018
Messages
69
Here you have examples how to do it

Group Example:
  • Example 1
    • Actions
      • Set TempGROUP = (Units within 512.00 of (Center of (Playable map area)))
      • Unit Group - Pick every unit in TempGROUP and do (Actions)
        • Loop - Actions
          • -------- do stuff --------
      • Custom script: call DestroyGroup(udg_Temp_GROUP)
Point Example:
  • Example 2
    • Actions
      • Set TempPOINT = (Position of (Target unit of ability being cast))
      • Unit - Order (Last created unit) to Move To TempPOINT
      • Custom script: call DestroyLocation(udg_Temp_POINT)
here you have what is broken

Group:
  • Unit Group - Pick every unit in (Units within 250.00 of (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>)) and do (Actions)
Point:
  • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Center of ball lightning resting place <gen>)
  • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>) to target (Position of (Picked unit))
  • Unit - Order Dummy CASTER combat Ball Lightning also effect 0111 <gen> to Move To (Target point of ability being cast)
 
Level 2
Joined
Apr 23, 2018
Messages
15
I watched the leak tutorial and i also used this behind the pick unit group trigger
  • empty.gif
    join.gif
    set.gif
    Set ball_unit_group_first = (Last created unit group)
  • empty.gif
    join.gif
    page.gif
    Custom script: call DestroyGroup(udg_ball_unit_group_first)

So i still dont know how to fix my leak, i used that as shown in your example but it doesnt work. Where and how do i put it to remove the leak.
 
Level 5
Joined
Apr 7, 2018
Messages
69
i litteraly never seen that "Last created unit group"

But i have an idea how to do this

Could you post triggers again but wihout "trigger" tag so i can show it to you with your triggers. you can put it in "spoiler" tag instead so it does not take up that much space.
 
Level 2
Joined
Apr 23, 2018
Messages
15
Ball Lightning
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to |cffFFC53ABall Lightning
Actions
Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Unit - Change ownership of Dummy CASTER combat Ball Lightning also effect 0111 <gen> to (Owner of HeroPickedUnit[10]) and Retain color
Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Position of HeroPickedUnit[10]), facing (Target point of ability being cast)
Wait 0.20 seconds
Unit - Order Dummy CASTER combat Ball Lightning also effect 0111 <gen> to Move To (Target point of ability being cast)
Countdown Timer - Start Timer_Ball_Lightning as a One-shot timer that will expire in 5.00 seconds
Unit Group - Remove all units from ball_unit_group_first
Unit Group - Remove all units from ball_lightning_unitgroup
Set ball_lightning_effect_counter = 0
Trigger - Turn on ball lightning periodic pick <gen>
[spoiler/]

timer endss
Events
Time - Timer_Ball_Lightning expires
Conditions
Actions
Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 80.00% transparency
Wait 0.15 seconds
Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 60.00% transparency
Wait 0.15 seconds
Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 40.00% transparency
Wait 0.15 seconds
Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 20.00% transparency
Trigger - Turn off ball lightning periodic pick <gen>
Wait 0.15 seconds
Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 10.00% transparency
Wait 0.15 seconds
Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Center of ball lightning resting place <gen>)
Unit Group - Remove all units from ball_lightning_unitgroup
For each (Integer ball_lightning_FOR) from 1 to ball_lightning_effect_counter, do (Actions)
Loop - Actions
Lightning - Destroy ball_lightning_effects[ball_lightning_FOR]
[spoiler/]

ball lightning periodic pick
Events
Time - Every 0.25 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units within 250.00 of (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A structure) Equal to False
((Picked unit) is alive) Equal to True
((Picked unit) belongs to an enemy of (Owner of HeroPickedUnit[10])) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 1
Then - Actions
Unit Group - Add (Picked unit) to ball_lightning_unitgroup
Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 15.00 damage of attack type Hero and damage type Normal
Floating Text - Create floating text that reads (15 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 2
Then - Actions
Unit Group - Add (Picked unit) to ball_lightning_unitgroup
Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 20.00 damage of attack type Hero and damage type Normal
Floating Text - Create floating text that reads (20 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 3
Then - Actions
Unit Group - Add (Picked unit) to ball_lightning_unitgroup
Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 25.00 damage of attack type Hero and damage type Normal
Floating Text - Create floating text that reads (25 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 4
Then - Actions
Unit Group - Add (Picked unit) to ball_lightning_unitgroup
Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 30.00 damage of attack type Hero and damage type Normal
Floating Text - Create floating text that reads (25 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 5
Then - Actions
Unit Group - Add (Picked unit) to ball_lightning_unitgroup
Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 35.00 damage of attack type Hero and damage type Normal
Floating Text - Create floating text that reads (35 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
Else - Actions
Do nothing
Else - Actions
Do nothing
Set ball_unit_group_first = (Last created unit group)
Custom script: call DestroyGroup(udg_ball_unit_group_first)
Unit Group - Pick every unit in ball_lightning_unitgroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A structure) Equal to False
((Picked unit) is alive) Equal to True
((Picked unit) belongs to an enemy of (Owner of HeroPickedUnit[10])) Equal to True
Then - Actions
Set ball_lightning_effect_counter = (ball_lightning_effect_counter + 1)
Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>) to target (Position of (Picked unit))
Set ball_lightning_effects[(ball_lightning_effect_counter + 1)] = (Last created lightning effect)
Set tem_pos_bal_lightning_pickunit = (Position of (Picked unit))
Custom script: call RemoveLocation(udg_tem_pos_bal_lightning_pickunit)
Unit Group - Remove (Picked unit) from ball_lightning_unitgroup
Else - Actions
Do nothing
Set tempUnitGroup_ball_lightning = (Last created unit group)
Wait 0.15 seconds
For each (Integer ball_lightning_FOR) from 1 to ball_lightning_effect_counter, do (Actions)
Loop - Actions
Lightning - Destroy ball_lightning_effects[ball_lightning_FOR]
Custom script: call DestroyGroup(udg_tempUnitGroup_ball_lightning)
[spoiler/]
 
Level 5
Joined
Apr 7, 2018
Messages
69
This is for first trigger look carefully how it works

  • Ball Lightning
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to |cffFFC53ABall Lightning
    • Actions
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Unit - Change ownership of Dummy CASTER combat Ball Lightning also effect 0111 <gen> to (Owner of HeroPickedUnit[10]) and Retain color
      • Set Temp_POINT = (Position of (Target unit of ability being cast))
      • Set Temp_POINT2 = (Position of HeroPickedUnit[10]))
      • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Temp_POINT2), facing (Temp_POINT)
      • Custom script: call RemoveLocation(udg_TempPOINT)
      • Custom script: call RemoveLocation(udg_TempPOINT2)
      • Wait 0.20 seconds
      • Set Temp_POINT = (Position of (Target unit of ability being cast))
      • Unit - Order Dummy CASTER combat Ball Lightning also effect 0111 <gen> to Move To (TempPOINT)
      • Custom script: call RemoveLocation(udg_TempPOINT)
      • Countdown Timer - Start Timer_Ball_Lightning as a One-shot timer that will expire in 5.00 seconds
      • Unit Group - Remove all units from ball_unit_group_first
      • Unit Group - Remove all units from ball_lightning_unitgroup
      • Set ball_lightning_effect_counter = 0
      • Trigger - Turn on ball lightning periodic pick <gen>
 
Level 2
Joined
Apr 23, 2018
Messages
15
Yes interesting thanks alot, but the more difficult one is the pick unit group leak.

thats wrong right, should be (udg_Temp_POINT and udg_Temp_POINT2) correct? Like the variable names

Iam grateful for your help really, i will learn something here


Should be changed right?
  • page.gif
    Custom script: call RemoveLocation(udg_TempPOINT) ->call RemoveLocation(udg_Temp_POINT)
  • page.gif
    Custom script: call RemoveLocation(udg_TempPOINT2)->call RemoveLocation(udg_Temp_POINT2)
 
Level 5
Joined
Apr 7, 2018
Messages
69
that should be it,
  • ball lightning periodic pick
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set ball_lightning_effect_counter = 0
      • Set TempPOINT = (Position of Dummy CASTER)
      • Set TempGROUP = (Pick every unit in (Units within 250.00 of (Position of TempPOINT combat Ball Lightning also effect 0111 <gen>)))
      • Custom script: call RemoveLocation(udg_TempPOINT)
      • Unit Group - Pick every unit in (TempGROUP) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of HeroPickedUnit[10])) Equal to True
            • Then - Actions
              • Set TempPOINT = (Position of Dummy CASTER)
              • Set TempPOINT2 = (Position of (Picked unit))
              • Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of TempPOINT) to target (Position of (TempPOINT2))
              • Custom script: call RemoveLocation(udg_TempPOINT)
              • Custom script: call RemoveLocation(udg_TempPOINT2)
              • Set ball_lightning_effects[(ball_lightning_effect_counter)] = (Last created lightning effect)
              • Set ball_lightning_effect_counter = (ball_lightning_effect_counter + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 1
                • Then - Actions
                  • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 15.00 damage of attack type Hero and damage type Normal
                  • Floating Text - Create floating text that reads (15) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                • Else - Actions
                  • OTHER LEVELS...
        • Else - Actions
          • Do nothing
      • Custom script: call DestroyGroup(udg_TempGROUP)
      • Wait 0.15 seconds
      • Set TempINTEGER = 0
      • For each (Integer A) from 1 to ball_lightning_effect_counter, do (Actions)
        • Loop - Actions
          • Lightning - Destroy ball_lightning_effects[TempINTEGER]
          • Set TempINTEGER = (TempINTEGER + 1)
 
Level 2
Joined
Apr 23, 2018
Messages
15
Thank you very much! I will try that out soon and if it works i will have learned much new stuff to optimize my other spells too over time!

Thank you, appreciate your great help mmtt!
 
Level 2
Joined
Apr 23, 2018
Messages
15
Hey guys,

i have tested and adjusted the spell but unfortunately it still leaks/laggs.
I have tested different things now but it leaks anyways. The spell works as it is intended and also all lightning effects are destroyed so they are not the culprit in my opinion. It must be the "unit group" and the events in it with pick every unit do actions.

I will paste the whole Spell here again as it is now. The spell is not fully optimized but the main issue has to do with the "pick all units" event. I hope someone can tell me what to do to fix the leak/lagg.

  • Ball Lightning
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to |cffFFC53ABall Lightning
    • Actions
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Unit - Change ownership of Dummy CASTER combat Ball Lightning also effect 0111 <gen> to (Owner of HeroPickedUnit[10]) and Retain color
      • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Position of HeroPickedUnit[10]), facing (Target point of ability being cast)
      • Unit - Order Dummy CASTER combat Ball Lightning also effect 0111 <gen> to Move To (Target point of ability being cast)
      • Countdown Timer - Start Timer_Ball_Lightning as a One-shot timer that will expire in 5.00 seconds
      • Trigger - Turn on ball lightning periodic pick <gen>
  • [trigger/]
  • [trigger]
  • timer endss
    • Events
      • Time - Timer_Ball_Lightning expires
    • Conditions
    • Actions
      • Trigger - Turn off ball lightning periodic pick <gen>
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 80.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 60.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 40.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 20.00% transparency
      • Wait 0.15 seconds
      • Animation - Change Dummy CASTER combat Ball Lightning also effect 0111 <gen>'s vertex coloring to (100.00%, 100.00%, 100.00%) with 10.00% transparency
      • Wait 0.15 seconds
      • Unit - Move Dummy CASTER combat Ball Lightning also effect 0111 <gen> instantly to (Center of ball lightning resting place <gen>)
      • Game - Display to (All players) the text: (ball lightning effect counter= + (String(ball_lightning_effect_counter)))
      • Game - Display to (All players) the text: (ball lightning FOR= + (String(ball_lightning_FOR)))
      • Set ball_lightning_effect_counter = 0
      • Game - Display to (All players) the text: (ball lightning effect counter= + (String(ball_lightning_effect_counter)))
      • -------- just some stuff for me to see if all lightning effects got removed and yes they are --------

  • ball lightning periodic pick
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Point_Ball_Light = (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>)
      • Set ball_unit_group_first = (Units within 250.00 of Temp_Point_Ball_Light)
      • Unit Group - Pick every unit in ball_unit_group_first and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of HeroPickedUnit[10])) Equal to True
              • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Greater than or equal to 1
            • Then - Actions
              • Set Temp_Point_Ball_Light = (Position of Dummy CASTER combat Ball Lightning also effect 0111 <gen>)
              • Set Temp_Point_Ball_Light2 = (Position of (Picked unit))
              • Lightning - Create a Chain Lightning - Secondary lightning effect from source Temp_Point_Ball_Light to target Temp_Point_Ball_Light2
              • Custom script: call RemoveLocation(udg_Temp_Point_Ball_Light)
              • Custom script: call RemoveLocation(udg_Temp_Point_Ball_Light2)
              • Set ball_lightning_effect_counter = (ball_lightning_effect_counter + 1)
              • Set ball_lightning_effects[ball_lightning_effect_counter] = (Last created lightning effect)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 1
                • Then - Actions
                  • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 15.00 damage of attack type Hero and damage type Normal
                  • Floating Text - Create floating text that reads (15 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 2
                    • Then - Actions
                      • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 20.00 damage of attack type Hero and damage type Normal
                      • Floating Text - Create floating text that reads (20 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                      • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 3
                        • Then - Actions
                          • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 25.00 damage of attack type Hero and damage type Normal
                          • Floating Text - Create floating text that reads (25 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                          • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                          • Floating Text - Change (Last created floating text): Disable permanence
                          • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 4
                            • Then - Actions
                              • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 30.00 damage of attack type Hero and damage type Normal
                              • Floating Text - Create floating text that reads (25 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                              • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                              • Floating Text - Change (Last created floating text): Disable permanence
                              • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of |cffFFC53ABall Lightning for HeroPickedUnit[10]) Equal to 5
                                • Then - Actions
                                  • Unit - Cause HeroPickedUnit[10] to damage (Picked unit), dealing 35.00 damage of attack type Hero and damage type Normal
                                  • Floating Text - Create floating text that reads (35 + <Empty String>) above (Picked unit) with Z offset (Random real number between 0.00 and 20.00), using font size 10.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
                                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                                  • Floating Text - Change (Last created floating text): Disable permanence
                                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                                • Else - Actions
                                  • Do nothing
            • Else - Actions
              • Do nothing
      • Custom script: call DestroyGroup(udg_ball_unit_group_first)
      • Wait 0.15 seconds
      • For each (Integer ball_lightning_FOR) from 1 to ball_lightning_effect_counter, do (Actions)
        • Loop - Actions
          • Lightning - Destroy ball_lightning_effects[ball_lightning_FOR]
 
Level 2
Joined
Apr 23, 2018
Messages
15
I can just run the map for 20 min and nothing happens then i cast this spell and it gets horrendous.

edit.: I have a older version of the worldeditor, maybe thats the reason? I will try to update it to a newer one and try it all again.
 
Last edited:
Status
Not open for further replies.
Top