I'm trying to make a script that will delete every dead person off the map when called. I thought it would be simple, but it isn't working for me. Here is what I did:
First, I made a trigger that covered the entire map, and was activated by "anybody present". I called it "deletebodies". Then I wrote a script like this:
_i = 0
_aunits = list deletebodies
_max = count list deletebodies
#Loop
?NOT alive (_aunits select _i) : deletevehicle (_aunits select _i)
_i = _i + 1
?_max > _i:goto "Loop"
exit
What I'm trying to do here is cycle through every unit on the map, and if it is dead, delete it. Anyone know what I'm doing wrong, or another way to do this? I would prefer to have it leave vehicles behind, too. Just get rid of the crew. Any help would be kindly recieved.
Thanks!