Jump to content
chauvinista

Deleting dead bodies after respawn

Recommended Posts

I am working on MP mission with respawn but when someone respawn, their corpse stays where he died.

Also Arma 2 scripts doesn't seem to be working :confused:

Thanks for any help

Share this post


Link to post
Share on other sites
I am working on MP mission with respawn but when someone respawn, their corpse stays where he died.

Also Arma 2 scripts doesn't seem to be working :confused:

Thanks for any help

Stick this in your int.sqf
// Add a Multi-player Eventhandler  'MPEventHandler' when the Player dies.
player addMPEventHandler ["MPRespawn", {_this spawn FNC_Del_Corpse;}];

// Now delete Player's old dead body and gear on respawn in a puff of smoke.
FNC_Del_Corpse = {_unit = _this select 1;
	_pos = getPos _unit;_xpos = _pos select 0;_ypos = _pos select 1;
	_zpos = _pos select 2;sleep 0.3;for "_i" from 0 to 3 do {_xvel = 0;_yvel = 0;_zvel = 0;_tnt = 0;
	drop[["A3\Data_F\ParticleEffects\Universal\universal.p3d",16,7,48],"","Billboard",0,1 + random 0.5,[_xpos,_ypos,_zpos],
	[_xvel,_yvel,_zvel],1,1.2,1.3,0,[2],[[0.55,0.5,0.45,0],[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45,0.16],
	[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45, 0.12],[_tnt + 0.5,_tnt + 0.45,_tnt + 0.4,0.08],
	[_tnt + 0.45,_tnt + 0.4,_tnt + 0.35,0.04],[_tnt + 0.4,_tnt + 0.35,_tnt + 0.3,0.01]],[0],0.1,0.1,"","",""];};
deleteVehicle _unit;};

And of course ArmA2 scripts don't work in ArmA3.. New engine, new code, new features.. and of course removal of obsolete features..

Share this post


Link to post
Share on other sites
Stick this in your int.sqf
// Add a Multi-player Eventhandler  'MPEventHandler' when the Player dies.
player addMPEventHandler ["MPRespawn", {_this spawn FNC_Del_Corpse;}];

// Now delete Player's old dead body and gear on respawn in a puff of smoke.
FNC_Del_Corpse = {_unit = _this select 1;
	_pos = getPos _unit;_xpos = _pos select 0;_ypos = _pos select 1;
	_zpos = _pos select 2;sleep 0.3;for "_i" from 0 to 3 do {_xvel = 0;_yvel = 0;_zvel = 0;_tnt = 0;
	drop[["A3\Data_F\ParticleEffects\Universal\universal.p3d",16,7,48],"","Billboard",0,1 + random 0.5,[_xpos,_ypos,_zpos],
	[_xvel,_yvel,_zvel],1,1.2,1.3,0,[2],[[0.55,0.5,0.45,0],[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45,0.16],
	[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45, 0.12],[_tnt + 0.5,_tnt + 0.45,_tnt + 0.4,0.08],
	[_tnt + 0.45,_tnt + 0.4,_tnt + 0.35,0.04],[_tnt + 0.4,_tnt + 0.35,_tnt + 0.3,0.01]],[0],0.1,0.1,"","",""];};
deleteVehicle _unit;};

And of course ArmA2 scripts don't work in ArmA3.. New engine, new code, new features.. and of course removal of obsolete features..

^ That did the trick. Thank you very much

Share this post


Link to post
Share on other sites
On 8/13/2014 at 9:54 PM, Beerkan said:

Stick this in your int.sqf


// Add a Multi-player Eventhandler  'MPEventHandler' when the Player dies.
player addMPEventHandler ["MPRespawn", {_this spawn FNC_Del_Corpse;}];

// Now delete Player's old dead body and gear on respawn in a puff of smoke.
FNC_Del_Corpse = {_unit = _this select 1;
	_pos = getPos _unit;_xpos = _pos select 0;_ypos = _pos select 1;
	_zpos = _pos select 2;sleep 0.3;for "_i" from 0 to 3 do {_xvel = 0;_yvel = 0;_zvel = 0;_tnt = 0;
	drop[["A3\Data_F\ParticleEffects\Universal\universal.p3d",16,7,48],"","Billboard",0,1 + random 0.5,[_xpos,_ypos,_zpos],
	[_xvel,_yvel,_zvel],1,1.2,1.3,0,[2],[[0.55,0.5,0.45,0],[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45,0.16],
	[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45, 0.12],[_tnt + 0.5,_tnt + 0.45,_tnt + 0.4,0.08],
	[_tnt + 0.45,_tnt + 0.4,_tnt + 0.35,0.04],[_tnt + 0.4,_tnt + 0.35,_tnt + 0.3,0.01]],[0],0.1,0.1,"","",""];};
deleteVehicle _unit;};
 

 

And of course ArmA2 scripts don't work in ArmA3.. New engine, new code, new features.. and of course removal of obsolete features..

I know this is a serious necro post but any help would be greatly apprieciated.

I got this to work through testing in eden editor but on my dedicated server it doesn't do anything? Could someone help with it please?

Share this post


Link to post
Share on other sites

onPlayerRespawn.sqf:

params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
deleteVehicle _oldUnit;

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, Dramacius said:

I got this to work through testing in eden editor but on my dedicated server it doesn't do anything? Could someone help with it please?

 

Normal. There is no player on dedicated server. Use the code @Harzach wrote for onPlayerRespawn.sqf you can add in your mission root folder, or use the missionEventHandler "entityRespawned"

If I'm right, onPlayerRespawn.sqf will fire locally (player's PC).

missionEventHandler "entityRespawned" is also LE (local effect). So, even if you place it in init.sqf, only the respawned player's PC will run the code, even if the MEH is present on all PCs.

That means a little difference. You can have respawning AIs (when AIs are playable but not played). onPlayerRespawn.sqf will not fire for these AIs, but MEH will.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, pierremgi said:

 

Normal. There is no player on dedicated server. Use the code @Harzach wrote for onPlayerRespawn.sqf you can add in your mission root folder, or use the missionEventHandler "entityRespawned"

If I'm right, onPlayerRespawn.sqf will fire locally (player's PC).

missionEventHandler "entityRespawned" is also LE (local effect). So, even if you place it in init.sqf, only the respawned player's PC will run the code, even if the MEH is present on all PCs.

That means a little difference. You can have respawning AIs (when AIs are playable but not played). onPlayerRespawn.sqf will not fire for these AIs, but MEH will.

 

 

Thank you for replying unfortunately I only understood about half of your reply.

Am I able to put the code in a different file or edit it to work for a dedicated server or a combination of changes to make it work or is it just not possible?

Again, thank you for taking the time to reply.

Share this post


Link to post
Share on other sites

All you need to do is exactly as I posted.

 

18 hours ago, Harzach said:

onPlayerRespawn.sqf:


params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
deleteVehicle _oldUnit;

 

 

So, create the file "onPlayerRespawn.sqf" in your mission's root folder, and paste that code snippet in it.

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

×