Jump to content
M. Rust

Save loadout when players walk away from arsenal

Recommended Posts

I want players' loadouts to be saved when they leave the protection zone around their spawn so that when they respawn they have the loadout they created at the beginning of the mission. I know I need bis_fnc_saveInventory and then bis_fnc_loadInventory inside onPlayerRespawn.sqf but I don't know how to get the protection zone to save the inventory. I saw a video of this a looong time ago but I can't remember how to do it. If anyone knows of a video for it that would be appreciated.

Share this post


Link to post
Share on other sites

Not sure what bis_fnc_saveInventory does but with a wild guess I'd say do a repeatable trigger on the safezone where 'onExit' executes bis_fnc_saveInventory or something along these lines.

Share this post


Link to post
Share on other sites

If you use BIS virtual arsenal here the trick: in mission folder create two files initPlayerLocal.sqf and onPlayerRespawn.sqf.

 

In initPlayerLocal.sqf file write and save:

if ((!isServer) && (player != player)) then {waitUntil {player == player};};

//save loadout

[missionNamespace, "arsenalClosed", {      

      player setVariable ["Saved_Loadout",getUnitLoadout player];

}] call BIS_fnc_addScriptedEventHandler;

 

In onPlayerRespawn.sqf file write and save:

player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);

 

Profit

  • Like 2

Share this post


Link to post
Share on other sites

Perfect that's even better! Worked like a charm! Was setting up a mission for a clan I'm in and we use specific loadouts and need everyone to keep whatever they pick at mission start. Thanks baton!

Share this post


Link to post
Share on other sites

Use this, it should work better.

 

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

 

Then when player respawns, they keep their loadout like this.

 

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

 

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

×