I had a GUI spell made and, because of its complexity, wanted to try using the Hashtable for the first time with it as a challenge. Now I don't really know if I'm doing it properly and what's missing and what needs to be removed and the leaks, you just tell me. It is implied I already set the Hashtable variable. There are 3 triggers.
EDIT: I already took care of part of the trigger for better efficiency, however I'm still not sure if everything's alright. Hope you can help me:
I already took some suggestions from Dr Super Good and I hope I got them right. Now I know this spell may not bet completely efficient in coding, I would take any suggestion for better coding EXCEPT if you say "use JASS" since that's not my goal.
P.S. The dummies have negative regen so they automatically die.
EDIT: I already took care of part of the trigger for better efficiency, however I'm still not sure if everything's alright. Hope you can help me:
-
Meltdown
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Meltdown
-
Actions
- Set Meltdown_Caster = (Triggering unit)
- Set Meltdown_Angle = (Facing of Meltdown_Caster)
- Set Meltdown_Points[0] = (Position of (Triggering unit))
- Set Meltdown_Points[1] = (Meltdown_Points[0] offset by 150.00 towards Meltdown_Angle degrees)
- Trigger - Turn on Meltdown Timer <gen>
- -------- Hashes --------
- Hashtable - Save ((2.00 x (Real((Level of Meltdown for (Triggering unit))))) + (0.50 x (Real((Strength of (Triggering unit) (Include bonuses)))))) as (Key dmg) of (Key (Triggering unit)) in Meltdown_Hash
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Triggering unit) is in Meltdown_CasterPick) Equal to False
-
Then - Actions
- Unit Group - Add (Triggering unit) to Meltdown_CasterPick
- Else - Actions
-
If - Conditions
-
Events
-
Meltdown Timer
-
Events
- Time - Every 0.30 seconds of game time
- Conditions
-
Actions
- Unit - Create 1 Meltdown Dummy for (Owner of Meltdown_Caster) at Meltdown_Points[1] facing Meltdown_Angle degrees
- Unit - Add Meltdown Effect to (Last created unit)
- Unit - Order (Last created unit) to Neutral - Slam
- Custom script: call RemoveLocation (udg_Meltdown_Points[1])
- Set Meltdown_Timer = (Meltdown_Timer + 1)
- Set Meltdown_Points[1] = (Meltdown_Points[0] offset by (150.00 x (Real(Meltdown_Timer))) towards Meltdown_Angle degrees)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Meltdown_Timer Equal to 5
-
Then - Actions
- Set Meltdown_Timer = 0
-
Unit Group - Pick every unit in Meltdown_BuffPick and do (Actions)
-
Loop - Actions
- Unit - Create 1 Dummy for (Owner of Meltdown_Caster) at Meltdown_Points[1] facing 0.00 degrees
- Unit - Add Meltdown Armor Penalty to (Last created unit)
- Unit - Set level of Meltdown Armor Penalty for (Last created unit) to (Level of Meltdown for Meltdown_Caster)
- Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Picked unit)
- Unit - Remove Meltdown (Fake Buff) buff from (Picked unit)
- Unit Group - Add (Picked unit) to Meltdown_GroupDPS
- Hashtable - Save 10.00 as (Key dur) of (Key (Picked unit)) in Meltdown_Hash
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Meltdown DPS <gen> is on) Equal to False
-
Then - Actions
- Trigger - Turn on Meltdown DPS <gen>
- Else - Actions
-
If - Conditions
- Set Meltdown_Caster = No unit
- Custom script: call DestroyGroup (udg_Meltdown_Pick[1])
- Custom script: call RemoveLocation (udg_Meltdown_Points[0])
- Custom script: call RemoveLocation (udg_Meltdown_Points[1])
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Events
-
Meltdown DPS
-
Events
- Time - Every 1.00 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in Meltdown_CasterPick and do (Actions)
-
Loop - Actions
- Set Meltdown_Picked = (Picked unit)
- Set Meltdown_DMG = (Load (Key dmg) of (Key (Picked unit)) from Meltdown_Hash)
-
Unit Group - Pick every unit in Meltdown_GroupDPS and do (Actions)
-
Loop - Actions
- Set Meltdown_Dur = (Load (Key dur) of (Key (Picked unit)) from Meltdown_Hash)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Meltdown_Dur Greater than 0.00
-
Then - Actions
- Unit - Cause Meltdown_Picked to damage (Picked unit), dealing (Meltdown_DMG + (((Real((Level of Resist Fire for (Picked unit)))) x (Meltdown_DMG x -0.50)) + ((Real((Level of Weak to Fire for (Picked unit)))) x 0.50))) damage of attack type Chaos and damage type Fire
- Hashtable - Save (Meltdown_Dur - 1.00) as (Key dur) of (Key (Picked unit)) in Meltdown_Hash
-
Else - Actions
- Unit Group - Remove (Picked unit) from Meltdown_GroupDPS
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Meltdown_Hash
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in Meltdown_GroupDPS) Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
If - Conditions
-
Loop - Actions
- Set Meltdown_Picked = No unit
-
Loop - Actions
-
Unit Group - Pick every unit in Meltdown_CasterPick and do (Actions)
-
Events
P.S. The dummies have negative regen so they automatically die.
Last edited: