- Joined
- Oct 28, 2019
- Messages
- 523
hello, When a unit enters in combat it changes its ownership. (This is for some units not all). After a moment, if there´s no enemies near, it changes the ownership to the player again.
This is already made. Follows:

This is already made. Follows:
-
Start Fight
-
Events
-
Unit - A unit Is attacked
-
-
Conditions
-
(Owner of (Attacking unit)) Equal to Player 1 (Red)
-
((Attacked unit) is A structure) Equal to False
-
((Unit-type of (Attacking unit)) Equal to Militia) or (((Unit-type of (Attacking unit)) Equal to Swordman) or (((Unit-type of (Attacking unit)) Equal to Elven Spearman) or (((Unit-type of (Attacking unit)) Equal to Black Legion Footman) or ((Unit-type of (Attacking unit)) Equal to Black Legion Pikeman))))
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(UnitGroup is empty) Equal to True
-
-
Then - Actions
-
Trigger - Turn on End fight loop <gen>
-
-
Else - Actions
-
-
Unit Group - Add (Attacking unit) to UnitGroup
-
Unit - Change ownership of (Attacking unit) to Player 3 (Teal) and Retain color
-
-
-
End fight loop Copy
-
Events
-
Time - Every 0.50 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in UnitGroup and do (Actions)
-
Loop - Actions
-
Set VariableSet Point = (Position of (Picked unit))
-
Set VariableSet UnitsInRangeGroup = (Units within 500.00 of Point matching (((Matching unit) belongs to an enemy of Player 1 (Red).) Equal to True).)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(UnitsInRangeGroup is empty) Equal to True
-
(All units of UnitsInRangeGroup are dead) Equal to True
-
-
-
-
Then - Actions
-
Unit - Change ownership of (Picked unit) to Player 1 (Red) and Retain color
-
Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) Equal to Black Legion Footman) or (((Unit-type of (Matching unit)) Equal to Militia) or ((Unit-type of (Matching unit)) Equal to Swordman))).) and do (Unit - Add Charge to (Picked unit))
-
Unit Group - Remove (Picked unit) from UnitGroup.
-
-
Else - Actions
-
-
-------- destroy the unit group and point here to avoid leaks --------
-
Custom script: call DestroyGroup(udg_UnitsInRangeGroup)
-
Custom script: call RemoveLocation(udg_Point)
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(UnitGroup is empty) Equal to True
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
Charge Ability
-
Events
-
Unit - A unit owned by Player 1 (Red) Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Charge
-
-
Actions
-
Set VariableSet Point_Charge = ((Position of (Casting unit)) offset by 1500.00 towards (Facing of (Casting unit)) degrees.)
-
Unit - Change ownership of (Casting unit) to Player 3 (Teal) and Retain color
-
AI - Ignore (Casting unit)'s guard position
-
Unit - Order (Casting unit) to Attack-Move To Point_Charge
-
Unit Group - Add (Casting unit) to UnitGroup
-
Custom script: call RemoveLocation(udg_Point_Charge)
-
Wait 6.00 seconds
-
Trigger - Turn on End fight loop Copy <gen>
-
-

Attachments
Last edited: