- Joined
- Oct 29, 2007
- Messages
- 1,184
I am making a custom targeting system. Each player has one hero. When a player presses Esc, the system should detect units nearby the hero and sort the distance between them and the hero from closest, to farthest. I have this part of the trigger now:
-
Select Unit Copy
-
Events
-
Player - Player 1 (Red) skips a cinematic sequence
-
Player - Player 2 (Blue) skips a cinematic sequence
-
Player - Player 3 (Teal) skips a cinematic sequence
-
Player - Player 4 (Purple) skips a cinematic sequence
-
-
Conditions
-
DetectTargeting[(Player number of (Triggering player))] Equal to 0
-
-
Actions
-
Custom script: local integer a
-
Custom script: local rect r
-
Custom script: set r = Rect ( 0, 0, 0, 0 )
-
Custom script: set a = 2048
-
Set tmp_loc = (Position of Player[(Player number of (Triggering player))])
-
Custom script: call SetRect ( r, GetLocationX(udg_tmp_loc) - (a * 0.5), GetLocationY(udg_tmp_loc) - (a * 0.5), GetLocationX(udg_tmp_loc) + (a * 0.5), GetLocationY(udg_tmp_loc) + (a * 0.5) )
-
Set tmp_group[1] = (Units in tmp_region matching ((Owner of (Picked unit)) Not equal to Player 5 (Yellow)))
-
Unit Group - Pick every unit in tmp_group[1] and do (Actions)
-
Loop - Actions
-
Set tmp_real_array[tmp_integer] = (Distance between (Position of Player[(Player number of (Triggering player))]) and (Position of (Picked unit)))
-
Set tmp_integer = (tmp_integer + 1)
-
-
-
-