- Joined
- Jul 9, 2012
- Messages
- 159
Hello Hives.
I'm having trouble with hashtables.
It is a trigger that counts everytime a Deaht Knight kills an enemy unit. Whenever he reaches 10/8/6 stacks of kills, he will regain 25% health and gain 1 strength.
However, the trigger keeps saying that the RandomBladeHungers_i = 1, thus showing that the value haven't been saved in the hashtable.
Thanks
I'm having trouble with hashtables.
It is a trigger that counts everytime a Deaht Knight kills an enemy unit. Whenever he reaches 10/8/6 stacks of kills, he will regain 25% health and gain 1 strength.
However, the trigger keeps saying that the RandomBladeHungers_i = 1, thus showing that the value haven't been saved in the hashtable.
-
Random Sword Hungers Initial Hash
-
Events
- Map initialization
- Conditions
-
Actions
- Hashtable - Create a hashtable
- Set RandomSwordHungers_hash = (Last created hashtable)
- Set RandomSwordHungers_UG = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death Knight))
- Set RandomSwordHungers_i = 1
-
Unit Group - Pick every unit in RandomSwordHungers_UG and do (Actions)
-
Loop - Actions
- Hashtable - Save RandomSwordHungers_i as (Key (Picked unit)) of 1 in RandomSwordHungers_hash
-
Loop - Actions
-
Events
-
Random Sword Hungers Kill
-
Events
- Unit - A unit Dies
-
Conditions
- ((Killing unit) is in RandomSwordHungers_UG) Equal to True
- (Level of Random Blade Hungers for (Killing unit)) Greater than 0
-
Actions
- Set RandomSwordHungers_caster = (Killing unit)
- Set RandomSwordHungers_i = (Key (Load (Key (Killing unit)) of 1 in RandomSwordHungers_hash))
- Set RandomSwordHungers_i = (RandomSwordHungers_i + 1)
- Custom script: call RemoveSavedHandle(udg_RandomSwordHungers_hash, GetHandleId(udg_RandomSwordHungers_caster), 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- RandomSwordHungers_i Equal to (13 - (2 x (Level of Random Blade Hungers for RandomSwordHungers_caster)))
-
Then - Actions
- Set RandomSwordHungers_p = (Position of RandomSwordHungers_caster)
- Special Effect - Create a special effect at RandomSwordHungers_p using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
- Special Effect - Destroy (Last created special effect)
- Hero - Modify Strength of RandomSwordHungers_caster: Add 1
- Unit - Set life of RandomSwordHungers_caster to ((Percentage life of RandomSwordHungers_caster) + 25.00)%
- Set RandomSwordHungers_i = 1
- Custom script: call RemoveLocation(udg_RandomSwordHungers_p)
-
Else - Actions
- Floating Text - Create floating text that reads (String(RandomSwordHungers_i)) above RandomSwordHungers_caster with Z offset 100.00, using font size 15.00, color (50.00%, 25.00%, 25.00%), and 0.00% transparency
- Set TempText_F = (Last created floating text)
- Trigger - Run Temp Floating Text <gen> (checking conditions)
-
If - Conditions
- Hashtable - Save RandomSwordHungers_i as 0 of (Key (Killing unit)) in RandomSwordHungers_hash
-
Events
Thanks