Jump to content
DylanMadigan

Multiplayer respawn loadout not adding inventory

Recommended Posts

Long story short I'm trying to make a multiplayer game where the player can select their loadout. I also made custom classes in the Alive Orbat editor and loaded them in as a mod.

 

When I load the unit in singleplayer, the unit (player or AI) seems to spawn with everything properly.

 

When I load it in multiplayer without loadout selection, it's fine.

 

When I load the loadout after adding loadout options, the player inventory is pretty much empty except for a couple mags. The weapon also does not have it's attachments.

 

I'm by no means a professional, I've just been messing with mission making for a little while.

 

Mod class:

 class B_NATO_US_Rifleman_M16_V_W_01 : B_Soldier_F_OCimport_02 {
        author = "Dylan Madigan";
        scope = 2;
        scopeCurator = 2;
        displayName = "U.S. - Rifleman (M16) - [V][W]";
        side = 1;
        faction = "b_nato_us_v_w";

        identityTypes[] = {"Head_NATO","LanguageENG_F","G_NATO_default"};

        uniformClass = "CUP_U_B_BDUv2_OD_US";

        linkedItems[] = {"CFP_Smersh_Creme","CUP_H_USArmy_Helmet_M1_plain_Vine","ItemMap","tf_rf7800str","ItemCompass","Itemwatch"};
        respawnlinkedItems[] = {"CFP_Smersh_Creme","CUP_H_USArmy_Helmet_M1_plain_Vine","ItemMap","tf_rf7800str","ItemCompass","Itemwatch"};

        weapons[] = {"CUP_arifle_M16A4_Base","rhsusf_weap_m1911a1","Binocular"};
        respawnWeapons[] = {"CUP_arifle_M16A4_Base","rhsusf_weap_m1911a1","Binocular"};

        magazines[] = {"30Rnd_556x45_Stanag_Tracer_Green","rhsusf_mag_7x45acp_MHP","30Rnd_556x45_Stanag_Tracer_Green","rhsusf_mag_7x45acp_MHP"};
        respawnMagazines[] = {"30Rnd_556x45_Stanag_Tracer_Green","rhsusf_mag_7x45acp_MHP","30Rnd_556x45_Stanag_Tracer_Green","rhsusf_mag_7x45acp_MHP"};

        backpack = "CUP_B_AlicePack_OD_B_NATO_US_Rifleman_M16_V_W_01";

        ALiVE_orbatCreator_loadout[] = {{"CUP_arifle_M16A4_Base","","","CUP_acc_Zenit_2DS",{"30Rnd_556x45_Stanag_Tracer_Green",30},{},""},{},{"rhsusf_weap_m1911a1","","","",{"rhsusf_mag_7x45acp_MHP",7},{},""},{"CUP_U_B_BDUv2_OD_US",{{"rhsusf_mag_7x45acp_MHP",3,7},{"30Rnd_556x45_Stanag_Tracer_Green",3,30}}},{"CFP_Smersh_Creme",{{"ACE_fieldDressing",2},{"ACE_elasticBandage",2},{"ACE_packingBandage",2},{"ACE_quikclot",2},{"ACE_CableTie",3},{"ACE_Canteen",1},{"ACE_epinephrine",1},{"ACE_Flashlight_XL50",1},{"ACE_MapTools",1},{"ACE_morphine",1},{"ACE_tourniquet",1},{"SmokeShell",3,1},{"HandGrenade",2,1},{"ACE_Chemlight_HiWhite",2,1},{"ACE_Chemlight_HiBlue",1,1},{"ACE_Chemlight_HiRed",1,1},{"ACE_HandFlare_Green",1,1},{"ACE_HandFlare_White",3,1}}},{"CUP_B_AlicePack_OD_B_NATO_US_Rifleman_M16_V_W_01",{{"ACE_fieldDressing",3},{"ACE_elasticBandage",2},{"ACE_packingBandage",3},{"ACE_quikclot",1},{"ACE_CableTie",2},{"ACE_EntrenchingTool",1},{"ACE_epinephrine",2},{"ACE_Fortify",1},{"ACE_Clacker",1},{"ACE_morphine",2},{"ACE_rope3",1},{"ACE_splint",2},{"ACE_SpraypaintBlue",1},{"ACE_WaterBottle",3},{"ACE_tourniquet",2},{"CUP_acc_Flashlight",1},{"RyanZombiesAntiVirusTemporary_Item",1},{"ACE_IR_Strobe_Item",1},{"ACE_MRE_CreamTomatoSoup",2},{"ACE_MRE_ChickenHerbDumplings",2},{"ACE_M84",1,1},{"ACE_HandFlare_Green",1,1},{"SmokeShellBlue",1,1},{"30Rnd_556x45_Stanag_Tracer_Green",2,30}}},"CUP_H_USArmy_Helmet_M1_plain_Vine","",{"Binocular","","","",{},{},""},{"ItemMap","","tf_rf7800str","ItemCompass","Itemwatch",""}};


        class EventHandlers : EventHandlers {
            class CBA_Extended_EventHandlers : CBA_Extended_EventHandlers_base {};

            class ALiVE_orbatCreator {
                init = "if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack};if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
            };

        };

        // custom attributes (do not delete)
        ALiVE_orbatCreator_owned = 1;

    };

 

