- Joined
- Aug 3, 2004
- Messages
- 2,891
I've been using this script for some time but it's not very reliable. Mechanical units don't always trigger it and wards do. It also captures and then an instant later uncaptures sometimes.
-
Melee Initialization
-
Events
- Map initialization
- Conditions
-
Actions
- Melee Game - Use melee time of day (for all players)
- -------- -------------------------------------------------- --------
- Hashtable - Create a hashtable
- Set Tower_Hash = (Last created hashtable)
- -------- -------------------------------------------------- --------
- -------- Capture distance --------
- -------- -------------------------------------------------- --------
- Set Tower_Reals[0] = 256.00
- -------- -------------------------------------------------- --------
- Set Towers = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Scout Tower))
-
Unit Group - Pick every unit in Towers and do (Actions)
-
Loop - Actions
- Trigger - Add to Capture Tower <gen> the event (Unit - A unit comes within Tower_Reals[0] of (Picked unit))
-
Loop - Actions
-
Events
-
Capture Tower
- Events
- Conditions
-
Actions
- Game - Display to (All players) the text: Close
- Set Tower_Temp_Loc_1 = (Position of (Triggering unit))
- Set Tower_Temp_Group_1 = (Units within (Tower_Reals[0] + 32.00) of Tower_Temp_Loc_1 matching ((Unit-type of (Matching unit)) Equal to Scout Tower))
-
Unit Group - Pick every unit in Tower_Temp_Group_1 and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Owner of (Picked unit)) Equal to Neutral Passive
-
Then - Actions
- Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color
- Hashtable - Save (Player number of (Owner of (Triggering unit))) as (Key owner) of (Key (Picked unit)) in Tower_Hash
- Unit Group - Add (Picked unit) to Towers_Owned
- Trigger - Turn on Lose Tower <gen>
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Custom script: call DestroyGroup(udg_Tower_Temp_Group_1)
- Custom script: call RemoveLocation(udg_Tower_Temp_Loc_1)
-
Lose Tower
-
Events
- Time - Every 1.00 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in Towers_Owned and do (Actions)
-
Loop - Actions
- Set Tower_Temp_Loc_1 = (Position of (Picked unit))
- Set Tower_Temp_Group_1 = (Units within Tower_Reals[0] of Tower_Temp_Loc_1 matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Not equal to Scout Tower) and ((((Matching unit) is A structure) Equal to False) and ((Owner of (Matching unit)) Equal t
- Set Tower_Temp_Group_2 = (Units within Tower_Reals[0] of Tower_Temp_Loc_1 matching ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Not equal to Scout Tower) and ((((Matching unit) is A structure) Equal to False) and ((Owner of (Matching unit)) Not equ
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Tower_Temp_Group_1 is empty) Equal to True
- (Tower_Temp_Group_2 is empty) Equal to True
-
Then - Actions
- Unit Group - Remove (Picked unit) from Towers_Owned
- Unit - Change ownership of (Picked unit) to Neutral Passive and Change color
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Towers_Owned is empty) Equal to True
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Tower_Temp_Group_1 is empty) Equal to True
- (Tower_Temp_Group_2 is empty) Equal to False
-
Then - Actions
- Set Tower_Temp_Unit_1 = (Random unit from Tower_Temp_Group_2)
- Unit - Change ownership of (Picked unit) to (Owner of Tower_Temp_Unit_1) and Change color
- Hashtable - Save (Player number of (Owner of Tower_Temp_Unit_1)) as (Key owner) of (Key (Picked unit)) in Tower_Hash
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call DestroyGroup(udg_Tower_Temp_Group_1)
- Custom script: call DestroyGroup(udg_Tower_Temp_Group_2)
- Custom script: call RemoveLocation(udg_Tower_Temp_Loc_1)
-
Loop - Actions
-
Unit Group - Pick every unit in Towers_Owned and do (Actions)
-
Events
Attachments
Last edited: