Arma 3
Not enough ratings
(Tutorial / Guide) Slay's Basic Character Saving
   
Award
Favorite
Favorited
Unfavorite
Data Type: Scenario
Scenario Gameplay: Multiplayer, Coop, Persistent
Scenario Type: Infantry
Scenario Map: Altis
File Size
Posted
9.609 KB
12 Sep, 2023 @ 7:57pm
1 Change Note ( view )

Subscribe to download
(Tutorial / Guide) Slay's Basic Character Saving

Description
This mission is meant to act as a learning tool for new mission makers or old alike.

It simply saves the characters gear and position and reloads them on login WITHOUT needing extra mods.

Feel free to edit the scripts and use them however as it's basically made of wiki examples.




Github Download: https://github.com/Elvensbane/Slay-s-Basic-Character-Saving.Altis





To create a save system for your own mission do the following:

Step 1:
Create a file called Descriptions.ext in the root of your mission, or modify an existing one.
Then add this line:
onPauseScript = "save.sqf"; //starts the script which saves on the pause screen.


Step 2:
Then create a file called "save.sqf" by creating a new text document in the same folder as description.ext and renaming the file extension to .sqf.
Inside of save.sqf put the following:
_getworldpos = getPosWorld player; _getloadout = getUnitLoadout player; profileNamespace setVariable ["saved_pos",_getworldpos]; profileNamespace setVariable ["saved_loadout",_getloadout]; systemChat "Saving Position"; systemChat "Saving Loadout"; playsound "additemok";


Step 3:
Then create a file called "reload.sqf" by creating a new text document in the same folder as description.ext and renaming the file extension to .sqf.
Inside of reload.sqf put the following:
waitUntil {!isNull findDisplay 46}; _getworldpos = profileNamespace getVariable ["saved_pos",0]; _getloadout = profileNamespace getVariable ["saved_loadout",0]; if ((_getworldpos isEqualTo "") || (_getworldpos isEqualTo 0)) then { systemChat "No previous saved position located."; } else { player setPosWorld _getworldpos; player setDir random (360); systemChat "Reloading player position."; }; if ((_getloadout isEqualTo "") || (_getloadout isEqualTo 0)) then { systemChat "No previous loadout located."; } else { player setUnitLoadout _getloadout; systemChat "Reloading player loadout."; };


Step 4:
Then create a file called "initplayerlocal.sqf" by creating a new text document in the same folder as description.ext and renaming the file extension to .sqf or modify an existing one.
Add the following:
params ["_player", "_didJIP"]; ["reload.sqf"] remoteExecCall ["BIS_fnc_execVM", _player]; //this does the reload script after the player got their account saved from the pause screen.


Step 5:
Then inside of your init.sqf put the following at the top:
enableSaving [false,false]; //stops the mission from saving, not really needed for the stuff I'm trying to show you guys here.









If you enjoyed this release / guide please check out what I consider to be my "magnum opus", which is my Arma 3 DayZ-Esque Survival Server, links below.

Slay's Ravage Official Server Mod-pack info + Video Link + Discord Link.