Hello everyone, I requested a boomerang spell and it was working good in test map, but not in mine.
-In my map it's damaging it on first hit, but won't damage it when turning back.
Here are the triggers:
Spell made by Ayanami !
-In my map it's damaging it on first hit, but won't damage it when turning back.
Here are the triggers:
Code:
Boomerang Var
Events
Map initialization
Conditions
Actions
-------- Set this variable to the base ability "Boomerang" --------
Set BoAbility = Boomerang
-------- Set this variable to the unit "Boomerang Dummy" --------
Set BoDummy = Boomerang Dummy
-------- Damage dealt --------
Set BoReal[0] = 18.00
-------- Collision area of boomerang --------
Set BoReal[1] = 130.00
-------- Maximum distance --------
Set BoReal[2] = 1200.00
-------- Speed of boomerang (distance travelled per second) --------
Set BoReal[3] = 650.00
-------- ----------------------------------------- --------
Hashtable - Create a hashtable
Set Hashtable = (Last created hashtable)
Code:
Boomerang
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to BoAbility
Actions
Set TempPoint = (Position of (Triggering unit))
Set TempOffset = (Target point of ability being cast)
Unit - Create 1 BoDummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
Hashtable - Save BoReal[2] as 0 of (Key (Last created unit)) in Hashtable
Hashtable - Save False as 1 of (Key (Last created unit)) in Hashtable
Hashtable - Save Handle Of(Triggering unit) as 2 of (Key (Last created unit)) in Hashtable
Hashtable - Save (Angle from TempPoint to TempOffset) as 3 of (Key (Last created unit)) in Hashtable
Hashtable - Save 4 as 4 of (Key (Last created unit)) in Hashtable
Unit Group - Add (Last created unit) to BoGroup
Set BoGroupCount = (BoGroupCount + 1)
Trigger - Turn on Boomerang Periodic <gen>
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempOffset)
Code:
Boomerang Periodic
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
BoGroupCount Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Unit Group - Pick every unit in BoGroup and do (Actions)
Loop - Actions
Set TempUnit = (Load 2 of (Key (Picked unit)) in Hashtable)
Set TempPoint = (Position of (Picked unit))
Set TempOffset = (Position of TempUnit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between TempPoint and TempOffset) Less than or equal to 50.00
(Load 1 of (Key (Picked unit)) from Hashtable) Equal to True
Then - Actions
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
Unit Group - Remove (Picked unit) from BoGroup
Set BoGroupCount = (BoGroupCount - 1)
Unit - Kill (Picked unit)
Else - Actions
Set BoUnit = (Picked unit)
Set TempGroup = (Units within BoReal[1] of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True))))
Unit Group - Pick every unit in TempGroup and do (Actions)
Loop - Actions
Custom script: set udg_TempBoolean = LoadBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempBoolean Equal to True
Then - Actions
Else - Actions
Unit - Cause TempUnit to damage (Picked unit), dealing BoReal[0] damage of attack type Chaos and damage type Universal
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call SaveBoolean(udg_Hashtable, GetHandleId(udg_BoUnit), GetHandleId(GetEnumUnit()), true)
Custom script: call DestroyGroup(udg_TempGroup)
Set TempReal = (Angle from TempPoint to TempOffset)
Custom script: call RemoveLocation(udg_TempOffset)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Load 0 of (Key (Picked unit)) from Hashtable) Less than or equal to 0.00
Then - Actions
Set TempOffset = (TempPoint offset by (BoReal[3] x 0.03) towards TempReal degrees)
Unit - Move (Picked unit) instantly to TempOffset
Hashtable - Save True as 1 of (Key (Picked unit)) in Hashtable
Else - Actions
Set TempOffset = (TempPoint offset by (BoReal[3] x 0.03) towards (Load 3 of (Key (Picked unit)) from Hashtable) degrees)
Unit - Move (Picked unit) instantly to TempOffset
Hashtable - Save ((Load 0 of (Key (Picked unit)) from Hashtable) - (BoReal[3] x 0.03)) as 0 of (Key (Picked unit)) in Hashtable
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempOffset)