Hi everyone. So yeah, I'm trying to learn how to use hashtables and I was wondering if you could please look at my triggers and tell me if I'm actually succeeding in transforming them from arrays to a hashtabe. Thank you in advance.
-
Cast Array
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Life Transfer (ivo)
-
Actions
- Set LT_Index = (LT_Index + 1)
- Set LT_Caster[LT_Index] = (Triggering unit)
- Set LT_Target[LT_Index] = (Target unit of ability being cast)
- Set LT_Counter[LT_Index] = 0.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- LT_Index Equal to 1
-
Then - Actions
- Trigger - Turn on Loop Array <gen>
- Else - Actions
-
If - Conditions
-
Events
-
Cast Hastable
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Life Transfer (ivo)
-
Actions
- Hashtable - Save Handle Of(Target unit of ability being cast) as (Integer(target)) of (Key (Triggering unit)) in LT_Hashtable
- Hashtable - Save 0.00 as (Integer(counter)) of (Key (Triggering unit)) in LT_Hashtable
- Unit Group - Add (Triggering unit) to LT_Hashtable_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Loop Hashtable <gen> is on) Equal to False
-
Then - Actions
- Trigger - Turn on Loop Hashtable <gen>
-
Else - Actions
- Do nothing
-
If - Conditions
-
Events
-
Loop Array
-
Events
- Time - Every 0.50 seconds of game time
- Conditions
-
Actions
-
For each (Integer LT_Loop) from 1 to LT_Index, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- LT_Counter[LT_Loop] Less than 1.50
- (LT_Target[LT_Loop] is alive) Equal to True
- (Life of LT_Target[LT_Loop]) Greater than or equal to 50.00
-
Then - Actions
- Unit - Set life of LT_Caster[LT_Loop] to ((Life of LT_Caster[LT_Loop]) + 50.00)
- Unit - Cause LT_Caster[LT_Loop] to damage LT_Target[LT_Loop], dealing 50.00 damage of attack type Chaos and damage type Universal
- Set LT_Counter[LT_Loop] = (LT_Counter[LT_Loop] + 0.50)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- LT_Counter[LT_Loop] Less than 1.50
- (LT_Target[LT_Loop] is alive) Equal to True
- (Life of LT_Target[LT_Loop]) Less than 50.00
-
Then - Actions
- Unit - Set life of LT_Caster[LT_Loop] to ((Life of LT_Caster[LT_Loop]) + (Life of LT_Target[LT_Loop]))
- Unit - Cause LT_Caster[LT_Loop] to damage LT_Target[LT_Loop], dealing (Life of LT_Target[LT_Loop]) damage of attack type Chaos and damage type Universal
- Set LT_Counter[LT_Loop] = (LT_Counter[LT_Loop] + 0.50)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (LT_Target[LT_Loop] is alive) Equal to False
- LT_Counter[LT_Loop] Greater than or equal to 1.50
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Set LT_Caster[LT_Loop] = LT_Caster[LT_Index]
- Set LT_Target[LT_Loop] = LT_Target[LT_Index]
- Set LT_Counter[LT_Loop] = LT_Counter[LT_Index]
- Set LT_Index = (LT_Index - 1)
- Set LT_Loop = (LT_Loop - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- LT_Index Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer LT_Loop) from 1 to LT_Index, do (Actions)
-
Events
-
Loop Hashtable
-
Events
- Time - Every 0.50 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in LT_Hashtable_Group and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load (Integer(counter)) of (Key (Picked unit)) from LT_Hashtable) Less than 1.50
- ((Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable) is alive) Equal to True
- (Life of (Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable)) Greater than or equal to 50.00
-
Then - Actions
- Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 50.00)
- Unit - Cause (Picked unit) to damage (Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable), dealing 50.00 damage of attack type Chaos and damage type Universal
- Hashtable - Save ((Load (Integer(counter)) of (Key (Picked unit)) from LT_Hashtable) + 0.50) as (Integer(counter)) of (Key (Picked unit)) in LT_Hashtable
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load (Integer(counter)) of (Key (Picked unit)) from LT_Hashtable) Less than 1.50
- ((Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable) is alive) Equal to True
- (Life of (Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable)) Less than 50.00
-
Then - Actions
- Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Life of (Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable)))
- Unit - Cause (Picked unit) to damage (Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable), dealing (Life of (Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable)) damage of attack type Chaos and damage type Universal
- Hashtable - Save ((Load (Integer(counter)) of (Key (Picked unit)) from LT_Hashtable) + 0.50) as (Integer(counter)) of (Key (Picked unit)) in LT_Hashtable
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Load (Integer(counter)) of (Key (Picked unit)) from LT_Hashtable) Greater than or equal to 1.50
- ((Load (Integer(target)) of (Key (Picked unit)) in LT_Hashtable) is alive) Equal to False
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in LT_Hashtable
- Unit Group - Remove (Picked unit) from LT_Hashtable_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (LT_Hashtable_Group is empty) Equal to True
-
Then - Actions
- Trigger - Turn off (This trigger)
-
Else - Actions
- Do nothing
-
If - Conditions
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Unit Group - Pick every unit in LT_Hashtable_Group and do (Actions)
-
Events
-
Cancel Array
-
Events
- Unit - A unit Stops casting an ability
-
Conditions
- (Ability being cast) Equal to Life Transfer (ivo)
-
Actions
-
For each (Integer LT_Loop) from 1 to LT_Index, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- LT_Caster[LT_Loop] Equal to (Triggering unit)
-
Then - Actions
- Set LT_Counter[LT_Loop] = 1.50
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer LT_Loop) from 1 to LT_Index, do (Actions)
-
Events
-
Cancel Hashtable
-
Events
- Unit - A unit Stops casting an ability
-
Conditions
- (Ability being cast) Equal to Life Transfer (ivo)
-
Actions
-
Unit Group - Pick every unit in LT_Hashtable_Group and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Triggering unit) Equal to (Picked unit)
-
Then - Actions
- Hashtable - Save 1.50 as (Integer(counter)) of (Key (Picked unit)) in LT_Hashtable
-
Else - Actions
- Do nothing
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Unit Group - Pick every unit in LT_Hashtable_Group and do (Actions)
-
Events
Last edited: