Jump to content
Sign in to follow this  
jaynic

Vanilla Revive System and saving unit loadouts

Recommended Posts

Hey all,

 

I've built a script that handles the saving and loading of gear on player death and respawn. I utilize the setUnitLoadout, and getUnitLoadout functions to do this. 

 

eg:

 

//init
player addEventHandler ["Killed", {
    ["respawnLoadout\save"] call JNMP_x;
}];
//When they respawn - all we need to do is load their loadout
player addEventHandler ["Respawn", {
	["respawnLoadout\load"] call JNMP_x;
}];
//end init



//save.sqf
//Check that the respawn loadout system is active for the given player
if(_respawnWithPriorLoadout) then {
	profileNamespace setVariable ["JNMP_respawnLoadout", getUnitLoadout player];
};
//end save


//load.sqf
if(_respawnWithPriorLoadout) then {
	//Save it to our profile variable
	_loadout = profileNamespace getVariable ["JNMP_respawnLoadout",nil];
	
	if!(isNil "_loadout") then {
		if(typeName _loadout == "ARRAY") then {
			player setUnitLoadout _loadout;
		};
	};
};
//end load

But here's the funky problem... When I use the default revive system: the player enters a revive state, and drops his weapon. Therefore if he dies in this state: he respawns without his gun...

 

Any ideas on how I can record his gear prior to him losing his gun?

I can't find any event handlers in the system for players entering the incapped state...

Share this post


Link to post
Share on other sites

Having the same problem. Spent hours and hours trying to make something work. Unit always respawns without rifle because the loadout isn't saved until after he has dropped his rifle when using vanilla revive. Hope someone on here can help.

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  

×