gc8 970 Posted August 8, 2018 Hi does dedicated server have anything like profileNamespace where you can save stuff? Or can you save anything to server at all without mod to do it? thx! Share this post Link to post Share on other sites
gokitty1199 225 Posted August 8, 2018 4 hours ago, gc8 said: Hi does dedicated server have anything like profileNamespace where you can save stuff? Or can you save anything to server at all without mod to do it? thx! to save anything to keep it persistent you need something like inidbi or extdb 1 Share this post Link to post Share on other sites
davidoss 550 Posted August 9, 2018 you can save to profileNameSpace on server using variables and its values. profileNameSpace setVariable ["myVariable",_myData]; saveProfileNamespace; Share this post Link to post Share on other sites
gc8 970 Posted August 9, 2018 @davidoss really, that great! one question though, why I don't ever have to call saveProfileNamespace on client? my vars are saved without that call Share this post Link to post Share on other sites
davidoss 550 Posted August 9, 2018 Every client and server has its own profilenamespace Most likely the saveProfileNamespace makes changes persistence in the <USERNAME>.vars.Arma3Profile 1 Share this post Link to post Share on other sites
gc8 970 Posted August 9, 2018 Hmm it says in wiki "Variables are also saved when the game is quit." Share this post Link to post Share on other sites
gokitty1199 225 Posted August 9, 2018 are we talking about saving variables even after a server restart? Share this post Link to post Share on other sites
gc8 970 Posted August 9, 2018 8 minutes ago, gokitty1199 said: are we talking about saving variables even after a server restart? That's what I'm talking about Share this post Link to post Share on other sites
gokitty1199 225 Posted August 9, 2018 12 minutes ago, gc8 said: That's what I'm talking about if its after a server restart im 99% sure you need to use inidbi or extdb Share this post Link to post Share on other sites
davidoss 550 Posted August 9, 2018 its not true here are example how i am saving hostile areas to the vars file of dedicated server Spoiler /* File: PNDI_fnc_handleSave Author: DaVidoSS Description: saves current status to profileName vars Parameter(s): 0: array 1: array Returned value: none */ if !(isServer) exitWith {}; params [["_positions",[],[[]]],["_markers",[],[[]]]]; private _currentPosArray = +_positions; private _positionToRem = []; while {true} do { sleep 200; { if ((getMarkerColor _x) == "colorBLUFOR") then { _positionToRem = (getMarkerPos _x); _currentPosArray = _currentPosArray - _positionToRem; }; }forEach _markers; if !(_positions isEqualTo _currentPosArray) then { profileNameSpace setVariable ["pndi_oaPositions",_currentPosArray]; saveProfileNamespace; }; }; LOAD private _oaPositions = (profileNameSpace getVariable ["pndi_oaPositions", [[1327.87,13596.4,0],[5109.86,11411.2,0],[5912.54,12579,0],[6106.41,14062.6,0],[8243.81,12500.4,0],[11231.6,15098.7,0],[12116.7,11042.4,0],[12928.8,14183.8,0], [13646.2,16360.9,0],[14831.4,17592.8,0],[14895.3,13987.8,0],[15463.9,18922.6,0],[16870,17377.3,0],[17337,11577.9,0],[1568.17,7066.11,0],[1758.73,9887.6,0],[2319.95,6035.5,0], [2368.26,2452,0],[4842.83,5517.03,0],[5841.95,4280.54,0],[6227.23,6943.49,0],[7073.26,3876.8,0],[7445.68,7465.07,0],[8103.22,8748.67,0],[9677.44,9646.21,0],[10205.1,1516.48,0], [10314.2,6382.8,0],[10420.5,4401.26,0],[10646.2,7606.12,0],[12293.9,9648.67,0],[13240.3,1801.65,0],[15784.2,4485.47,0],[16661.5,2168.45,0],[17565.3,4802.48,0]] ]); private _oaMarkers = [_oaPositions] call PNDI_fnc_createOaMarker; 0 = [_oaMarkers] spawn PNDI_fnc_spawnEnemyHandle; 0 = [_oaPositions,_oaMarkers] spawn PNDI_fnc_handleSave; i can then kill the server turnof machine and start again some day after and load the mission with saved data. Share this post Link to post Share on other sites
7erra 629 Posted August 9, 2018 You can permanently save your stuff to the profileNamespace of the server at the cost of increasing the size of the .vars file: Quote Warning: saving a lot of data can quickly increase the size of the profile variables file, so keep an eye on this. I don't know why the size is of this file should be a problem. Maybe it increases the load time of the game? saveProfileNamespace should be called whenever you change a variable in the profileNamespace. This prevents data loss in the event of a game crash. Don't do it too frequently though: Quote Warning: this is a file operation, which makes it expensive! It is not recommended to do this at a high frequency in a loop for example. It is however also recommended not to change a large amount of variables and wait long before saving, because certain game crashes may cause a loss of data. 1 Share this post Link to post Share on other sites
damsous 329 Posted September 26, 2018 Hi there is a simple way to save and load everything on a mission running on dedicated server, for exemple trigger status, AI unit.... like a SP save on server restart ? For exemple with an addaction on an object at base to save everything before restart the server using saveProfileNamespace ? Didn't care if the save file is big or if it take times to load.... Share this post Link to post Share on other sites
HazJ 1288 Posted September 26, 2018 You don't really want to save triggers or AI units. You would save AI count for example then upon init of mission, you would spawn X AI units. Etc... Example from Authority Dev Tools: _save ctrlAddEventHandler ["ButtonClick", { _code = ctrlText ((uiNamespace getVariable "disp_devTools") displayCtrl IDC_DEVTOOLS_INPUT); _newSavedCode = []; _newSavedCode pushBack _code; if (!isNil {profileNamespace getVariable "savedCode"}) then { _newSavedCode append (profileNamespace getVariable "savedCode"); }; hintSilent str _newSavedCode; profileNamespace setVariable ["savedCode", _newSavedCode]; }]; This uses button click to say code history but you should get the idea. For this, I use it on client-side but depending on what you want to save, you may need to use it on server. Just remember that it is local to each server profile. It is also possible to delete data from .vars by setting it to nil. Very basic examples. Not tested! // save if (!isServer) exitWith {}; profileNamespace setVariable ["enemyAO_numAI", 15]; // load _enemyCount = if (!isNil {profileNamespace getVariable "enemyAO_numAI"}) then {profileNamespace getVariable "enemyAO_numAI"} else {100}; // create enemy AI // 100 new AO for "_i" from 0 to _enemyCount do { // createUnit, etc... }; 1 Share this post Link to post Share on other sites
Larrow 2799 Posted September 26, 2018 I find it is always a good idea to save what ever you need to a profileNamespace under an array that holds all your data. For instance... #define DATA_POS 0 #define DATA_XP 1 #define DATA_MONEY 2 profileNamespace setVariable[ format[ "%1_%2_playerData", missionName, worldName ], [ getPosATLVisual player, player getVariable[ "XP", 0 ], player getVariable[ "Money", 0 ] ]]; //If you need to update a single data value e.g XP _playerData = profileNamespace getVariable[ format[ "%1_%2_playerData", missionName, worldName ], [] ]; _playerData set[ DATA_XP, player getVariable[ "XP", 0 ] ]; This way if you ever need to clear out the data you only ever need to nil one value. If a user ever wants to clean out his vars they only ever have to nil out one value. That is named appropriately so the player knows what it is, it has a missionName, the world name and that it is playerData. So there is no need to go searching for possibly tens of single variables stored throughout the profileNamespace. This also has the added benefit of allowing multiple versions of your mission across various worlds and mission names to be saved without interfering with each other. You could even provide the user a means to do this from your mission/addon via a UI or some other means. 1 3 Share this post Link to post Share on other sites