B-Rett 1 Posted August 2, 2023 I am trying to add the option to save or load respawn loadout in scroll menu when looking at virtual arsenal. So far I used "0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;" on an ammo crate to make a virtual arsenal but it doesn't have options to save as respawn loadout like I have seen others use in custom missions. Google has failed me it keeps bringing me workshop addons for Zeus mode and other things unrelated or not working with Eden. I used the forum search and only saw people talking about respawn loadouts but not scroll options on virtual arsenal for saving and loading. The more detailed your reply the better. I have only just begun fiddling with scripting so any help for me to achieve this and understand / how to understand the scripting is greatly appreciated. Thank you very much for any help! Share this post Link to post Share on other sites
POLPOX 778 Posted August 3, 2023 Please describe what exactly is your goal. We do not really know what save/load system you talk about. If your goal is just add save and/or load action menu into a certain object, it should be very easy. Share this post Link to post Share on other sites
B-Rett 1 Posted August 3, 2023 I want to add two options, "Save as respawn loadout" and "Load respawn loadout". That way you can save an equipped loadout as the loadout you will respawn with and can load the saved loadout if needing to do so before having respawned. I have played custom missions that have virtual arsenals that function this way, I just don't know how to get the extra options and functionality added. With the previously mentioned line of script added i just get a regular virtual arsenal and I can't seem to find anything on how to modify it to do what I described. Share this post Link to post Share on other sites
Harzach 2518 Posted August 3, 2023 For any MP mission you have played, the mission file can be found by default in: C:\Users\<USERNAME>\AppData\Local\Arma 3\MPMissionsCache Using PBO Manager or whatever, you can open it and see what's going on. Share this post Link to post Share on other sites
mrcurry 508 Posted August 5, 2023 On 8/3/2023 at 4:24 PM, B-Rett said: I want to add two options, "Save as respawn loadout" and "Load respawn loadout". That way you can save an equipped loadout as the loadout you will respawn with and can load the saved loadout if needing to do so before having respawned. I have played custom missions that have virtual arsenals that function this way, I just don't know how to get the extra options and functionality added. With the previously mentioned line of script added i just get a regular virtual arsenal and I can't seem to find anything on how to modify it to do what I described. Bit late to the party but to give you a jumping off point, if you wanted to write it all yourself, the code in the spoiler should have all the required pieces just not in the right order. 😉 Spoiler ///////////////////// ////// Actions ////// ///////////////////// // To add an action to an object _object addAction [ "Save respawn loadout", { // Your code goes between these curly brackets } ]; // or _object addAction [ "Save respawn loadout", "folder/someFile.sqf" // Your code goes in this file, path is in reference to your mission folder ]; // There are more parameters in the addAction call, see https://community.bistudio.com/wiki/addAction //////////////////////////// ////// Saving loadout ////// //////////////////////////// // Retrieve the loadout of the player private _loadout = getUnitLoadout player; // Save for duration on a session, loadout is lost on returning to lobby and disconnect. missionNamespace setVariable ["YOURTAG_variableName", _loadout]; // or // Save loadout to player profile, loadout is still available across disconnect and even different missions. profileNamespace setVariable ["YOURTAG_variableName", _loadout]; saveProfileNamespace; // Note: the YOURTAG_variableName is arbitrary but should be unique across whatever domain you use it in to avoid data loss. This is extra important if saving to profile, make it as complex as you need. ///////////////////////////// ////// Loading loadout ////// ///////////////////////////// // Retrieving the loadout from mission data private _loadout = missionNamespace getVariable ["YOURTAG_variableName", []]; // or if reading from profile private _loadout = profileNamespace getVariable ["YOURTAG_variableName", []]; // Check if a loadout exists if( !(_loadout isEqualTo []) ) { // Loading the loadout onto the player player setUnitLoadout [_loadout, true]; // See syntax 2 in https://community.bistudio.com/wiki/setUnitLoadout to see what the "true" parameter does. } ///////////////////////////////////// ////// Running code on respawn ////// ///////////////////////////////////// // For this application a good place for this eventhandler would be inside initPlayerLocal.sqf in your mission's root folder. // If the file doesn't exist you will have to create it. player addEventHandler [ "Respawn", { params ["_unit", "_corpse"]; // see https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Respawn for more info on the parameters // Your code here } ]; /////////////////////////////////////////////////// ////// Running code on virtual arsenal close ////// /////////////////////////////////////////////////// // As a bonus here's how you run code on when the arsenal closes if you wanted to say save loadouts when the player closes the arsenal :) [ missionNamespace, "arsenalClosed", { // Your code here } ] call BIS_fnc_addScriptedEventHandler; Have fun! 2 Share this post Link to post Share on other sites
B-Rett 1 Posted August 12, 2023 On 8/5/2023 at 4:23 AM, mrcurry said: Bit late to the party but to give you a jumping off point, if you wanted to write it all yourself, the code in the spoiler should have all the required pieces just not in the right order. 😉 Reveal hidden contents ///////////////////// ////// Actions ////// ///////////////////// // To add an action to an object _object addAction [ "Save respawn loadout", { // Your code goes between these curly brackets } ]; // or _object addAction [ "Save respawn loadout", "folder/someFile.sqf" // Your code goes in this file, path is in reference to your mission folder ]; // There are more parameters in the addAction call, see https://community.bistudio.com/wiki/addAction //////////////////////////// ////// Saving loadout ////// //////////////////////////// // Retrieve the loadout of the player private _loadout = getUnitLoadout player; // Save for duration on a session, loadout is lost on returning to lobby and disconnect. missionNamespace setVariable ["YOURTAG_variableName", _loadout]; // or // Save loadout to player profile, loadout is still available across disconnect and even different missions. profileNamespace setVariable ["YOURTAG_variableName", _loadout]; saveProfileNamespace; // Note: the YOURTAG_variableName is arbitrary but should be unique across whatever domain you use it in to avoid data loss. This is extra important if saving to profile, make it as complex as you need. ///////////////////////////// ////// Loading loadout ////// ///////////////////////////// // Retrieving the loadout from mission data private _loadout = missionNamespace getVariable ["YOURTAG_variableName", []]; // or if reading from profile private _loadout = profileNamespace getVariable ["YOURTAG_variableName", []]; // Check if a loadout exists if( !(_loadout isEqualTo []) ) { // Loading the loadout onto the player player setUnitLoadout [_loadout, true]; // See syntax 2 in https://community.bistudio.com/wiki/setUnitLoadout to see what the "true" parameter does. } ///////////////////////////////////// ////// Running code on respawn ////// ///////////////////////////////////// // For this application a good place for this eventhandler would be inside initPlayerLocal.sqf in your mission's root folder. // If the file doesn't exist you will have to create it. player addEventHandler [ "Respawn", { params ["_unit", "_corpse"]; // see https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Respawn for more info on the parameters // Your code here } ]; /////////////////////////////////////////////////// ////// Running code on virtual arsenal close ////// /////////////////////////////////////////////////// // As a bonus here's how you run code on when the arsenal closes if you wanted to say save loadouts when the player closes the arsenal :) [ missionNamespace, "arsenalClosed", { // Your code here } ] call BIS_fnc_addScriptedEventHandler; Have fun! Ah yes! Thank you! Not only did you help but you did it in the way I was wanting, a hint in the right direction. Absolute legend. 1 Share this post Link to post Share on other sites