description.ext

#include "LoadoutsPlayer.cpp"

 

LoadoutsPlayer.cpp A

class CfgRespawnInventory
{
	class USRiflemanVOd
	{
		vehicle = "B_NATO_US_Rifleman_M16_V_W_01"
		displayName = "U.S. - Rifleman - [V][OD]"; // Name visible in the menu
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; // Icon displayed next to the name
	};
};

 

LoadoutsPlayer.cpp B

class CfgRespawnInventory
{
	class USRiflemanVOd
	{
		displayName = "U.S. - Rifleman - [V][OD]"; // Name visible in the menu
		icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; // Icon displayed next to the name
		
		// Exported from Arsenal by Dylan Madigan
		uniformClass = "CUP_U_B_BDUv2_OD_US";
		backpack = "CUP_B_AlicePack_OD";
		weapons[] = {"CUP_arifle_M16A4_Base","rhsusf_weap_m1911a1","Binocular","Throw","Put"};
		magazines[] = {"30Rnd_556x45_Stanag_Tracer_Green","rhsusf_mag_7x45acp_MHP","rhsusf_mag_7x45acp_MHP","rhsusf_mag_7x45acp_MHP","rhsusf_mag_7x45acp_MHP","30Rnd_556x45_Stanag_Tracer_Green","30Rnd_556x45_Stanag_Tracer_Green","30Rnd_556x45_Stanag_Tracer_Green","SmokeShell","SmokeShell","SmokeShell","HandGrenade","HandGrenade","ACE_Chemlight_HiWhite","ACE_Chemlight_HiWhite","ACE_Chemlight_HiBlue","ACE_Chemlight_HiRed","ACE_HandFlare_Green","ACE_HandFlare_White","ACE_HandFlare_White","ACE_HandFlare_White","ACE_M84","ACE_HandFlare_Green","SmokeShellBlue","30Rnd_556x45_Stanag_Tracer_Green","30Rnd_556x45_Stanag_Tracer_Green"};
		items[] = {"ACE_fieldDressing","ACE_fieldDressing","ACE_elasticBandage","ACE_elasticBandage","ACE_packingBandage","ACE_packingBandage","ACE_quikclot","ACE_quikclot","ACE_CableTie","ACE_CableTie","ACE_CableTie","ACE_Canteen","ACE_epinephrine","ACE_Flashlight_XL50","ACE_MapTools","ACE_morphine","ACE_tourniquet","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_elasticBandage","ACE_elasticBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage","ACE_quikclot","ACE_CableTie","ACE_CableTie","ACE_EntrenchingTool","ACE_epinephrine","ACE_epinephrine","ACE_Fortify","ACE_Clacker","ACE_morphine","ACE_morphine","ACE_rope3","ACE_splint","ACE_splint","ACE_SpraypaintBlue","ACE_WaterBottle","ACE_WaterBottle","ACE_WaterBottle","ACE_tourniquet","ACE_tourniquet","CUP_acc_Flashlight","RyanZombiesAntiVirusTemporary_Item","ACE_IR_Strobe_Item","ACE_MRE_CreamTomatoSoup","ACE_MRE_CreamTomatoSoup","ACE_MRE_ChickenHerbDumplings","ACE_MRE_ChickenHerbDumplings"};
		linkedItems[] = {"CFP_Smersh_Creme","CUP_H_USArmy_Helmet_M1_plain_Vine","ItemMap","ItemCompass","Itemwatch","tf_rf7800str"};
	};
};

 

In the 2nd loadoutsplayer I used ctrl shift c to export the unit, and that's what I see to do in tutorials and what not. In A I tried to just link it directly to the unit as I don't wish to make any altercations anyway, I'd rather it all be the same.

 

Obviously one thing I notice is the lack of anything saying it's added to the vest or backpack. 

 

I think maybe I'm just missing something really simple. I just want players to be able to select "Rifleman" or "Team Leader" and spawn in with the gear that that unit comes with.

Share this post


Link to post
Share on other sites
On 4/6/2024 at 9:37 AM, DylanMadigan said:

I think maybe I'm just missing something really simple. I just want players to be able to select "Rifleman" or "Team Leader" and spawn in with the gear that that unit comes with.


You don't really need to make a mod to pull this off, you can just do it with a description.ext file in your scenario folder.  You'll need to edit the CfgRoles class and the CfgRespawnInventory class in the description.ext.  Once that is set up you need to call the 'BIS_fnc_addRespawnInventory' function for the loadouts via a script or function in the init.sqf file. (https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory)

Might be a better way to do it but that's how I've been able to get it working in the past.  Seems simpler than the way you're trying to do it here.

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

×