Dodge

Eject dead bodies from dead vehicles

6 posts in this topic

The current method of ejecting dead bodies from a vehicle works by adding actions "GetOut" and "Eject" to the player when it dies, this works fine as long as the vehicle is alive, if the vehicle is dead then actions  "GetOut" and "Eject" no longer work.

to go around this problem i modified the ExileClient_object_player_event_onKilled.sqf as follow:

look for:

if !((vehicle player) isEqualTo player) then
{
	unassignVehicle player; 
	player action ["GetOut", vehicle player]; 
	player action ["Eject", vehicle player];
};

and add this after:

//double checks if player still in a vehicle, happens sometimes in cases like dead vehicles.
if !((vehicle player) isEqualTo player) then  
{ 
	_pX = floor random -5; 
	_pY = floor random -5; 
	_position = vehicle player modelToWorld [_pX,_pY,0]; 
	player setpos _position; 
};

will look like this after:

if !((vehicle player) isEqualTo player) then
{
	unassignVehicle player; 
	player action ["GetOut", vehicle player]; 
	player action ["Eject", vehicle player];
};
//double checks if player still in a vehicle, happens sometimes in cases like dead vehicles.
if !((vehicle player) isEqualTo player) then  
{ 
	_pX = floor random -5; 
	_pY = floor random -5; 
	_position = vehicle player modelToWorld [_pX,_pY,0]; 
	player setpos _position; 
};

save the ExileClient_object_player_event_onKilled.sqf into what ever folder you have your overwrites on your local mission folder.

Ex. "overwrites\exile_client\code"

open your config.cpp, located on the mission root folder, look for the class "CfgExileCustomCode" and add this line inside:

ExileClient_object_player_event_onKilled = "overwrites\exile_client\code\ExileClient_object_player_event_onKilled.sqf"

i made the positions random around the vehicle in case multiple players die inside and all bodies are not piled all on top of another.

Hope someone finds this useful.



 

Share this post


Link to post
Share on other sites

I actually did this myself also, the problem that you haven't accounted for is the fact that when setting the position of the player you should be using their old Z as this will effectively teleport them into the ground ;) here's my current version which accounts for this but it also accounts for the side of the vehicle the were on also so you don't get bodies piling up on one another with hard-coded position or randomized however that is only really relevant for ground vehcles.

https://puu.sh/uAF8c/76899b836e.txt

NOTE: This does require a alteration to the death marker battleye filter in scripts.txt, there was some strange behaviour when trying to get the position of player for the marker resulting in it not being created atall.

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

@KamikazeXeX the way im using it now instead of the z is in case your vehicle explodes in the air and the body will teleport into the ground instead of the air. is funny seeing the body fall from the air

as far as battleye yeah you are correct but since we run a close server for friends only battleye is disabled.

@Beowulfv i think i looked into that but the cleanup if i remember correct tides both vehicles and dead bodies at the same time.

well at least im not the only one that found annoying not able to get dead bodies out of vehicles :P

thank you 

Share this post


Link to post
Share on other sites
5 hours ago, Dodge said:

@KamikazeXeX the way im using it now instead of the z is in case your vehicle explodes in the air and the body will teleport into the ground instead of the air. is funny seeing the body fall from the air

as far as battleye yeah you are correct but since we run a close server for friends only battleye is disabled.

@Beowulfv i think i looked into that but the cleanup if i remember correct tides both vehicles and dead bodies at the same time.

well at least im not the only one that found annoying not able to get dead bodies out of vehicles :P

thank you 

We had some very funny and equally annoying situations occur from the teleporting to the ground, man players ended up with bodies inside bases, rocks, in-accessible buildings etc, just a heads up since the falling would be default behaviour in the even that the eject and get out actions worked on dead units, (its the player being dead that's the issue wit the command not working).

The BattelEye changes are only needed for my version though :) will edit my reply later with the change in case anyone wants the "falling" behaviour.

The problem of bodies being stuck in vehicles did get very frustrating for a while, admins having to log in just to get bodies out of cars etc was a pain :P

Either way good post! I haven't been in my code for so long I neglected to post the fix sooner :P

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.