Home   Help Search Login Register  

Author Topic: deleting dead guys  (Read 1690 times)

0 Members and 1 Guest are viewing this topic.

Offline CapMorgan

  • Members
  • *
  • OFP fan
    • Cazadores de monte
deleting dead guys
« on: 31 Aug 2002, 09:23:09 »
Hi. I'm trying to make a script for deleting dead guys. im, using this code.

_Global = _this select 0
_i = 0
_c = count _Global
player globalchat format ["%1",_global]
#main  
;deletevehicle (_Global select _i)
?!alive(_Global select _i):deletevehicle (_Global select _i)
player globalchat format ["%1",_i]
_i=_i+1
?_c > _i:goto "main"
RecalcularLista = true
exit

_Global is the array of units i want to check and when script finishes, a trigger recalculate the array.
Now the problem is that when the guy is dead, the engine deletes him from the array and of course it ll never be deleted since he is not in _global. It also detes him from the group, so i cant use group too. I just cant find where the ofp stores the deads.
So, can this be solved?

As usual, thanx in advanced.

PS: I'm making this for an MP mission, this is why i post under this topic.

Solarix

  • Guest
Re:deleting dead guys
« Reply #1 on: 31 Aug 2002, 09:52:53 »
Try this...

Code: [Select]
; deletedead.sqs
;
; Insert the following line in the init field of each unit you
; want it to delete when they are dead.
;
; [this] exec "deletedead.sqs";
;
_deadbody = _this select 0;
goto "loop";

#loop
~5
?!alive(_deadbody):deletevehicle _deadbody;
goto "loop";



Offline CapMorgan

  • Members
  • *
  • OFP fan
    • Cazadores de monte
Re:deleting dead guys
« Reply #2 on: 31 Aug 2002, 17:15:51 »
thats really good man!
The problem is that there can be 100 units in the map that i would liko to delete and looping the script can make thing really hard for the cpu. But its a nice solution!
Thanx for the reply.