# [Trigger]How to use Hashtable?

Status
Not open for further replies.

#### Jay the Editor

Level 12
This is one of my spell that I currently working on it.
And so, there is a problem on deactivation of this spell.
I was told by someone (I forgot) that it can be solve by using Hashtable. Somehow, I just can't get it although I've read the tutorial several times. I'm stupid though. I asked him before to help me but he was busy with his thingy.
So, anyone can help?

Upon activation, Ignito turns into a fiery ball that can be control but lose 15/30/45/60 mana/sec. The fiery ball cause up to 8/16/24/32 damage/sec to all nearby enemies within 225 range of radius of the fiery ball (damage interval 4 times/sec). The fiery ball is invulnerable and has no collision.

[trigger=FF cast]
FF cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Fiery Form
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index[1] Equal to 0
Then - Actions
Trigger - Turn on FF loop <gen>
Trigger - Turn on FF deactivate <gen>
Else - Actions
Set FF_index[1] = (FF_index[1] + 1)
Set FF_index_selected = False
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_dyn_index Less than FF_index[2]
FF_index_clear[FF_dyn_index] Equal to True
FF_dyn_index Not equal to 0
Then - Actions
Set FF_index_selected = True
Else - Actions
For each (Integer FF_index[0]) from 1 to FF_index[2], do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index_selected Equal to False
FF_index_clear[FF_index[0]] Equal to True
Then - Actions
Set FF_dyn_index = FF_index[0]
Set FF_index_selected = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index_selected Equal to False
Then - Actions
Set FF_index[2] = (FF_index[2] + 1)
Set FF_dyn_index = FF_index[2]
Else - Actions
Set FF_index_clear[FF_dyn_index] = False
-------- -------------------------------------------------------------------------------------------------------------------------- --------
Set FF_caster[FF_dyn_index] = (Triggering unit)
Set FF_casterpoint[FF_dyn_index] = (Position of FF_caster[FF_dyn_index])
Set FF_angle[FF_dyn_index] = (Facing of FF_caster[FF_dyn_index])
Set FF_deactivated[FF_dyn_index] = False
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- Damage = 8 x (Level of Fiery Form) [It's divided by 4 because the damage interval is 4 times every second] --------
Set FF_damage[FF_dyn_index] = ((8.00 x (Real((Level of Fiery Form for FF_caster[FF_dyn_index])))) / 4.00)
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- True/False: True will triggers destroy trees while False will not --------
Set FF_destroyTrees[FF_dyn_index] = True
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- The manacost every second. It's divided by 4 because the loop trigger run 4 times every second. --------
-------- Mana cost : (manacost x Level of Fiery Form) /4 --------
Set FF_manacost[FF_dyn_index] = ((15.00 x (Real((Level of Fiery Form for FF_caster[FF_dyn_index])))) / 4.00)
-------- -------------------------------------------------------------------------------------------------------------------------- --------
-------- -------------------------------------------------------------------------------------------------------------------------- --------
Unit - Hide FF_caster[FF_dyn_index]
Special Effect - Create a special effect at FF_casterpoint[FF_dyn_index] using Abilities\Spells\Human\Polymorph\PolyMorphDoneGround.mdl
Special Effect - Destroy (Last created special effect)
Unit - Create 1 Fiery Form for (Owner of FF_caster[FF_dyn_index]) at FF_casterpoint[FF_dyn_index] facing FF_angle[FF_dyn_index] degrees
Set FF_dummy[FF_dyn_index] = (Last created unit)
[/trigger]

[trigger=FF loop]
FF loop
Events
Time - Every 0.25 seconds of game time
Conditions
Actions
For each (Integer FF_index[3]) from 1 to FF_index[2], do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Mana of FF_caster[FF_index[3]]) Greater than 0.00
Then - Actions
Set FF_dummypoint[FF_index[3]] = (Position of FF_dummy[FF_index[3]])
Unit - Set mana of FF_caster[FF_index[3]] to ((Mana of FF_caster[FF_index[3]]) - FF_manacost[FF_index[3]])
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 225.00 of FF_dummypoint[FF_index[3]] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of FF_dummy[FF_index[3]])) Equal to True))) and do (Actions)
Loop - Actions
Set FF_pickedunit[FF_index[3]] = (Picked unit)
Set FF_PU_point[FF_index[3]] = (Position of (Picked unit))
Unit - Cause FF_caster[FF_index[3]] to damage FF_pickedunit[FF_index[3]], dealing FF_damage[FF_index[3]] damage of attack type Spells and damage type Normal
Special Effect - Create a special effect at FF_PU_point[FF_index[3]] using Abilities\Spells\Other\Doom\DoomTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation (udg_FF_PU_point[udg_FF_index[3]])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_destroyTrees[FF_index[3]] Equal to True
Then - Actions
Custom script: set bj_wantDestroyGroup = true
Destructible - Pick every destructible within 225.00 of FF_dummypoint[FF_index[3]] and do (Actions)
Loop - Actions
Destructible - Kill (Picked destructible)
Else - Actions
Custom script: call RemoveLocation (udg_FF_dummypoint[udg_FF_index[3]])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
FF_deactivated[FF_index[3]] Equal to True
(Mana of FF_caster[FF_index[3]]) Equal to 0.00
Then - Actions
Set FF_dummypoint[FF_index[3]] = (Position of FF_dummy[FF_index[3]])
Unit - Move FF_caster[FF_index[3]] instantly to FF_dummypoint[FF_index[3]]
Unit - Unhide FF_caster[FF_index[3]]
Unit - Explode FF_dummy[FF_index[3]]
Custom script: call RemoveLocation (udg_FF_casterpoint[udg_FF_index[3]])
Custom script: call RemoveLocation (udg_FF_dummypoint[udg_FF_index[3]])
-------- -------------------------------------------------------------------------------------------------------------------------- --------
Set FF_index[1] = (FF_index[1] - 1)
Set FF_index_clear[FF_index[3]] = True
-------- -------------------------------------------------------------------------------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index_selected Equal to False
Then - Actions
Set FF_dyn_index = FF_index[3]
Set FF_index_selected = True
Else - Actions
-------- -------------------------------------------------------------------------------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index[1] Not equal to 0
FF_index[3] Equal to FF_index[2]
Then - Actions
Set FF_index[2] = (FF_index[2] - 1)
Else - Actions
-------- -------------------------------------------------------------------------------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index[1] Equal to 0
Then - Actions
Set FF_index[2] = 0
Set FF_dyn_index = 0
Trigger - Turn off (This trigger)
Trigger - Turn off FF deactivate <gen>
Else - Actions
-------- -------------------------------------------------------------------------------------------------------------------------- --------
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
FF_index[1] Not equal to 0
FF_index[3] Equal to FF_index[2]
Then - Actions
Set FF_index[2] = (FF_index[2] - 1)
Else - Actions
[/trigger]

[trigger=FF deactivate]
FF deactivate
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Deactivate Fiery Form
Actions
[/trigger]

#### Pharaoh_

Level 40
Add the caster to a unit group and in the looping trigger, check if FF_caster[FF_index[3]] is in the Unit Group. If it is, make the actions, else decrease index. In the deactivation trigger, just remove the triggering unit from the Unit Group you initially added it into.

#### Jay the Editor

Level 12
ohh.. Great! I thought Hashtable is the only way to overcome this >< Thank you Pharaoh. I'll sure give credits to you when I'm done with my spell ^-^ Thank you Thank you!!!!!

Status
Not open for further replies.

Replies
14
Views
750
Replies
6
Views
936
Replies
4
Views
915
Replies
9
Views
1K
Replies
3
Views
456