Gwafu
Active Member
- Reaction score
- 12
Confuse
When the effect runs out, the confused/target unit still attacks his last attacked unit.
Here's what it does:
~The target unit will randomly attack anything and it's uncontrollable, but after the effect runs out, it should stop attacking (if the target is a friend) or continue attacking (if it is an enemy).
~Gwafu
When the effect runs out, the confused/target unit still attacks his last attacked unit.
Trigger:
- Confusion 1
- Events
- Conditions
- ((Damage source) is in Confusion_UG) Equal to True
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Key target) is stored as a Handle of (Key (Damage source)) in Confusion_Hash) Equal to False
- Then - Actions
- Hashtable - Save Handle Of(Triggering unit) as (Key target) of (Key (Damage source)) in Confusion_Hash
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Trigger:
- Confusion 2
- Events
- Unit - A unit enters (Playable map area)
- Conditions
- Actions
- Trigger - Add to Confusion 1 <gen> the event (Unit - (Triggering unit) Takes damage)
- Events
Trigger:
- Confusion 3
- Events
- Time - Every 1.00 seconds of game time
- Conditions
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Confusion_UG is empty) Equal to False
- Then - Actions
- Unit Group - Pick every unit in Confusion_UG and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Key target) is stored as a Handle of (Key (Picked unit)) in Confusion_Hash) Equal to False
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Picked unit) has buff Confusion ) Equal to True
- Then - Actions
- Set Confusion_Point = (Position of (Picked unit))
- Set Confusion_TempGroup = (Units within (Current acquisition range of (Picked unit)) of Confusion_Point matching ((Life of (Matching unit)) Greater than (0.41 - 0.05)))
- Unit - Order (Picked unit) to Attack (Random unit from Confusion_TempGroup)
- Custom script: call DestroyGroup (udg_Confusion_TempGroup)
- Custom script: call RemoveLocation (udg_Confusion_Point)
- Else - Actions
- Hashtable - Save Handle OfNo unit as (Key target) of (Key (Picked unit)) in Confusion_Hash
- Unit - Order (Picked unit) to Stop
- Unit Group - Remove (Picked unit) from Confusion_UG
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Confusion_Hash
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Life of (Load (Key target) of (Key (Picked unit)) in Confusion_Hash)) Less than (0.41 - 0.05)
- Then - Actions
- Hashtable - Save Handle OfNo unit as (Key target) of (Key (Picked unit)) in Confusion_Hash
- Unit - Order (Picked unit) to Stop
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Confusion_Hash
- 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 Confusion_UG and do (Actions)
- Else - Actions
- Trigger - Turn off (This trigger)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
Trigger:
- Confusion 4
- Events
- Unit - A unit Is issued an order targeting an object
- Unit - A unit Is issued an order targeting a point
- Unit - A unit Is issued an order with no target
- Conditions
- ((Triggering unit) is in Confusion_UG) Equal to True
- Actions
- Set Confusion_MainUnit = (Load (Key target) of (Key (Triggering unit)) in Confusion_Hash)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Life of Confusion_MainUnit) Greater than (0.41 - 0.05)
- Then - Actions
- Wait 0.00 seconds
- Unit - Order (Triggering unit) to Attack Confusion_MainUnit
- Else - Actions
- If - Conditions
- Events
Trigger:
- Confusion 5
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Confusion
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Target unit of ability being cast) is in Confusion_UG) Equal to False
- Then - Actions
- Unit Group - Add (Target unit of ability being cast) to Confusion_UG
- Trigger - Turn on Confusion 3 <gen>
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
Trigger:
- Confusion 6
- Events
- Unit - A unit Dies
- Conditions
- ((Triggering unit) is in Confusion_UG) Equal to True
- Actions
- Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Confusion_Hash
- Unit Group - Remove (Triggering unit) from Confusion_UG
- Events
Here's what it does:
~The target unit will randomly attack anything and it's uncontrollable, but after the effect runs out, it should stop attacking (if the target is a friend) or continue attacking (if it is an enemy).
~Gwafu