Jump to content
RL - AVE

Player initiated respawn MP Dedi

Recommended Posts

I had a take on implementing a higher risk of loosing force and combat efficiency when taking high risks in our milsim group. The increased risk should push all commanders to vaule the lives of the players througout the gaming session, and to make decisions based on that risk.

This respawn method is one of of many ways to achieve this. 

 

With this script dead players are respawned by other players placing their dead body in a body bag and returning it to a collection point (object named morgue). I plan on using it together with a second method of respawn through Zeus manual mass respawn.

 

Requirements: 

ACE 3 

 

//Editor placed Tarp_01_Large_Yellow_F (morgue). No respawn modules. Empty marker (respawn_west).


//description.ext

Spoiler

 


respawn = 3;
respawnOnStart = 0;
respawnDelay = 1e9;
respawnTemplates[] = {"ace_spectator"};

 

 

 


//init.sqf

Spoiler

 


//BodyBag Respawn
if (isServer) then {
	if (isNull morgue) exitWith {systemChat "Error: Place object named 'morgue' in editor";};
	["ace_placedInBodyBag", {
		params ["_deadGuy", "_bodyBag"];
		private _name = [_deadGuy] call ace_common_fnc_getName;
		_bodyBag setVariable ["BodyName", _name];
	}] call CBA_fnc_addEventHandler;

	[] spawn {
		while {true} do {
			sleep 10;
			private _bags = morgue nearObjects ["ACE_bodyBagObject", 5]; 
			{
				private _bodyBag = _x;
				if (!(_bodyBag getVariable ["processed", false])) then {
					_bodyBag setVariable ["processed", true];
					_name = _bodyBag getVariable ["BodyName", "err"];
					[_name,_bodyBag] remoteExec ["RL_fnc_BodyBagRespawn", -2];
				};
			} forEach _bags;
		};
	};
};

RL_fnc_BodyBagRespawn = {
	params ["_name","_bodyBag"];
	if (profileName isEqualTo _name && !alive player) then {
		_bodyBagPos = getPos _bodyBag;
		_bodyBagDir = getDir _bodyBag;
		setPlayerRespawnTime 0;
		private _bodyBagEmpty = createVehicle ["Land_Bodybag_01_empty_black_F", [0,0,0], [], 0, "NONE"];
		_bodyBagEmpty setDir (_bodyBagDir);
		sleep 2;
		deleteVehicle _bodyBag;
		_bodyBagEmpty setPos _bodyBagPos;
		player setDir (_bodyBagDir+45);
		player setPos _bodyBagPos;
		sleep 0.5;
		[player, 'Acts_UnconsciousStandUp_part1'] remoteExec ['switchMove', 0];
	};
};

 

 

 


Credit to @pabstmirror who got this going at ACE Github! 

Share this post


Link to post
Share on other sites

Updated original post

Edited by RL - AVE

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

×