• 🏆 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] efficiency is the issue for a spell

Status
Not open for further replies.
Level 3
Joined
Aug 20, 2010
Messages
71
So i am making a spell for someone but making it creates some efficiency issues.
(you can see the spell Here, it is the first spell of all of em)
the thing is that i need to make a slow whose slow percentage stacks but duration stacks as if different slow buffs where applied
so if for example i apply a 4 sec 10% slow and on top of that a 2sec 20% slow, i want the final result to be a slow which last for 2 secs and for the first 2 secs, it slows by 30% and for the rest 2 for 10%.

  • Initialisation
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Display to (All players) the text: press "Esc" to refr...
      • Game - Set the time of day to 6.00
      • Player - Add 1000000000 to Player 1 (Red) Current gold
      • Visibility - Create an initially Enabled visibility modifier for Neutral Passive emitting Visibility across (Playable map area)
      • Hashtable - Create a hashtable
      • Set Out_Of_Air_Hashtable = (Last created hashtable)
      • Player - For Player 1 (Red), turn Shared vision On toward Neutral Passive
      • Player - For Player 2 (Blue), turn Shared vision On toward Neutral Passive
      • Player - For Player 3 (Teal), turn Shared vision On toward Neutral Passive
      • Player - For Player 4 (Purple), turn Shared vision On toward Neutral Passive
      • Player - For Player 5 (Yellow), turn Shared vision On toward Neutral Passive
      • Player - For Player 6 (Orange), turn Shared vision On toward Neutral Passive
      • Player - For Player 7 (Green), turn Shared vision On toward Neutral Passive
      • Player - For Player 8 (Pink), turn Shared vision On toward Neutral Passive
      • Player - For Player 9 (Gray), turn Shared vision On toward Neutral Passive
      • Player - For Player 10 (Light Blue), turn Shared vision On toward Neutral Passive
      • Player - For Player 11 (Dark Green), turn Shared vision On toward Neutral Passive
      • Player - For Player 12 (Brown), turn Shared vision On toward Neutral Passive
  • Out Of Air Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Out Of Air
    • Actions
      • Set Out_Of_Air_Caster = (Triggering unit)
      • Set Out_Of_Air_Point = (Target point of ability being cast)
      • Unit - Create 1 Out Of Air (Dummy) for (Owner of Out_Of_Air_Caster) at Out_Of_Air_Point facing Default building facing degrees
      • Set Out_Of_Air_Dummy = (Last created unit)
      • Hashtable - Save Handle OfOut_Of_Air_Caster as (Key Caster) of (Key (Last created unit)) in Out_Of_Air_Hashtable
      • Hashtable - Save Out_Of_Air_Integer as (Key Level) of (Key (Last created unit)) in Out_Of_Air_Hashtable
      • Set Out_Of_Air_Integer = (Level of Out Of Air for Out_Of_Air_Caster)
      • Unit Group - Add Out_Of_Air_Dummy to Out_Of_Air_Dummy_Group
      • Set Out_Of_Air_Caster = No unit
      • Set Out_Of_Air_Dummy = No unit
      • Set Out_Of_Air_Dummy_Group_Empty = False
      • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
      • Trigger - Turn on Out Of Air Duration <gen>
      • Trigger - Run Out Of Air Duration <gen> (checking conditions)
  • Out Of Air Duration
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Out_Of_Air_Dummy_Group is empty) Equal to False) or ((Out_Of_Air_Dummy_Group is empty) Equal to False)
        • Then - Actions
          • Unit Group - Pick every unit in Out_Of_Air_Dummy_Group and do (Actions)
            • Loop - Actions
              • Set Out_Of_Air_Caster = (Load (Key Caster) of (Key (Picked unit)) in Out_Of_Air_Hashtable)
              • Set Out_Of_Air_Dummy = (Picked unit)
              • Set Out_Of_Air_Temp_Handle = (Picked unit)
              • Set Out_Of_Air_Integer = (Load (Key Level) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
              • Set Out_Of_Air_Point = (Position of Out_Of_Air_Dummy)
              • Set Vesta_Temp_Group = (Units within 350.00 of Out_Of_Air_Point matching ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is hidden) Equal to False) and (
              • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
              • Set Out_Of_Air_Dummy_Time = (Load (Key Time) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
              • Game - Display to (All players) the text: (String(Out_Of_Air_Dummy_Time))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out_Of_Air_Dummy_Time Greater than 4.02
                • Then - Actions
                  • Unit - Remove Out_Of_Air_Dummy from the game
                  • Unit Group - Remove Out_Of_Air_Dummy from Out_Of_Air_Dummy_Group
                  • Hashtable - Clear all child hashtables of child (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                • Else - Actions
              • Unit Group - Pick every unit in Vesta_Temp_Group and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Out_Of_Air_Dummy_Time Equal to 1.02) or ((Out_Of_Air_Dummy_Time Equal to 2.01) or ((Out_Of_Air_Dummy_Time Equal to 3.00) or (Out_Of_Air_Dummy_Time Equal to 4.02)))
                    • Then - Actions
                      • Unit - Cause Out_Of_Air_Caster to damage (Picked unit), dealing (15.00 + (15.00 x (Real(Out_Of_Air_Integer)))) damage of attack type Spells and damage type Magic
                    • Else - Actions
                  • Set Out_Of_Air_Real_Target_Time = (Load (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                  • Set Out_Of_Air_Clear = (Load (Key Clear) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                  • Set Out_Of_Air_Counter = (Load (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Out_Of_Air_Counter Equal to 0
                    • Then - Actions
                      • Hashtable - Save -1 as (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has buff Out Of Air (Buff)) Equal to False
                    • Then - Actions
                      • Set Out_Of_Air_Point = (Position of (Picked unit))
                      • Unit - Create 1 Chicken for Neutral Passive at Out_Of_Air_Point facing Out_Of_Air_Point
                      • Set Out_Of_Air_Dummy = (Last created unit)
                      • Unit - Add a 0.30 second Generic expiration timer to Out_Of_Air_Dummy
                      • Unit - Add Out Of Air (Buff) to Out_Of_Air_Dummy
                      • Unit - Order Out_Of_Air_Dummy to Undead Necromancer - Cripple (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Out Of Air (Self Slow Aura) for (Picked unit)) Greater than 0
                        • Then - Actions
                          • Set Out_Of_Air_Clear = True
                          • Hashtable - Save Out_Of_Air_Clear as (Key Clear) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                        • Else - Actions
                          • Unit - Add Out Of Air (Self Slow Aura) to (Picked unit)
                      • Unit - Set level of Out Of Air (Self Slow Aura) for (Picked unit) to Out_Of_Air_Integer
                      • Set Out_Of_Air_Real_Target_Time = -1.00
                      • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in Out_Of_Air_Target_Group) Equal to False
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to Out_Of_Air_Target_Group
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Out_Of_Air_Real_Target_Time Less than 0.00
                    • Then - Actions
                      • Set Out_Of_Air_Real_Target_Time = -0.03
                      • Hashtable - Save Out_Of_Air_Real_Target_Time as (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                    • Else - Actions
              • Set Out_Of_Air_Dummy_Time = (Out_Of_Air_Dummy_Time + 0.03)
              • Hashtable - Save Out_Of_Air_Dummy_Time as (Key Time) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
              • Custom script: call DestroyGroup (udg_Vesta_Temp_Group)
              • -------- ----------------------------------------------------------------Part 2-------------------------------------------------------------------------------------------------------------------------------- --------
              • Unit Group - Pick every unit in Out_Of_Air_Target_Group and do (Actions)
                • Loop - Actions
                  • Set Out_Of_Air_Target = (Picked unit)
                  • Set Out_Of_Air_Target_Point = (Position of Out_Of_Air_Target)
                  • Set Out_Of_Air_Temp_Handle = (Picked unit)
                  • Set Out_Of_Air_Clear = (Load (Key Clear) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                  • Set Out_Of_Air_Max_Real = 0.00
                  • Set Out_Of_Air_Integer_of_Max_Real = 0
                  • Set Out_Of_Air_Max_Integer = 0
                  • Set Out_Of_Air_Real_Of_Max_Integer = 0.00
                  • Set Out_Of_Air_Temp_Integer = 0
                  • Set Out_Of_Air_Decrease_Check = False
                  • Set Out_Of_Air_Target_Previous_Loc = (Load (Key Point) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable)
                  • Hashtable - Save Handle OfOut_Of_Air_Target_Point as (Key Point) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Set Out_Of_Air_Temp_Boolean = False
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Out_Of_Air_Dummy_Group is empty) Equal to False
                    • Then - Actions
                      • Unit Group - Pick every unit in Out_Of_Air_Dummy_Group and do (Actions)
                        • Loop - Actions
                          • Set Out_Of_Air_Counter = (Load (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Out_Of_Air_Counter Not equal to 0
                            • Then - Actions
                              • Set Out_Of_Air_Dummy = (Picked unit)
                              • Set Out_Of_Air_Point = (Position of Out_Of_Air_Dummy)
                              • Set Out_Of_Air_Real_Target_Time = (Load (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                              • Set Out_Of_Air_Caster = (Load (Key Caster) of (Key (Picked unit)) in Out_Of_Air_Hashtable)
                              • Set Out_Of_Air_Integer = (Load (Key Level) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                              • Set Out_Of_Air_Temp_Real = (Distance between Out_Of_Air_Point and Out_Of_Air_Target_Previous_Loc)
                              • Set Out_Of_Air_Dummy_Time = (Load (Key Time) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Out_Of_Air_Clear Equal to True
                                • Then - Actions
                                  • Set Out_Of_Air_Real_Target_Time = 0.00
                                • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Distance between Out_Of_Air_Point and Out_Of_Air_Target_Point) Less than or equal to 350.00
                                • Then - Actions
                                  • Set Out_Of_Air_Counter = (Out_Of_Air_Counter + 3)
                                  • Set Out_Of_Air_Real_Target_Time = (Out_Of_Air_Real_Target_Time + 0.03)
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Out_Of_Air_Temp_Real Greater than 350.00
                                    • Then - Actions
                                      • Set Out_Of_Air_Decrease_Check = True
                                    • Else - Actions
                                • Else - Actions
                                  • Set Out_Of_Air_Counter = 0
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Out_Of_Air_Temp_Real Less than or equal to 350.00
                                    • Then - Actions
                                      • Set Out_Of_Air_Decrease_Check = True
                                      • Set Out_Of_Air_Real_Target_Time = (Real((Max(((Integer(Out_Of_Air_Real_Target_Time)) + 1), 4))))
                                    • Else - Actions
                                      • Set Out_Of_Air_Real_Target_Time = (Out_Of_Air_Real_Target_Time - 0.03)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Out_Of_Air_Dummy_Time Equal to 3.51) and (Out_Of_Air_Counter Greater than or equal to 200)
                                • Then - Actions
                                  • Set Out_Of_Air_Point = (Position of (Picked unit))
                                  • Unit - Create 1 Chicken for Neutral Passive at Out_Of_Air_Point facing Out_Of_Air_Point
                                  • Set Out_Of_Air_Dummy = (Last created unit)
                                  • Unit - Add a 0.30 second Generic expiration timer to Out_Of_Air_Dummy
                                  • Unit - Add Out Of Air (Stun) to Out_Of_Air_Dummy
                                  • Unit - Set level of Out Of Air (Stun) for Out_Of_Air_Dummy to Out_Of_Air_Integer
                                  • Unit - Order Out_Of_Air_Dummy to Human Mountain King - Storm Bolt Out_Of_Air_Target
                                  • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                                • Else - Actions
                              • Hashtable - Save Out_Of_Air_Real_Target_Time as (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • Hashtable - Save Out_Of_Air_Counter as (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (((Out_Of_Air_Target has buff Out Of Air (Buff)) Equal to False) and (Out_Of_Air_Real_Target_Time Greater than or equal to 0.07)) or ((Out_Of_Air_Target is dead) Equal to True)
                                • Then - Actions
                                  • Set Out_Of_Air_Temp_Boolean = True
                                • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Out_Of_Air_Real_Target_Time Greater than Out_Of_Air_Max_Real
                                • Then - Actions
                                  • Set Out_Of_Air_Max_Real = Out_Of_Air_Real_Target_Time
                                  • Set Out_Of_Air_Integer_of_Max_Real = Out_Of_Air_Integer
                                • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Out_Of_Air_Integer Greater than Out_Of_Air_Max_Integer
                                • Then - Actions
                                  • Set Out_Of_Air_Temp_Integer = Out_Of_Air_Max_Integer
                                  • Set Out_Of_Air_Real_Of_Max_Integer = Out_Of_Air_Real_Target_Time
                                  • Set Out_Of_Air_Max_Integer = Out_Of_Air_Integer
                                • Else - Actions
                              • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                            • Else - Actions
                    • Else - Actions
                      • Set Out_Of_Air_Max_Real = (Load (Key Max_Real) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                      • Set Out_Of_Air_Integer_of_Max_Real = (Load (Key Integer_Of_Max_Real) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                      • Set Out_Of_Air_Max_Integer = (Load (Key Max_Integer) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                      • Set Out_Of_Air_Real_Of_Max_Integer = (Load (Key Real_Of_Max_Integer) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Out_Of_Air_Dummy_Group_Empty Equal to False
                        • Then - Actions
                          • Set Out_Of_Air_Max_Real = (Real((Max(((Integer(Out_Of_Air_Max_Real)) + 1), 4))))
                          • Set Out_Of_Air_Real_Of_Max_Integer = (Real((Max(((Integer(Out_Of_Air_Real_Of_Max_Integer)) + 1), 4))))
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Out_Of_Air_Real_Of_Max_Integer Greater than 0.00
                        • Then - Actions
                          • Set Out_Of_Air_Temp_Integer = Out_Of_Air_Max_Integer
                        • Else - Actions
                          • Set Out_Of_Air_Temp_Integer = Out_Of_Air_Integer_of_Max_Real
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (((Out_Of_Air_Target has buff Out Of Air (Buff)) Equal to False) and (Out_Of_Air_Real_Target_Time Greater than or equal to 0.07)) or ((Out_Of_Air_Target is dead) Equal to True)
                        • Then - Actions
                          • Set Out_Of_Air_Temp_Boolean = True
                        • Else - Actions
                  • Set Out_Of_Air_Clear = False
                  • Hashtable - Save Out_Of_Air_Clear as (Key Clear) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                  • Hashtable - Save Out_Of_Air_Max_Real as (Key Max_Real) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Hashtable - Save Out_Of_Air_Integer_of_Max_Real as (Key Integer_Of_Max_Real) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Hashtable - Save Out_Of_Air_Max_Integer as (Key Max_Integer) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Hashtable - Save Out_Of_Air_Real_Of_Max_Integer as (Key Real_Of_Max_Integer) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Custom script: call RemoveLocation (udg_Out_Of_Air_Target_Point)
                  • Custom script: call RemoveLocation (udg_Out_Of_Air_Target_Previous_Loc)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Out_Of_Air_Temp_Boolean Equal to True) or (((Out_Of_Air_Target is Magic Immune) Equal to True) or (Out_Of_Air_Max_Real Less than or equal to 0.00))
                    • Then - Actions
                      • Unit - Remove Out Of Air (Buff) buff from Out_Of_Air_Target
                      • Unit - Remove Out Of Air (Self Slow Aura) from Out_Of_Air_Target
                      • Unit - Remove Out Of Air (Slow Aura) buff from Out_Of_Air_Target
                      • Unit Group - Remove Out_Of_Air_Target from Out_Of_Air_Target_Group
                      • Hashtable - Clear all child hashtables of child (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Out_Of_Air_Decrease_Check Equal to True) or (((Out_Of_Air_Max_Real Less than or equal to 1.02) and (Out_Of_Air_Max_Real Greater than or equal to 0.98)) or (((Out_Of_Air_Max_Real Less than or equal to 2.02) and (Out_Of_Air_Max_Real Greater than or equal to 1.98)) or (((Out_Of_Air_Max_Real Less than or e
                        • Then - Actions
                          • Set Out_Of_Air_Point = (Position of (Picked unit))
                          • Unit - Create 1 Chicken for Neutral Passive at Out_Of_Air_Point facing Out_Of_Air_Point
                          • Set Out_Of_Air_Dummy = (Last created unit)
                          • Unit - Add a 0.30 second Generic expiration timer to Out_Of_Air_Dummy
                          • Unit - Add Out Of Air (Buff) to Out_Of_Air_Dummy
                          • Unit - Set level of Out Of Air (Buff) for Out_Of_Air_Dummy to (Max((Integer((Out_Of_Air_Max_Real + 1.00))), 4))
                          • Unit - Order Out_Of_Air_Dummy to Undead Necromancer - Cripple (Picked unit)
                          • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Out_Of_Air_Temp_Integer x (Max(((Integer(Out_Of_Air_Max_Real)) + 1), 4))) Not equal to (Level of Out Of Air (Self Slow Aura) for Out_Of_Air_Target)
                            • Then - Actions
                              • Unit - Set level of Out Of Air (Self Slow Aura) for Out_Of_Air_Target to (Out_Of_Air_Temp_Integer x (Max(((Integer(Out_Of_Air_Max_Real)) + 1), 4)))
                            • Else - Actions
                        • Else - Actions
              • Set Out_Of_Air_Dummy_Group_Empty = (Out_Of_Air_Dummy_Group is empty)
        • Else - Actions
          • Custom script: call DestroyGroup (udg_Out_Of_Air_Target_Group)
the biggest issue here is the lag that is being caused (+ some crashes here and there) as the engine cannot handle this many units at once.
some bonus problems which can be solved later are: damage being at wrong values or the spell not working at some casts here and there. also no casts of the spell "Out Of Air (Buff)" are being made after the death of the end of the life of the units in the "Out_Of_Air_Dummy_Group".

as a final note the "Out Of Air (Buff)" spell is a spell based on cripple that slows for 0% at all levels and is there so that ill be able to detect if the target is being slowed.
also the Out Of Air (Self Slow Aura) is an ability based on the aura the tornadoes carry that slows the one having it. it has 16 levels and each group of fours represent the a number of slow stacks at each level. so if i want the target to have 3 level 4 slow stacks ill just raise the level of this skill to 12(=3*4) and get the slow i want. sooo can you please tell me how to make it so that for the fps to drop, you will need at least 8 or so of these to be cast (if it is not possible please raise the number to as high as possible) without altering the effects it will have to a noticeable amount at the most scenarios (at scenarios with low number of these placed)
 

Attachments

  • Hero Vesta 0.1.w3x
    144.8 KB · Views: 59
Level 3
Joined
Aug 20, 2010
Messages
71
when you say a single dummy on which dummies are you referring to? on the ones in the dummy group or on the ones i create later on ? and if you are referring on the second ones, then how will i be able to order the dummy to cast up to 3 spells on a unit ?
if it is the former ones you are referring to then how do you suggest i write the hashtables i have which are bidden in both the target units and the dummy units.
for instance i am doing this: Set Out_Of_Air_Real_Target_Time = (Load (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
how should i write it instead following the former suggestion of yours ?
 
when you say a single dummy on which dummies are you referring to? on the ones in the dummy group or on the ones i create later on ? and if you are referring on the second ones, then how will i be able to order the dummy to cast up to 3 spells on a unit ?
A dummy can simultaneously cast spells on a group. However; only if Movement Speed is 0, and Cast Backswing/Point is 0 as well.
 
Level 3
Joined
Aug 20, 2010
Messages
71
so in other words i can create 1 dummy give it the spells needed and then do i like order that dummy to cast the spells needed on every unit with the command "issue order targeting a unit" ?
what is the maximum of orders it can execute in that duration of 0.03 secs?
i have set the base ms of the dummy to 0 but the minimum ms in the gameplay constants is set to 100, does it affect the ms of the unit or do i have to lower the constant to 0?
 
Level 3
Joined
Aug 20, 2010
Messages
71
so i have altered everything into this and it has reduced the fps drop by quite a lot but there still some problems in there. first of it picks dead units and i have no idea why it does that as i have set a condition to ignore em (i have even done this twice in fact :S)
secondly there seem to be quite some memory leaks as after 3-4 casts on many units every next cast starts to make the spell cause lags into the game for the duration of the spell.
also for some reason the value of the: Out_Of_Air_Max_Real keeps on increasing when stacking multiple instances of the spell (try testing it on the little spider on the left)


  • Out Of Air Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Out Of Air
    • Actions
      • Set Out_Of_Air_Caster = (Triggering unit)
      • Set Out_Of_Air_Point = (Target point of ability being cast)
      • Unit - Create 1 Out Of Air (Dummy) for (Owner of Out_Of_Air_Caster) at Out_Of_Air_Point facing Default building facing degrees
      • Set Out_Of_Air_Dummy = (Last created unit)
      • Animation - Play Out_Of_Air_Dummy's birth animation
      • Hashtable - Save Handle OfOut_Of_Air_Caster as (Key Caster) of (Key (Last created unit)) in Out_Of_Air_Hashtable
      • Set Out_Of_Air_Integer = (Level of Out Of Air for Out_Of_Air_Caster)
      • Hashtable - Save Out_Of_Air_Integer as (Key Level) of (Key (Last created unit)) in Out_Of_Air_Hashtable
      • Unit Group - Add Out_Of_Air_Dummy to Out_Of_Air_Dummy_Group
      • Hashtable - Save 0.00 as (Key Time) of (Key (Last created unit)) in Out_Of_Air_Hashtable
      • Set Out_Of_Air_Caster = No unit
      • Set Out_Of_Air_Dummy = No unit
      • Set Out_Of_Air_Dummy_Group_Empty = False
      • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
      • Trigger - Turn on Out Of Air Duration <gen>
      • Trigger - Run Out Of Air Duration <gen> (checking conditions)
  • Out Of Air Duration
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Out_Of_Air_Dummy_Group is empty) Equal to False) or ((Out_Of_Air_Target_Group is empty) Equal to False)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Out_Of_Air_Dummy_Group_Empty Equal to True
            • Then - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Out_Of_Air_Dummy_Casting_Unit is dead) Equal to True
            • Then - Actions
              • Set Out_Of_Air_Point = (Center of (Playable map area))
              • Unit - Create 1 Chicken for Neutral Passive at Out_Of_Air_Point facing Out_Of_Air_Point
              • Set Out_Of_Air_Dummy_Casting_Unit = (Last created unit)
              • Unit - Add a 2.00 second Generic expiration timer to Out_Of_Air_Dummy_Casting_Unit
              • Unit - Add Out Of Air (Buff) to Out_Of_Air_Dummy_Casting_Unit
              • Unit - Add Out Of Air (Stun) to Out_Of_Air_Dummy_Casting_Unit
              • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
            • Else - Actions
          • Unit Group - Pick every unit in Out_Of_Air_Dummy_Group and do (Actions)
            • Loop - Actions
              • Set Out_Of_Air_Caster = (Load (Key Caster) of (Key (Picked unit)) in Out_Of_Air_Hashtable)
              • Set Out_Of_Air_Dummy = (Picked unit)
              • Set Out_Of_Air_Temp_Handle = (Picked unit)
              • Set Out_Of_Air_Integer = (Load (Key Level) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
              • Set Out_Of_Air_Point = (Position of Out_Of_Air_Dummy)
              • Set Vesta_Temp_Group = (Units within 350.00 of Out_Of_Air_Point matching ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is hidden) Equal to False) and (
              • Set Out_Of_Air_Dummy_Time = (Load (Key Time) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out_Of_Air_Dummy_Time Equal to 3.00
                • Then - Actions
                  • Destructible - Pick every destructible within 350.00 of Out_Of_Air_Point and do (Destructible - Kill (Picked destructible))
                • Else - Actions
              • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
              • Game - Display to (All players) the text: (String(Out_Of_Air_Dummy_Time))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out_Of_Air_Dummy_Time Greater than 4.02
                • Then - Actions
                  • Animation - Change Out_Of_Air_Dummy's vertex coloring to (0.00%, 0.00%, 0.00%) with 100.00% transparency
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out_Of_Air_Dummy_Time Greater than 8.01
                • Then - Actions
                  • Unit - Add a 0.01 second Generic expiration timer to Out_Of_Air_Dummy
                  • Hashtable - Clear all child hashtables of child (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Unit Group - Remove Out_Of_Air_Dummy from Out_Of_Air_Dummy_Group
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out_Of_Air_Dummy_Time Less than or equal to 4.02
                • Then - Actions
                  • Unit Group - Pick every unit in Vesta_Temp_Group and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Out_Of_Air_Dummy_Time Equal to 1.02) or ((Out_Of_Air_Dummy_Time Equal to 2.01) or ((Out_Of_Air_Dummy_Time Equal to 3.00) or (Out_Of_Air_Dummy_Time Equal to 4.02)))
                        • Then - Actions
                          • Unit - Cause Out_Of_Air_Caster to damage (Picked unit), dealing (15.00 + (15.00 x (Real(Out_Of_Air_Integer)))) damage of attack type Normal and damage type Magic
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) is alive) Equal to True
                        • Then - Actions
                          • Set Out_Of_Air_Real_Target_Time = (Load (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                          • Set Out_Of_Air_Clear = (Load (Key Clear) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                          • Set Out_Of_Air_Counter = (Load (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) from Out_Of_Air_Hashtable)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Out_Of_Air_Counter Equal to 0
                            • Then - Actions
                              • Hashtable - Save -1 as (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) is in Out_Of_Air_Target_Group) Equal to False
                            • Then - Actions
                              • Unit Group - Add (Picked unit) to Out_Of_Air_Target_Group
                              • Hashtable - Save 0.00 as (Key Max_Real) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • Hashtable - Save 0 as (Key Integer_Of_Max_Real) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • Hashtable - Save 0 as (Key Max_Integer) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • Hashtable - Save 0.00 as (Key Real_Of_Max_Integer) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) has buff Out Of Air (Buff)) Equal to False
                            • Then - Actions
                              • Unit - Set level of Out Of Air (Buff) for Out_Of_Air_Dummy_Casting_Unit to 1
                              • Unit - Order Out_Of_Air_Dummy_Casting_Unit to Undead Necromancer - Cripple (Picked unit)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of Out Of Air (Self Slow Aura) for (Picked unit)) Greater than 0
                                • Then - Actions
                                  • Set Out_Of_Air_Clear = True
                                  • Hashtable - Save Out_Of_Air_Clear as (Key Clear) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                                • Else - Actions
                                  • Unit - Add Out Of Air (Self Slow Aura) to (Picked unit)
                              • Unit - Set level of Out Of Air (Self Slow Aura) for (Picked unit) to Out_Of_Air_Integer
                              • Set Out_Of_Air_Real_Target_Time = -1.00
                              • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Out_Of_Air_Real_Target_Time Less than 0.00
                            • Then - Actions
                              • Set Out_Of_Air_Real_Target_Time = 0.00
                              • Hashtable - Save Out_Of_Air_Real_Target_Time as (Key (Picked unit)) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                            • Else - Actions
                        • Else - Actions
                      • Unit Group - Remove (Picked unit) from Vesta_Temp_Group
                • Else - Actions
              • Set Out_Of_Air_Dummy_Time = (Out_Of_Air_Dummy_Time + 0.03)
              • Hashtable - Save Out_Of_Air_Dummy_Time as (Key Time) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
              • Custom script: call DestroyGroup (udg_Vesta_Temp_Group)
              • -------- ----------------------------------------------------------------Part 2-------------------------------------------------------------------------------------------------------------------------------- --------
              • Unit Group - Pick every unit in Out_Of_Air_Target_Group and do (Actions)
                • Loop - Actions
                  • Set Out_Of_Air_Target = (Picked unit)
                  • Set Out_Of_Air_Target_Point = (Position of Out_Of_Air_Target)
                  • Set Out_Of_Air_Temp_Handle = (Picked unit)
                  • Set Out_Of_Air_Clear = (Load (Key Clear) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                  • Set Out_Of_Air_Max_Real = 0.00
                  • Set Out_Of_Air_Integer_of_Max_Real = 0
                  • Set Out_Of_Air_Max_Integer = 0
                  • Set Out_Of_Air_Real_Of_Max_Integer = 0.00
                  • Set Out_Of_Air_Temp_Integer = 0
                  • Set Out_Of_Air_Decrease_Check = False
                  • Set Out_Of_Air_Target_Previous_Loc = (Load (Key Point) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable)
                  • Hashtable - Save Handle OfOut_Of_Air_Target_Point as (Key Point) of (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                  • Set Out_Of_Air_Temp_Boolean = False
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Out_Of_Air_Dummy_Group is empty) Equal to False
                    • Then - Actions
                      • Unit Group - Pick every unit in Out_Of_Air_Dummy_Group and do (Actions)
                        • Loop - Actions
                          • Set Out_Of_Air_Counter = (Load (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Out_Of_Air_Counter Not equal to 0
                            • Then - Actions
                              • Set Out_Of_Air_Dummy = (Picked unit)
                              • Set Out_Of_Air_Point = (Position of Out_Of_Air_Dummy)
                              • Set Out_Of_Air_Real_Target_Time = (Load (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                              • Set Out_Of_Air_Caster = (Load (Key Caster) of (Key (Picked unit)) in Out_Of_Air_Hashtable)
                              • Set Out_Of_Air_Integer = (Load (Key Level) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                              • Set Out_Of_Air_Temp_Real = (Distance between Out_Of_Air_Point and Out_Of_Air_Target_Previous_Loc)
                              • Set Out_Of_Air_Dummy_Time = (Load (Key Time) of (Key (Picked unit)) from Out_Of_Air_Hashtable)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Out_Of_Air_Clear Equal to True
                                • Then - Actions
                                  • Set Out_Of_Air_Real_Target_Time = 0.00
                                • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • And - All (Conditions) are true
                                    • Conditions
                                      • (Distance between Out_Of_Air_Point and Out_Of_Air_Target_Point) Less than or equal to 350.00
                                      • Out_Of_Air_Dummy_Time Less than 4.02
                                • Then - Actions
                                  • Set Out_Of_Air_Counter = (Out_Of_Air_Counter + 3)
                                  • Set Out_Of_Air_Real_Target_Time = (Out_Of_Air_Real_Target_Time + 0.03)
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Out_Of_Air_Temp_Real Greater than 350.00
                                    • Then - Actions
                                      • Set Out_Of_Air_Decrease_Check = True
                                    • Else - Actions
                                • Else - Actions
                                  • Set Out_Of_Air_Counter = -1
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Or - Any (Conditions) are true
                                        • Conditions
                                          • Out_Of_Air_Dummy_Time Equal to 4.02
                                          • And - All (Conditions) are true
                                            • Conditions
                                              • Out_Of_Air_Temp_Real Less than or equal to 350.00
                                              • Out_Of_Air_Dummy_Time Less than 4.02
                                    • Then - Actions
                                      • Set Out_Of_Air_Decrease_Check = True
                                      • Set Out_Of_Air_Real_Target_Time = (Real((Min((Integer((Out_Of_Air_Real_Target_Time + 1.00))), 4))))
                                    • Else - Actions
                                      • Set Out_Of_Air_Real_Target_Time = (Out_Of_Air_Real_Target_Time - 0.03)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Out_Of_Air_Dummy_Time Equal to 3.51) and (Out_Of_Air_Counter Greater than or equal to 200)
                                • Then - Actions
                                  • Unit - Set level of Out Of Air (Stun) for Out_Of_Air_Dummy_Casting_Unit to Out_Of_Air_Integer
                                  • Unit - Order Out_Of_Air_Dummy_Casting_Unit to Human Mountain King - Storm Bolt Out_Of_Air_Target
                                  • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                                • Else - Actions
                              • Hashtable - Save Out_Of_Air_Real_Target_Time as (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • Hashtable - Save Out_Of_Air_Counter as (Key Out_Of_Air_Temp_Handle) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (((Out_Of_Air_Target has buff Out Of Air (Buff)) Equal to False) and (Out_Of_Air_Real_Target_Time Greater than or equal to 0.07)) or ((Out_Of_Air_Target is dead) Equal to True)
                                • Then - Actions
                                  • Set Out_Of_Air_Temp_Boolean = True
                                • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Out_Of_Air_Real_Target_Time Greater than Out_Of_Air_Max_Real
                                • Then - Actions
                                  • Set Out_Of_Air_Max_Real = Out_Of_Air_Real_Target_Time
                                  • Set Out_Of_Air_Integer_of_Max_Real = Out_Of_Air_Integer
                                • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Out_Of_Air_Integer Greater than Out_Of_Air_Max_Integer
                                • Then - Actions
                                  • Set Out_Of_Air_Real_Of_Max_Integer = Out_Of_Air_Real_Target_Time
                                  • Set Out_Of_Air_Max_Integer = Out_Of_Air_Integer
                                  • Set Out_Of_Air_Temp_Integer = Out_Of_Air_Max_Integer
                                • Else - Actions
                              • Custom script: call RemoveLocation (udg_Out_Of_Air_Point)
                            • Else - Actions
                    • Else - Actions
                  • Set Out_Of_Air_Clear = False
                  • Hashtable - Save Out_Of_Air_Clear as (Key Clear) of (Key (Picked unit)) in Out_Of_Air_Hashtable
                  • Custom script: call RemoveLocation (udg_Out_Of_Air_Target_Point)
                  • Custom script: call RemoveLocation (udg_Out_Of_Air_Target_Previous_Loc)
                  • Game - Display to (All players) the text: ((String(Out_Of_Air_Max_Real)) + ( Max + (String((Integer(Out_Of_Air_Max_Real))))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Out_Of_Air_Temp_Boolean Equal to True) or (((Out_Of_Air_Target is Magic Immune) Equal to True) or (Out_Of_Air_Max_Real Less than or equal to 0.00))
                    • Then - Actions
                      • Floating Text - Create floating text that reads dat at (Position of Out_Of_Air_Target) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                      • Unit - Remove Out Of Air (Buff) buff from Out_Of_Air_Target
                      • Unit - Remove Out Of Air (Self Slow Aura) from Out_Of_Air_Target
                      • Unit - Remove Out Of Air (Slow Aura) buff from Out_Of_Air_Target
                      • Unit Group - Remove Out_Of_Air_Target from Out_Of_Air_Target_Group
                      • Hashtable - Clear all child hashtables of child (Key Out_Of_Air_Temp_Handle) in Out_Of_Air_Hashtable
                    • Else - Actions
                      • Game - Display to (All players) the text: ((String((Out_Of_Air_Temp_Integer + ((Min((Integer(Out_Of_Air_Max_Real)), 3)) x 4)))) + ( + (String(Out_Of_Air_Integer))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Out_Of_Air_Decrease_Check Equal to True) or (((Out_Of_Air_Max_Real Less than or equal to 1.02) and (Out_Of_Air_Max_Real Greater than or equal to 0.98)) or (((Out_Of_Air_Max_Real Less than or equal to 2.02) and (Out_Of_Air_Max_Real Greater than or equal to 1.98)) or (((Out_Of_Air_Max_Real Less than or e
                        • Then - Actions
                          • Unit - Set level of Out Of Air (Buff) for Out_Of_Air_Dummy_Casting_Unit to (Max((Integer((Out_Of_Air_Max_Real + 1.00))), 4))
                          • Unit - Order Out_Of_Air_Dummy_Casting_Unit to Undead Necromancer - Cripple (Picked unit)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Out_Of_Air_Temp_Integer + ((Min((Integer(Out_Of_Air_Max_Real)), 3)) x 4)) Not equal to (Level of Out Of Air (Self Slow Aura) for Out_Of_Air_Target)
                            • Then - Actions
                              • Unit - Set level of Out Of Air (Self Slow Aura) for Out_Of_Air_Target to (Out_Of_Air_Temp_Integer + ((Min((Integer(Out_Of_Air_Max_Real)), 3)) x 4))
                            • Else - Actions
                        • Else - Actions
              • Set Out_Of_Air_Dummy_Group_Empty = (Out_Of_Air_Dummy_Group is empty)
        • Else - Actions
          • Trigger - Turn off (This trigger)
 

Attachments

  • Hero Vesta 0.2.w3x
    146.2 KB · Views: 34

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
first of it picks dead units and i have no idea why it does that as i have set a condition to ignore em (i have even done this twice in fact :S)
Because they have more than 0.405 health due to being healed by other sources. Only the AI native truly can tell if a unit is dead but that requires importing new native declarations. The two most common ways for units to be dead yet have more than 0.405 health are tranquillity (Keeper of the Grove ultimate, it ignores death and so heals dead units) and triggers (yes you can set the life of dead units to non-zero values and it will persist).

You are also leaking strings in the form of debug messages.

Does saving 0 to a hashtable actually clear the mapping? By this I mean you could just be setting the mapping to store value 0 instead of removing it from the table completely (hashtables store a collection of key to value mappings so it is in theory perfectly valid to store 0 at some key even though no mapping produces the same results) There are specific key pair destruction natives to do this for a reason I would imagine.
 
Level 3
Joined
Aug 20, 2010
Messages
71
i am not healing the dead units through triggers nor is there a unit with keeper of the grove ultimate in the map.

well i am using the strings to find out what the hell is going on :S

Does saving 0 to a hashtable actually clear the mapping? By this I mean you could just be setting the mapping to store value 0 instead of removing it from the table completely (hashtables store a collection of key to value mappings so it is in theory perfectly valid to store 0 at some key even though no mapping produces the same results) There are specific key pair destruction natives to do this for a reason I would imagine.

what do you mean by that ? ^
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
what do you mean by that ? ^
Unlike arrays where each index has a dedicated space in memory, hashtable keys do not as the number of underlying spaces in memory is several orders of magnitude less than the number of different key possibilities. Instead keys are mapped to these memory spaces using a hashing algorithm (hence the name, hashtable).

However this produces a problem since multiple keys will map to the same storage locations. This is dealt with using a collision handling algorithm. The most common one is to fall back to some kind of linear search (bad for performance). To distinguish which is the correct value for the key it has to store the full key along with the value so that it can perform the linear search for the key. Hence each mapping in a hashtable is often called a key value pair.

What this means is that technically a key value pair can exist with any value, even if the value is the default one returned if no key value pair exists for the requested key. As such setting the value back to default may or may not delete the key value pair. For this reason there exists specific procedures to make sure that a key value pair gets removed from a hashtable.

Hashtable performance is tied to the number of key value pairs contained in the hashtable based on the collision handling algorithm. As such leaking key value pairs into a hashtable will degrade its performance. Again, this is a major reason why there exists ways to forcefully remove a key value pair from the hashtables.

JASS hashtable objects take a pair of keys as well as a value. These keys are stored in some kind of hierarchy based on parent and child keys. A single parent key is all that it takes to remove all children under that parent. There still exists the functionality to remove specific key value pairs from the hashtable using the appropriate native. This native takes both the parent and child key and frees up the key value mapping.

The natives are defined below.
JASS:
// This will remove all key value pairs from the hashtable. It will return to as good as new condition.
native FlushParentHashtable takes hashtable table returns nothing
// This will remove all key value pairs under a certain parent key. Useful if you use the parent key as some kind of super identifier with children as indices (like parent as a unit and children for indices of data)
native FlushChildHashtable takes hashtable table,integer parentKey returns nothing
// These will remove a specific key value pair from the hashtable. Use the appropriate one for the type of value that was stored as otherwise these can be unstable.
native RemoveSavedBoolean takes hashtable table,integer parentKey,integer childKey returns nothing
native RemoveSavedHandle takes hashtable table,integer parentKey,integer childKey returns nothing
native RemoveSavedInteger takes hashtable table,integer parentKey,integer childKey returns nothing
native RemoveSavedReal takes hashtable table,integer parentKey,integer childKey returns nothing
native RemoveSavedString takes hashtable table,integer parentKey,integer childKey returns nothing

Using these is the correct way to free key value pair mappings from a hashtable. Especially if you use a lot of different keys with very short life cycles it is required to make sure that the hashtable keeps efficient performance.

In real life programming you can cope with larger amounts of key value pairs simply by raising the bucket array size that backs the hashtable implementation. The larger the bucket array size, the fewer collisions as long as a good hashing algorithm is used. WC3's JASS does not allow you to do this, it appears the hashtable implementation uses fixed bucket array sizes so will have very bad performance degradation once it contains a certain number of key value pairs.
 
Level 3
Joined
Aug 20, 2010
Messages
71
can you give me specific examples on my triggers on how to use em to clear my leaks? just a few so that i can get how to write em in GUI
 
Status
Not open for further replies.
Top