- Joined
- Sep 25, 2013
- Messages
- 645
Ive created a system in which a unit moves continually in one direction for a duration and kills every unit in its path. While the unit is moving, the player looses control of that unit.
I have 2 separate versions of this unit. Version 1 has a collision size and does not kill units in its way. Version 2 has its collision size set to 0 so it can move through units easily and crush them.
In the trigger, when the unit casts it ability, "Rampage", the Version 1 unit is replaced by the Version 2 unit and then its ownership is changed to neutral extra and it is ordered to move to the target point of the casting ability.
The problem arises when the duration runs out and I want to return the unit to its original owner after returning that unit to a Version 1 unit. The unit changes it ownership to neutral extra instead of the saved player value.
I have 2 separate versions of this unit. Version 1 has a collision size and does not kill units in its way. Version 2 has its collision size set to 0 so it can move through units easily and crush them.
In the trigger, when the unit casts it ability, "Rampage", the Version 1 unit is replaced by the Version 2 unit and then its ownership is changed to neutral extra and it is ordered to move to the target point of the casting ability.
The problem arises when the duration runs out and I want to return the unit to its original owner after returning that unit to a Version 1 unit. The unit changes it ownership to neutral extra instead of the saved player value.
-
Mamukil Rampage Cast
-
Events
- Unit - A unit Begins casting an ability
-
Conditions
- (Ability being cast) Equal to Rampage (Mamukil)(Newer Yet)
-
Actions
- Set MamukilTargetPoint = (Position of (Target unit of ability being cast))
- Hashtable - Save Handle Of(Owner of (Triggering unit)) as 2 of (Key (Triggering unit)) in MamukilPlayerHashtable
- Unit - Replace (Triggering unit) with a Rampaging Mamukil |c00FFFF00(Elite)|r (Haradrim) using The old unit's relative life and mana
- Set RampagePoint = (MamukilTargetPoint offset by 1000.00 towards (Angle from (Position of (Triggering unit)) to MamukilTargetPoint) degrees)
- Unit - Change ownership of (Last replaced unit) to Neutral Extra and Retain color
- Unit - Order (Last replaced unit) to Move To RampagePoint
- Unit Group - Add (Last replaced unit) to MamukilUnitGroup
- Hashtable - Save 7 as 1 of (Key (Last replaced unit)) in MamukilHashtable
-
Events
-
Mamukil Rampage
-
Events
- Time - Every 1.00 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in MamukilUnitGroup and do (Actions)
-
Loop - Actions
- Set MamukilRemainingTime = (Load 1 of (Key (Picked unit)) from MamukilHashtable)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MamukilRemainingTime Greater than 0
-
Then - Actions
- Hashtable - Save (MamukilRemainingTime - 1) as 1 of (Key (Picked unit)) in MamukilHashtable
- Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
- Special Effect - Destroy (Last created special effect)
-
Else - Actions
- Unit - Change ownership of (Picked unit) to (Load 2 of (Key (Picked unit)) in MamukilPlayerHashtable) and Change color
- Unit - Replace (Picked unit) with a Mamukil |c00FFFF00(Elite)|r (Haradrim) using The old unit's relative life and mana
- Hashtable - Clear all child hashtables of child (Key (Owner of (Picked unit))) in MamukilPlayerHashtable
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in MamukilUnitHashtable
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in MamukilHashtable
- Custom script: call RemoveLocation (udg_RampagePoint)
- Unit Group - Remove (Picked unit) from MamukilUnitGroup
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in MamukilUnitGroup and do (Actions)
-
Events