Jump to content
Sign in to follow this  
jw custom

Howto delete your dead body after respawn?

Recommended Posts

I tried doing it from a "killed" eventhandler and from a script with

_unit = _this select 0;

WaitUntil{not alive player};

deleteVehicle _unit;

But it doesn't work!

Would also be nice if all gear would get deleted.

Share this post


Link to post
Share on other sites

Remove the not from the second line and it should hopefully delete the corpse after the player respawns.

The killed EH triggered because the unit was killed, you should not wait until a dead unit is dead, unless you have alot of time.. :hmmm:

Share this post


Link to post
Share on other sites

I tried these things seperately not combined.

If i have this...

_unit = _this select 0;

WaitUntil{alive player};

deleteVehicle _unit;

...in a script the deleteVehicle line will get execute while player is alive!

I can't seem to delete the body but i can move it and delete it's weapons and thats good enough for me as i can move it to a remote place where i can do a nearestObject thing i think.

Share this post


Link to post
Share on other sites

to the init of the unit

this addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

create a text file "removeBody.sqf" in the mission's folder...

sleep 30;
hideBody _this;  //or hideBody _this select 0;
sleep 10;
deleteVehicle _this;

edit..strangely hidebody animation does not show unless its sleep 30 ...

Edited by Cross
  • Like 1

Share this post


Link to post
Share on other sites
to the init of the unit

this addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];

create a text file "removeBody.sqf" in the mission's folder...

sleep 30;
hideBody _this;  //or hideBody _this select 0;
sleep 10;
deleteVehicle _this;

Thanks that worked fine :)

I see you changed sleep 20 to sleep 30. So i guess that the trick is to give the body a little time then hide it and then delete it!

Share this post


Link to post
Share on other sites

The default spawn time is ~30 seconds and you cannot delete the player.

With 20+10 seconds sleep the player probably still had control of the old body when the delete was attempted.

Much better solution than sleep is waitUntil {alive player}; in this case. It makes it independent on mission's respawn time.

waitUntil {alive player} //Wait for player to respawn
hideBody _this;
sleep 10;
deleteVehicle _this;

It might be also possible that hideBody automatically deletes the body after sinking it too. Worth testing :)

Edited by Deadfast

Share this post


Link to post
Share on other sites
The default spawn time is ~30 seconds and you cannot delete the player.

With 20+10 seconds sleep the player probably still had control of the old body when the delete was attempted.

Much better solution than sleep is waitUntil {alive player}; in this case. It makes it independent on mission's respawn time.

waitUntil {alive player} //Wait for player to respawn
hideBody _this;
sleep 10;
deleteVehicle _this;

It might be also possible that hideBody automatically deletes the body after sinking it too. Worth testing :)

Thanks for the input. Now i see what heatseeker was talking about :)

Share this post


Link to post
Share on other sites

I assume this does not remove the AI ... only players then

Share this post


Link to post
Share on other sites
I assume this does not remove the AI ... only players then

True, but that fine as the AI doesn't respawn and keeps throwing bodies around :p

Share this post


Link to post
Share on other sites

How about this? :D

if (isPlayer _this) then
{
waitUntil {alive player} //Wait for player to respawn
hideBody _this;
sleep 10;
deleteVehicle _this;
}
else
{
sleep 30;
hideBody _this;
sleep 10;
deleteVehicle _this;
};

Share this post


Link to post
Share on other sites
How about this? :D

if (isPlayer _this) then
{
waitUntil {alive player} //Wait for player to respawn
hideBody _this;
sleep 10;
deleteVehicle _this;
}
else
{
sleep 30;
hideBody _this;
sleep 10;
deleteVehicle _this;
}

Nice :cool: but in this case i would like bodies from permanent dead units to stay :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×