HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to remove idle units?

10-04-2003, 11:16 PM#1
Coffein
In my map sometimes units get stuck or just don't do their orders.
What I'm trying, is to remove all the idle units.
I have tried to pick all units with the issued order "hold position" but that doesnt seem to work either.

Any suggestions?
10-04-2003, 11:22 PM#2
RodOfNOD
unfortunately there is no real way to do this with just one trigger.

However you can do a couple things....

create a unique custom value for every unit created
assign this value to the unit when they are created or trained
so just make a value = value + 1
NOTE if greater than 8000 u will have issues :>

then every second u do a comparision of the current position of the unit to its last position (obviously u have to track this with an array that is reflected by this custom value).

if it hasnt changed in say 2 seconds then they are stopped

u can do that test with another array value that u set to 2 and then decrement

when it reaches 0 u remove the unit

ANOTHER idea i had was to set units with death timers (im assuming that this is a td) so that u figure out the maximum length of time they would be on the map if all went well and u KILL them using the unit death timer at say 120 seconds.

good luck!
10-05-2003, 01:04 AM#3
FyreDaug
You could select the unit and type remove to remove it.

Trigger would be:
TRIG1
EVENT:
Player types chat message remove as an exact match
COND:
ACTION:
Set ChatMsg = (Entered chat message)

TRIG2
EVENT:
Player selects a unit
COND:
ChatMsg = remove
ACTION:
Remove selected unit
Set ChatMsg = (nothing at all here)

VARS:
ChatMsg = String


That method probably isn't the best way to do it, from what I'm understanding you would type remove, before you click the unit. I just made this up in my head without looking at the world editor, but that will work, go ahead and play around with it to get the order to work, it wouldn't be very difficult to do at all.
10-05-2003, 08:18 AM#4
Coffein
@RodOfNod:
Thanks, I'll try this out. And no, this is not a TD, it's a simulation of a growing town.
@Fyredaug:
Selecting all the units that have to be removed would solve my personal problem but not the "3rd Party Player" 's. He would soon think that this is way too annoying since he has other things to do.