Home   Help Search Login Register  

Author Topic: Deleting mass bodies  (Read 604 times)

0 Members and 2 Guests are viewing this topic.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Deleting mass bodies
« on: 12 Mar 2003, 09:52:27 »
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!
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

SSG Plazmoid

  • Guest
Re:Deleting mass bodies
« Reply #1 on: 13 Mar 2003, 11:06:16 »
not sure if this would be helpful for you or not but something I've seen done is to add a script to each new unit. That script waits for the unit to be dead and then after a suitable delay deletes the unit. In this way everything that gets the script will delete itself when the time comes.

This could be added to reloadguy for multiplayer stuff or the init property for AI created on the fly.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Deleting mass bodies
« Reply #2 on: 13 Mar 2003, 12:04:35 »
SSG Plazmoind ,I'm interested.

Doesn't that make the mission lag?

Say you have 50 units per side. that's 100 scripts waiting on the background for the unit to die.
Not all is lost.