Jump to content
BlacKnightBK

error in rpt, but code works kind of fine

Recommended Posts

Hello guys,

 

As some of you know I have some functions that set the gear for my AI units. That is done through two functions:

  1. YI_fnc_setAiLoadout: this one contains the loadout choices
  2. YI_fnc_parseGear: this one gears up the unit with the selected loadout onto the units

 

Before I mention my problem I will paste the codes and explain how each one works in better detail

 

Here is the first one

YI_fnc_setAiLoadout = {

    params ["_unit","_loadout"];
    /*
    [
        "",                                             --> 0: Goggles\masks ClassName
        "",                                             --> 1: Headgear ClassName
        ["Uniform_ClassName",[ArrayOfItemsInUniform]],  --> 2: UnifromArray
                                                                --> 0: UniformClassName
                                                                --> 1: ArrayOfItems
                                                                        --> 0: Item type
                                                                        --> 1: Number of Item X
        ["Vest_ClassName",[ArrayOfItemsInVest]],        --> 3: VestArray
                                                                --> 0: VestClassName
                                                                --> 1: ArrayOfItems
                                                                        --> 0: Item type
                                                                        --> 1: Number of Item X
        ["BackPack_ClassName",[ArrayOfItemsInVest]],    --> 4: VestArray
                                                                --> 0: VestClassName
                                                                --> 1: ArrayOfItems
                                                                        --> 0: Item type
                                                                        --> 1: Number of Item X
        [],                                             --> 5: Weapons array(Including binoculors)
        [],                                             --> 6: Array containing primary weapon attachments, include a magazine in here too
        [],                                             --> 7: Array containing handgun's weapon attachments, include a magazine in here too
        [],                                             --> 8: Array containing items to be assigned (GPS, map, compass,watch etc (Binoculors and such cannot be addd here))

    ]
    */
    /*Gear array
    [
        "",//Goggles
        "",//Headgear
        ["",[]],//Uniform
        ["",[]],//Vest
        ["",[]],//Backpack
        [],//Weapon
        [],//primary attachments
        [],//handgun attachments
        []//assigned items
    ]
    */

    _gear = switch (_loadout) do {

        case "AT_SOLDIER":          {
            [
                "",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["Chemlight_red",1],
                        ["FirstAidKit",1],
                        ["30Rnd_65x39_caseless_green",2]
                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    ["FirstAidKit",2],
                    ["Chemlight_red",1],
                    ["SmokeShellRed",1],
                    ["SmokeShell",1],
                    ["16Rnd_9x21_Mag",2],
                    ["30Rnd_65x39_caseless_green",5]
                ],//Vest
                ["B_Kitbag_rgr",
                    [
                        ["Titan_AT",2],
                        ["Titan_AP",1],
                        ["FirstAidKit",2]
                    ]
                ],//Backpack
                ["launch_O_Titan_short_F","hgun_Rook40_F","arifle_Katiba_F"],//Weapon
                ["30Rnd_65x39_caseless_green"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]//assigned items
            ]
        };
        case "SQUADLEADER":         {
            [
                "G_Balaclava_combat",//Goggle
                "H_HelmetLeaderO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["Chemlight_red",2],
                        ["FirstAidKit",2]
                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    [
                        ["FirstAidKit",2],
                        ["30Rnd_65x39_caseless_green",2],
                        ["SmokeShellYellow",1],
                        ["SmokeshellOrange",1],
                        ["SmokeShellRed",1],
                        ["O_IR_Grenade",2],
                        ["SmokeShell",2],
                        ["HandGrenade",1],
                        ["16Rnd_9x21_Mag",2],
                        ["30Rnd_65x39_caseless_green",7]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["hgun_Rook40_F","arifle_ARX_hex_F","Binocular"],//Weapon
                ["30Rnd_65x39_caseless_green","acc_pointer_IR","optic_ERCO_blk_F"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS"]//assigned items
            ]
        };
        case "AMMO_BEARER":         {
            [
                "G_Bandanna_blk",//Goggle
                "H_HelmetLeaderO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["FirstAidKit",2],
                        ["Chemlight_red",1],
                        ["30Rnd_580x42_Mag_F",1]

                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    [
                        ["SmokeShell",1],
                        ["16Rnd_9x21_Mag",1],
                        ["FirstAidKit",2],
                        ["30Rnd_580x42_Mag_F",9]
                    ]
                ],//Vest
                ["B_FieldPack_cbr_Ammo",
                    [
                        ["FirstAidKit",4],
                        ["10Rnd_762x51_Mag",3],
                        ["10Rnd_93x64_DMR_05_Mag",2],
                        ["1Rnd_HE_Grenade_shell",6],
                        ["MiniGrenade",3],
                        ["HandGrenade",2],
                        ["Titan_AP",1],
                        ["150Rnd_762x54_Box",1],
                        ["30Rnd_580x42_Mag_F",6]
                    ]
                ],//Backpack
                ["hgun_Rook40_F","arifle_CTAR_hex_F"],//Weapon
                ["30Rnd_580x42_Mag_F","acc_pointer_IR"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]//assigned items
            ]
        };
        case "SNIPER":              {
            [
                "G_Bandanna_tan",//Goggle
                "",//Headgear
                ["U_O_FullGhillie_ard",
                    [
                        ["9Rnd_45ACP_Mag",4],
                        ["7Rnd_408_Mag",2]
                    ]
                ],//Uniform
                ["V_BandollierB_cbr",
                    [
                        ["FirstAidKit",2],
                        ["7Rnd_408_Mag",3]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["hgun_ACPC2_F","srifle_LRR_F","Rangefinder"],//Weapon
                ["7Rnd_408_Mag","optic_LRPS"],//primary attachments
                ["9Rnd_45ACP_Mag","muzzle_snds_acp"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","NVGoggles","ItemGPS"]//assigned items
            ]
        };
        case "SPOTTER":             {
            [
                "",//Goggle
                "",//Headgear
                ["U_O_FullGhillie_ard",
                    [
                        ["FirstAidKit",1],
                        ["30Rnd_580x42_Mag_F",3],
                        ["Chemlight_red",1]
                    ]
                ],//Uniform
                ["V_Chestrig_khk",
                    [
                        ["FirstAidKit",1],
                        ["SmokeshellGreen",1],
                        ["1Rnd_HE_Grenade_shell",3],
                        ["30Rnd_580x42_Mag_Tracer_F",2],
                        ["Chemlight_red",1],
                        ["SmokeshellYellow",1],
                        ["SmokeshellOrange",1],
                        ["SmokeshellRed",1],
                        ["Smokeshell",1],
                        ["O_IR_Grenade",2],
                        ["MiniGrenade",2],
                        ["APERSTripMine_Wire_Mag",1],
                        ["ClaymoreDirectionalMine_Remote_Mag",1],
                        ["16Rnd_9x21_Mag",2]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["hgun_Rook40_F","arifle_CTAR_GL_blk_F","Laserdesignator_02"],//Weapon
                ["30Rnd_580x42_Mag_F","acc_pointer_IR","muzzle_snds_58_blk_F","optic_Arco_blk_F"],//primary attachments
                ["muzzle_snds_L","16Rnd_9x21_Mag"],//handgun attachments
                ["ItemGPS","Laserbatteries","ItemMap","ItemCompass","ItemWatch","ItemRadio","NVGoggles"]//assigned items
            ]
        };
        case "ENGINEER":            {
            [
                "G_Balaclava_combat",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["FirstAidKit",2],
                        ["Chemlight_red",2],
                        ["30Rnd_9x21_Mag_SMG_02",2]
                    ]
                ],//Uniform
                ["V_Rangemaster_belt",
                    [
                        ["FirstAidKit",1],
                        ["HandGrenade",2],
                        ["16Rnd_9x21_Mag",2]
                    ]
                ],//Vest
                ["B_AssaultPack_ocamo",
                    [
                        ["ToolKit",1],
                        ["SmokeShell",10]
                    ]
                ],//Backpack
                ["hgun_Rook40_F","SMG_02_F"],//Weapon
                ["30Rnd_9x21_Mag_SMG_02"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","NVGoggles"]//assigned items
            ]
        };
        case "GRENADIER":           {
            [
                "",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["FirstAidKit",2],
                        ["30Rnd_580x42_Mag_F",1],
                        ["Chemlight_red",1]
                    ]
                ],//Uniform
                ["V_HarnessOGL_brn",
                    [
                        ["FirstAidKit",2],
                        ["UGL_FlareYellow_F",1],
                        ["UGL_FlareRed_F",1],
                        ["UGL_FlareGreen_F",1],
                        ["UGL_FlareWhite_F",1],
                        ["1Rnd_HE_Grenade_shell",4],
                        ["30Rnd_580x42_Mag_F",4],
                        ["SmokeShellRed",1],
                        ["SmokeShell",1],
                        ["HandGrenade",1],
                        ["16Rnd_9x21_Mag",1]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["arifle_CTAR_GL_hex_F"],//Weapon
                ["30Rnd_580x42_Mag_F","acc_pointer_IR"],//primary attachments
                [],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","NVGoggles"]//assigned items
            ]
        };
        case "AT_ASSIST":           {
            [
                "G_Bandanna_blk",//Goggle
                "H_HelmetLeaderO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["FirstAidKit",2],
                        ["Chemlight_red",1],
                        ["30Rnd_65x39_caseless_green",2]
                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    [
                        ["SmokeShell",1],
                        ["16Rnd_9x21_Mag",1],
                        ["30Rnd_65x39_caseless_green",9]

                    ]
                ],//Vest
                ["B_FieldPack_cbr_Ammo",
                    [
                        ["FirstAidKit",4],
                        ["Titan_AT",1],
                        ["Titan_AP",3],
                        ["MiniGrenade",2],
                        ["HandGrenade",2],
                        ["SmokeShellBlue",3]
                    ]
                ],//Backpack
                ["hgun_Rook40_F","arifle_Katiba_F","Laserdesignator_02"],//Weapon
                ["30Rnd_65x39_caseless_green","acc_pointer_IR"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","NVGoggles_OPFOR"]//assigned items
            ]
        };
        case "DIVER":               {
            [
                "G_O_Diving",//Goggle
                "",//Headgear
                ["U_O_Wetsuit",
                    [
                        ["Chemlight_red",4],
                        ["SmokeShellRed",2],
                        ["20Rnd_556x45_UW_mag",1]
                    ]
                ],//Uniform
                ["V_RebreatherIR",[]],//Vest
                ["B_ViperLightHarness_blk_F",
                    [
                        ["MineDetector",1],
                        ["Chemlight_red",1],
                        ["FirstAidKit",4],
                        ["Chemlight_green",2],
                        ["Chemlight_blue",4],
                        ["MiniGrenade",2],
                        ["20Rnd_556x45_UW_mag",4]
                    ]
                ],//Backpack
                ["arifle_SDAR_F"],//Weapon
                ["20Rnd_556x45_UW_mag"],//primary attachments
                [],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","NVGoggles_OPFOR"]//assigned items
            ]
        };
        case "MARKSMAN":            {
            [
                "",//Goggle
                "H_Bandanna_cbr",//Headgear
                ["U_O_GhillieSuit",
                    [
                        ["FirstAidKit",3],
                        ["10Rnd_93x64_DMR_05_Mag",2]
                    ]
                ],//Uniform
                ["V_Rangemaster_belt",
                    [
                        ["HandGrenade",2],
                        ["SmokeShell",2],
                        ["SmokeShellRed",1]
                    ]
                ],//Vest
                ["B_AssaultPack_cbr",
                    [
                        ["FirstAidKit",3],
                        ["9Rnd_45ACP_Mag",2],
                        ["10Rnd_93x64_DMR_05_Mag",5]
                    ]
                ],//Backpack
                ["hgun_ACPC2_F","srifle_DMR_05_hex_F","Rangefinder"],//Weapon
                ["10Rnd_93x64_DMR_05_Mag","bipod_02_F_hex","optic_KHS_hex"],//primary attachments
                ["9Rnd_45ACP_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]//assigned items
            ]
        };
        case "MEDIC":               {
            [
                "",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["30Rnd_65x39_caseless_green",2],
                        ["Chemlight_red",1],
                        ["FirstAidKit",1]
                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    [
                        ["Chemlight_red",1],
                        ["SmokeSHhellYellow",1],
                        ["SmokeSHhellOrange",1],
                        ["SmokeShellRed",1],
                        ["SmokeShell",1],
                        ["16Rnd_9x21_Mag",3],
                        ["30Rnd_65x39_caseless_green",6]
                    ]
                ],//Vest
                ["B_TacticalPack_ocamo",
                    [
                        ["FirstAidKit",15],
                        ["Medkit",1],
                        ["SmokeShell",10]
                    ]
                ],//Backpack
                ["hgun_Rook40_F","arifle_Katiba_F"],//Weapon
                ["30Rnd_65x39_caseless_green","acc_pointer_IR"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]//assigned items
            ]
        };
        case "MACHINEGUNNER":       {
            [
                "",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["16Rnd_9x21_Mag",2],
                        ["HandGrenade",1],
                        ["SmokeShell",1],
                        ["FirstAidKit",1]
                    ]
                ],//Uniform
                ["V_PlateCarrier2_rgr_noflag_F",
                    [
                        ["FirstAidKit",2],
                        ["SmokeShellPurple",2],
                        ["SmokeShell",2],
                        ["SmokeShellRed",1],
                        ["150Rnd_762x54_Box",2]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["hgun_Rook40_F","LMG_Zafir_F"],//Weapon
                ["150Rnd_762x54_Box","acc_pointer_IR","optic_Holosight_blk_F"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]//assigned items
            ]
        };
        case "RIFLEMAN":            {
            [
                "G_Balaclava_combat",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_CombatUniform_ocamo",
                    [
                        ["FirstAidKit",2],
                        ["30Rnd_580x42_Mag_F",2],
                        ["Chemlight_red",1]
                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    [
                        ["FirstAidKit",2],
                        ["30Rnd_580x42_Mag_F",2],
                        ["SmokeShellRed",1],
                        ["SmokeShell",3],
                        ["O_IR_Grenade",2],
                        ["HandGrenade",2],
                        ["16Rnd_9x21_Mag",2]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["hgun_Rook40_F","arifle_CTAR_hex_F","Binocular"],//Weapon
                ["30Rnd_580x42_Mag_F","acc_pointer_IR","optic_Aco"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]//assigned items
            ]
        };
        case "RECON_SQUADLEADER":   {
            [
                "G_Balaclava_combat",
                "H_Bandanna_cbr",
                ["U_O_GhillieSuit",
                    [
                        ["Chemlight_red",2],
                        ["30Rnd_65x39_caseless_green",1],
                        ["10Rnd_50BW_Mag_F",2],
                        ["FirstAidKit",2]
                    ]
                ],//Uniform end
                ["V_TacVest_khk",
                    [
                        ["16Rnd_9x21_Mag",2],
                        ["HandGrenade",1],
                        ["O_IR_Grenade",2],
                        ["SmokeShell",2],
                        ["SmokeShellRed",2],
                        ["SmokeShellOrange",1],
                        ["30Rnd_65x39_caseless_green",2],
                        ["FirstAidKit",2]
                    ]
                ],//Vest End
                ["",
                []
                ],//BackPack End
                ["arifle_ARX_blk_F","hgun_Rook40_F","binocular"],
                ["optic_ERCO_blk_F","muzzle_snds_65_TI_blk_F","acc_pointer_IR","30Rnd_65x39_caseless_green"],
                ["16Rnd_9x21_Mag"],
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGoggles"]
            ]
        };
        case "RECON_MARKSMAN":      {
            [
                "",//Goggle
                "H_Bandanna_cbr",//Headgear
                ["U_O_GhillieSuit",
                    [
                        ["10Rnd_93x64_DMR_05_Mag",2],
                        ["FirstAidKit",3]
                    ]
                ],//Uniform
                ["V_Rangemaster_belt",
                    [
                        ["SmokeShell",2],
                        ["HandGrenade",2],
                        ["SmokeShellRed",1],
                        ["FirstAidKit",1]
                    ]
                ],//Vest
                ["B_AssaultPack_cbr",
                    [
                        ["10Rnd_93x64_DMR_05_Mag",7],
                        ["9Rnd_45ACP_Mag",2],
                        ["FirstAidKit",3]
                    ]
                ],//Backpack
                ["srifle_DMR_05_hex_F","hgun_ACPC2_F","rangefinder"],//Weapon
                ["optic_KHS_hex","bipod_02_F_hex","10Rnd_93x64_DMR_05_Mag","muzzle_snds_93mmg_tan"],//primary attachments
                ["9Rnd_45ACP_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGoggles"]//assigned items
            ]
        };
        case "RECON_MEDIC":         {
            [
                "",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_GhillieSuit",
                    [
                        ["30Rnd_556x45_Stanag",2],
                        ["Chemlight_red",1],
                        ["FirstAidKit",2]
                    ]
                ],//Uniform
                ["V_TacVest_khk",
                    [
                        ["SmokeShell",1],
                        ["SmokeShellRed",1],
                        ["SmokeShellOrange",1],
                        ["SmokeShellYellow",1],
                        ["Chemlight_red",1],
                        ["HandGrenade",2],
                        ["30Rnd_556x45_Stanag",3],
                        ["16Rnd_9x21_Mag",3]
                    ]
                ],//Vest
                ["B_TacticalPack_ocamo",
                    [
                        ["Medkit",1],
                        ["FirstAidKit",15],
                        ["SmokeShell",10]
                    ]
                ],//Backpack
                ["hgun_Rook40_F","arifle_Mk20_plain_F"],//Weapon
                ["30Rnd_556x45_Stanag","muzzle_snds_M"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGoggles"]//assigned items
            ]
        };
        case "RECON_SCOUT":         {
            [
                "",//Goggle
                "H_HelmetO_ocamo",//Headgear
                ["U_O_GhillieSuit",
                    [
                        ["FirstAidKit",2],
                        ["Chemlight_red",1],
                        ["30Rnd_65x39_caseless_green",2]
                    ]
                ],//Uniform
                ["V_TacVest_brn",
                    [
                        ["SmokeShellRed",1],
                        ["SmokeShell",1],
                        ["HandGrenade",1],
                        ["16Rnd_9x21_Mag",2],
                        ["30Rnd_65x39_caseless_green",5]
                    ]
                ],//Vest
                ["",[]],//Backpack
                ["hgun_Rook40_F","arifle_Katiba_F","binocular"],//Weapons
                ["30Rnd_65x39_caseless_green","acc_pointer_IR","muzzle_snds_H","optic_Arco_blk_F"],//primary attachments
                ["16Rnd_9x21_Mag"],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGoggles"]//assigned items
            ]
        };
        case "H_PILOT":             {
            [
                "",//Goggle
                "H_PilotHelmetHeli_O",//Headgear
                ["U_O_PilotCoveralls",
                    [
                        ["FirstAidKit",1],
                        ["SmokeShellYellow",1],
                        ["SmokeShellOrange",1],
                        ["Chemlight_yellow",2],
                        ["SmokeShellRed",2],
                        ["30Rnd_9x21_Mag_SMG_02_Tracer_Green",3]
                    ]
                ],//Uniform
                ["",[]],//Vest
                ["B_Parachute",[]],//Backpack
                ["SMG_02_F"],//Weapon
                ["30Rnd_9x21_Mag_SMG_02_Tracer_Green","optic_ACO_grn_smg"],//primary attachments
                [],//handgun attachments
                ["ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGoggles_INDEP"]//assigned items
            ]
        };

        default {throw format["YI_fnc_setAiLoadout: Loadout %1 not set",_loadout]};
    };

    [_unit,_gear] call YI_fnc_parseloadout;

    if (_loadout isEqualTo "AT_SOLDIER") exitWith {
        sleep 5;
        _unit addSecondaryWeaponItem "Titan_AT";
    };

};

As you see above there is one BIIIIIG array that contains strings inside of it and even more arrays which contain more arrays. At the top of the code, I have already written what is expected in each element. FYI, there is no issue up there as far as I am aware, but I posted it anyways because my second function depends on this.

 

My second function is as follows:

YI_fnc_parseLoadout = {
    params ["_unit","_gear"];

    removeAllWeapons _unit;
    removeUniform _unit;
    removeHeadgear _unit;
    removeBackpack _unit;
    removeAllAssignedItems _unit;
    removeAllItems _unit;
    removeVest _unit;
    removeGoggles _unit;

    _goggles    = _gear select 0;
    _head       = _gear select 1;
    _uni        = _gear select 2;
    _vest       = _gear select 3;
    _back       = _gear select 4;
    _weap       = _gear select 5;
    _prim       = _gear select 6;
    _sec        = _gear select 7;
    _ass        = _gear select 8;

    if (_goggles != "")       then {_unit addGoggles _goggles;};
    if (_head != "")          then {_unit addHeadgear _head;};
    if (_uni  select 0 != "") then {_unit forceAddUniform (_uni select 0);};
    if (_vest select 0 != "") then {_unit addVest (_vest select 0);};
    if (_back select 0 != "") then {_unit addBackpack (_back select 0);};

    if ((count _ass) != 0) then {
        {
            if (_unit canAdd _x) then {
                _unit addItem _x;
                _unit assignItem _x;
            };
        }forEach _ass;
    };//Items Assigned

    if ((count (_uni select 1)) != 0) then {
        {
            uniformContainer _unit addItemCargoGlobal [_x select 0,_x select 1];
        }forEach (_uni select 1);
    };//Uniform Items Added

    if ((count (_vest select 1)) != 0) then {
        {
            vestContainer _unit addItemCargoGlobal [_x select 0, _x select 1];
        }forEach (_vest select 1);
    };//Vest Items Added

    if ((count (_back select 1)) != 0) then {
        {
            backpackContainer _unit addItemCargoGlobal [_x select 0,_x select 1];
        }forEach (_back select 1);
    };//BackPack Cargo added

    if ((count _weap)!= 0 ) then {
        {
            _unit addWeapon _x;
        }forEach _weap;
    };//Adding Weapons

    if (primaryWeapon _unit != "") then {
        if((count _prim) != 0 ) then {
            {
                _unit addPrimaryWeaponItem _x;
            }forEach _prim;
        };
    };//Primary weapon items attded

    if (handgunWeapon _unit != "") then {
        if((count _sec) != 0) then {
            {
                _unit addHandgunItem _x;
            }forEach _sec;
        };
    };//Pistol items added
};

Now, this function simply takes the big array that contains the loadout and sets the AI up with it. (PS. This is partially my next update for my Custom AI Creator)

 

 

set, however, I get this error in my RPT file:

 7:40:43 Error in expression <tContainer _unit addItemCargoGlobal [_x select 0, _x select 1];
}forEach (_vest >
 7:40:43   Error position: <select 0, _x select 1];
}forEach (_vest >
 7:40:43   Error Generic error in expression
 7:40:43 File C:\Users\User\Documents\Arma 3 - Other Profiles\Sfc%2e%20Y%2eIbrahim\mpmissions\SaltLake.Altis\DAC\DAC_functions.sqf, line 673

 

Share this post


Link to post
Share on other sites

I d'like to see all lines where both functions are called or spawned please.

Share this post


Link to post
Share on other sites
1 hour ago, sarogahtyp said:

I d'like to see all lines where both functions are called or spawned please.

Well, that is two whole files, hope you have the time to read through

 

Functions File: https://docs.google.com/document/d/1jlrom14LIU5wFrkwwBQ-HPKDdxn4uslAFVeWVDjwhss/edit?usp=sharing

 

Functions Call: https://docs.google.com/document/d/1L-heGYsW_in896fVuhZyP6ORXeBG2lUNur_EvBQLLS8/edit

Share this post


Link to post
Share on other sites

AT_SOLDIER is missing its brackets around its vest items.

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, Larrow said:

AT_SOLDIER is missing its brackets around its vest items.

lol, thanks man, you have no idea how much this was killing me.

@sarogahtyp Hey mate, Larrow just told me how to fix it and it is working now :)

 

Cheers.

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

×