The Black Fox 4 Posted March 1, 2019 Where do I put this function in a script or the editor, and what are the possible syntaxes? Can it be placed in the init section of a unit within the editor? Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory It should work in the init where the target will be this: [this, "CfgRespawnInventoryClass"] call BIS_fnc_addRespawnInventory; The "CfgRespawnInventoryClass" has to be defined in the CfgRespawnInventory section of the description.ext Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 6 minutes ago, 7erra said: https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory It should work in the init where the target will be this: [this, "CfgRespawnInventoryClass"] call BIS_fnc_addRespawnInventory; The "CfgRespawnInventoryClass" has to be defined in the CfgRespawnInventory section of the description.ext Can I call a script to equip items when a unit respawns? Because onPlayerRespawn.sqf does not seem to work. I had it working before but it's not working now. Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 7 minutes ago, 7erra said: https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory It should work in the init where the target will be this: [this, "CfgRespawnInventoryClass"] call BIS_fnc_addRespawnInventory; The "CfgRespawnInventoryClass" has to be defined in the CfgRespawnInventory section of the description.ext Also, is there a CfgRespawnInventory generator? Because adding the items one by one by hand is REALLY time consuming especially if there are a lot of playable units. Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 The function doesnt equip items it just adds the option to select the inventory on the respawn screen. If you want to add an inventory you can use either setUnitLoadout or BIS_fnc_loadInventory You can export an inventory from the Arsenal with CTRL+SHIFT+C and then paste the content into the appropiate section of the description.ext: https://community.bistudio.com/wiki/Arma_3_Respawn https://community.bistudio.com/wiki/Arma_3_Arsenal#Export_to_CPP Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 1 minute ago, 7erra said: setUnitLoadout Alright, the wiki doesn't give me enough info for this. Say I have a 10 unit OPFOR squad. I'm using units from the unit browser. I've already edited their loadouts, and I have to set an inventory for each unit so when they die and respawn they have that stuff again. How would I, someone who's been using the editor for less than 24 hours, make it so that my edited loadout is equipped on respawn? Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 7 minutes ago, 7erra said: Arsenal with CTRL+SHIFT+C and then paste the content into the appropiate section of the description.ext So the LoadoutClasses.inc would not be needed, or could I paste it in there instead? Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 in the init of the units: _loadout = getUnitLoadout this; this setVariable ["unitLoadoutRespawn",_loadout]; this addEventhandler ["Respawn",{ params ["_unit", "_corpse"]; _loadout = _corpse getVariable ["unitLoadoutRespawn",[]]; _unit setUnitLoadout _loadout; _unit setVariable ["unitLoadoutRespawn",_loadout]; }]; Might work Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 2 minutes ago, The Black Fox said: LoadoutClasses.inc err not sure what that is but if you want to put it in a different file then you have to include the content in the descritpion.ext with the #include command (not really mandatory). There is an example https://community.bistudio.com/wiki/Arma_3_Respawn under Loadouts and Roles. Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 19 minutes ago, 7erra said: in the init of the units: _loadout = getUnitLoadout this; this setVariable ["unitLoadoutRespawn",_loadout]; this addEventhandler ["Respawn",{ params ["_unit", "_corpse"]; _loadout = _corpse getVariable ["unitLoadoutRespawn",[]]; _unit setUnitLoadout _loadout; _unit setVariable ["unitLoadoutRespawn",_loadout]; }]; Might work thanks you, i will try that. With the CTRL+SHIFT+C, where would I paste the output? My squad leader looks like this: // Exported from Arsenal by Tiger uniform = "U_O_CombatUniform_ocamo"; backpack = "B_TacticalPack_ocamo"; weapons[] = {"arifle_Katiba_GL_F","hgun_Rook40_F","Rangefinder","Throw","Put"}; magazines[] = {"SmokeShell","SmokeShell","MiniGrenade","MiniGrenade","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","UGL_FlareWhite_F","30Rnd_9x21_Mag","30Rnd_9x21_Mag"}; items[] = {"FirstAidKit","FirstAidKit"}; linkedItems[] = {"V_TacVest_khk","H_HelmetSpecO_ocamo","G_Balaclava_TI_blk_F","ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGogglesB_blk_F"}; Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 21 minutes ago, 7erra said: in the init of the units: _loadout = getUnitLoadout this; this setVariable ["unitLoadoutRespawn",_loadout]; this addEventhandler ["Respawn",{ params ["_unit", "_corpse"]; _loadout = _corpse getVariable ["unitLoadoutRespawn",[]]; _unit setUnitLoadout _loadout; _unit setVariable ["unitLoadoutRespawn",_loadout]; }]; Might work I am getting an error when pasted into Object: Init Error: Local variable in global space. Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 (edited) 19 hours ago, The Black Fox said: With the CTRL+SHIFT+C, where would I paste the output? Create a file called description.ext in the mission folder (where the mission.sqm is). The file extension has to be ".ext". Withing that file paste the following: class CfgRoles { class Assault//Class name used in CfgRespawnInventory { displayName = $STR_A3_Role_Assault;//Name of the role, displayed in the respawn menu icon = "a3\missions_f_exp\data\img\classes\assault_ca.paa";//Icon shown next to the role name in the respawn screen }; }; class CfgRespawnInventory { class B_SquadLeader//Class of the respawn inventory, used by BIS_fnc_addRespawnInventory { displayName = $STR_b_soldier_sl_f0;//Name of the respawn inventory role = "Assault";//Role the respawn inventory is assigned to icon = "\A3\ui_f\data\map\VehicleIcons\iconManLeader_ca.paa";//Icon shown next to the role show = "side group _this == west";//Condition used to make specific respawn inventories only avaiable for specfic sides, must return [[Boolean]] // Exported from Arsenal by Tiger uniform = "U_O_CombatUniform_ocamo"; backpack = "B_TacticalPack_ocamo"; weapons[] = {"arifle_Katiba_GL_F","hgun_Rook40_F","Rangefinder","Throw","Put"}; magazines[] = {"SmokeShell","SmokeShell","MiniGrenade","MiniGrenade","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","30Rnd_65x39_caseless_green","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","UGL_FlareWhite_F","30Rnd_9x21_Mag","30Rnd_9x21_Mag"}; items[] = {"FirstAidKit","FirstAidKit"}; linkedItems[] = {"V_TacVest_khk","H_HelmetSpecO_ocamo","G_Balaclava_TI_blk_F","ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGogglesB_blk_F"}; }; }; Should probably work, havent used CfgRespawnInventories that much tbh. Edited March 1, 2019 by 7erra Missing "//" at role="Assault"; Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 20 minutes ago, The Black Fox said: I am getting an error when pasted into Object: Init Error: Local variable in global space Huh weird. If you are going to use the cfg then you can probably do it like this: this addEventhandler ["Respawn",{ params ["_unit", "_corpse"]; _unit setUnitLoadout (missionConfigfile >> "CfgRespawnInventory" >> "LoadoutClassname"); }]; Again untested and only a guess. Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 29 minutes ago, 7erra said: Should probably work, havent used CfgRespawnInventories that much tbh. That doesn't matter, even if you havent used it you're still helping! And that's better than the 3,000 other people online right now! I'll report back with the results. Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 22 minutes ago, 7erra said: Huh weird. If you are going to use the cfg then you can probably do it like this: this addEventhandler ["Respawn",{ params ["_unit", "_corpse"]; _unit setUnitLoadout (missionConfigfile >> "CfgRespawnInventory" >> "LoadoutClassname"); }]; Again untested and only a guess. Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 2 hours ago, 7erra said: Huh weird. If you are going to use the cfg then you can probably do it like this: this addEventhandler ["Respawn",{ params ["_unit", "_corpse"]; _unit setUnitLoadout (missionConfigfile >> "CfgRespawnInventory" >> "LoadoutClassname"); }]; Again untested and only a guess. that doesn't work and I'm getting errors with the cfg you posted Share this post Link to post Share on other sites
The Black Fox 4 Posted March 1, 2019 2 hours ago, 7erra said: _unit setUnitLoadout (missionConfigfile >> "CfgRespawnInventory" >> "LoadoutClassname"); Am I supposed to fill out the loadout class name and mission config file name? Share this post Link to post Share on other sites
7erra 629 Posted March 1, 2019 Corrected the other post there was a missing comment in the example on the BIKI page. 16 hours ago, The Black Fox said: Am I supposed to fill out the loadout class name and mission config file name? Change the "LoadoutClassname" to whatever you named it in the description.ext. In the example from aboe it should be "B_SquadLeader". Leave the rest as is bc it is a path to the config (missionConfigFile is a command and CfgRespawnInventory is the subconfig). Share this post Link to post Share on other sites
The Black Fox 4 Posted March 3, 2019 On 3/1/2019 at 4:50 PM, 7erra said: Corrected the other post there was a missing comment in the example on the BIKI page. Change the "LoadoutClassname" to whatever you named it in the description.ext. In the example from aboe it should be "B_SquadLeader". Leave the rest as is bc it is a path to the config (missionConfigFile is a command and CfgRespawnInventory is the subconfig). Eh, never mind, I fixed my problem. I am using the vanilla Malden respawn system, so my edited variable names were for some reason incompatible with the 'this' global variable and I couldn't use '_this' either. So, since I couldn't use 'this', my respawn inventory script was being called but on a null unit, so nothing happened. I fixed it by giving each unit a special variable name and editing that into my respawn scripts, which are called by onPlayerRespawn. I'm new to Eden editor so it took me a while to get into the whole thing, but everything is going smoothly. You can see what I did here: https://steamcommunity.com/sharedfiles/filedetails/?id=1669600097 Share this post Link to post Share on other sites