Jump to content

Recommended Posts

Hello, I was wondering if there was the possibility of getting a variable to be persistent through a mission restart.

I want the player's inventory to be saved and then reloaded when connecting back.

Any ideas?

Share this post


Link to post
Share on other sites
// save loadout
profileNamespace setVariable ["PlayerLoadout", getUnitLoadout player];

// restore loadout
profileNamespace getVariable "PlayerLoadout" call {player setUnitLoadout _this};

// reset loadout
profileNamespace setVariable ["PlayerLoadout", nil];

 

Share this post


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

// save loadout
profileNamespace setVariable ["PlayerLoadout", getUnitLoadout player];

// restore loadout
profileNamespace getVariable "PlayerLoadout" call {player setUnitLoadout _this};

// reset loadout
profileNamespace setVariable ["PlayerLoadout", nil];

 

Thanks for the usage. This actually clears up some problems I had been running into, I appreciate both of your help.

Share this post


Link to post
Share on other sites
2 hours ago, serena said:

// save loadout
profileNamespace setVariable ["PlayerLoadout", getUnitLoadout player];

// restore loadout
profileNamespace getVariable "PlayerLoadout" call {player setUnitLoadout _this};

// reset loadout
profileNamespace setVariable ["PlayerLoadout", nil];

 

 

3 hours ago, froggyluv said:

Upon loading in, the player doen't have the weapon saved upon disconnect.

Any ideas? The player acts like he has a gun at first, then puts away i'd say an 'invisible gun' ? 

Share this post


Link to post
Share on other sites

Are you sure that:

  1. Your gear have been saved before you disconnect (commands are executed properly and profile namespace contains saved data)
  2. Saved data extracted and applied when you resume mission (commands are executed properly and profile namespace contains saved data)

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

×