Jump to content
Violt

Keep custom loadouts on respawn

Recommended Posts

Hey guys, 

 

Me and a friend of mine are working on an Arma 3 Mil-Sim Community with a lot of mods. 

So we are working on custom loadouts atm. 

So when you die you don't get the loadout you spawned with. 

We used to have a script when you died you keep the loadout you had when you died including the amount of ammo but we don't want that.

So how do we make it so if you die you respawn with the exact loadout you were given from start and not the loadout you died with.

 

 

Kind Regards, 

Violt

Share this post


Link to post
Share on other sites
1 hour ago, KokaKolaA3 said:

 

Hey thanks, but this gives you the inventory you died with right? 

Not the inventory you spawned with...

Share this post


Link to post
Share on other sites

I'm not sure, as far as I read through it, it gives you your inventory back that you spawned with, just give it a try.

Share this post


Link to post
Share on other sites

Create 2 files in your mission root

 

1 named onplayerkilled.sqf

 

contains

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

second file named onplayerrespawn.sqf

contains

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

 

  • Like 1

Share this post


Link to post
Share on other sites

@Doctor-Vanilla he wants to equip the gear he had when starting the mission not the one he had when he died.

this should work:
in your initplayerlocal.sqf (create it if you don't have one)
 

_storeGear = getUnitLoadOut player;
uiNameSpace setVariable ["StoredUnitLoadOut", _storeGear];

in your onplayerrespawn.sqf
 

player setUnitLoadOut [(uiNameSpace getVariable "StoredUnitLoadOut"),true];

the "true" means that ammo will be replenished, change to false if you don't want that.

  • Like 1

Share this post


Link to post
Share on other sites
On 4/12/2018 at 6:58 PM, Mr H. said:

@Doctor-Vanilla he wants to equip the gear he had when starting the mission not the one he had when he died.

this should work:
in your initplayerlocal.sqf (create it if you don't have one)
 


_storeGear = getUnitLoadOut player;
uiNameSpace setVariable ["StoredUnitLoadOut", _storeGear];

in your onplayerrespawn.sqf
 


player setUnitLoadOut [(uiNameSpace getVariable "StoredUnitLoadOut"),true];

the "true" means that ammo will be replenished, change to false if you don't want that.

Thanks i'll test out later! 

 

I have setup more than one Spawn points so lets say Air Force Base and Army Base. 

Does that work with it? 

  • Like 1

Share this post


Link to post
Share on other sites

yes, where you respawn doesn't matter

 

  • Like 1

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

×