OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: singhman on 06 Nov 2007, 19:04:14

Title: removing dead bodies works ONCE
Post by: singhman on 06 Nov 2007, 19:04:14
Hi guys
I've read several posts regarding the killed eventhandler and have incorporated it into my multiplayer mission

it only seems to work ONCE?!

the body gets deleted on all computers as required but then after the unit dies again, the bodies refuse to disappear
I have no idea how to fix this
I'm currently using this in my unit init lines:

this addeventhandler ["killed", {_this exec "deadbody.sqs"}]

and then deadbody.sqs:

; Select the Unit
_unit = _this select 0
;-Delay the delete after death
~6
; finally delete the vehicle
deletevehicle _unit
~1
exit

Is there any way to get this working again and again? I haven't seen anyone with my problem on the forum.
Oh and btw, the dead body does not disappear even on the computer controlling the unit that started the deadbody.sqs.

Sorry if I've made a mistake posting - this is my first post...
Title: Re: removing dead bodies works ONCE
Post by: Denz on 06 Nov 2007, 19:43:50
I don't know much about MP scripting but wouldn't it be better to run it from a trigger?
Code: [Select]
this addeventhandler ["killed", {_this exec "deadbody.sqs"}] foreach thislist
You need to have it in the init.sqs to have it execute on all computers.
Something like
Code: [Select]
?(local server): [] exec "deadbody.sqs"