mistaparadox 10 Posted November 7, 2014 Hello, I'm having trouble adding weapons and magazines to a group of units that are spawning in on a trigger. The units spawn in on Radio Alpha Activation, and it executes this script: _civnorth = [getMarkerPos "CivNorth", EAST, ["C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; _wp1 = _civnorth addWaypoint [getMarkerPos "CNwp1", 0]; What I tried was putting a trigger (activated upon OPFOR entering) where they spawned and running this script: { _x addWeapon "caf_ak47"; _x addMagazines ["CAF_30Rnd_762x39_AK", 3]; } forEach units group _civnorth; They spawn in alright on the first trigger, activate the second trigger okay, but they don't get armed, they just start moving to their waypoint. Any ideas on how I can arm them? Thanks, -MistaParadox Share this post Link to post Share on other sites
jshock 513 Posted November 7, 2014 That's because "_civnorth" isn't defined in the new trigger as it was local in the script that spawned them. As far as rearming them, you could use my redressing script (linked in my signature), or you just need to make "_civnorth" global like this: glb_civnorth = [getMarkerPos "CivNorth", EAST, ["C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; _wp1 = glb_civnorth addWaypoint [getMarkerPos "CNwp1", 0]; //and then in your new trigger onAct field { _x addWeapon "caf_ak47"; _x addMagazines ["CAF_30Rnd_762x39_AK", 3]; } forEach units group glb_civnorth; Share this post Link to post Share on other sites
mistaparadox 10 Posted November 7, 2014 (edited) Alright, I changed it to global, yet in the trigger the code I placed there (the code your comment references), something doesn't work there. I put a hintSilent after the ending of the Trigger to make sure it works, but the hint never pops up, so I'm assuming something goes wrong in this code: //and then in your new trigger onAct field { _x addWeapon "caf_ak47"; _x addMagazines ["CAF_30Rnd_762x39_AK", 3]; } forEach units group glb_civnorth; EDIT: I figured I should add a little background. These are Civ units that I assigned to OPFOR so that they will kill BLUFOR. I'm trying to arm them with AK-47's so they actually can deal damage rather than just stand there and look stupid. Edited November 7, 2014 by MistaParadox Share this post Link to post Share on other sites
jshock 513 Posted November 7, 2014 (edited) Alright, I changed it to global, yet in the trigger the code I placed there (the code your comment references), something doesn't work there. I put a hintSilent after the ending of the Trigger to make sure it works, but the hint never pops up, so I'm assuming something goes wrong in this code: //and then in your new trigger onAct field { _x addWeapon "caf_ak47"; _x addMagazines ["CAF_30Rnd_762x39_AK", 3]; } forEach units group glb_civnorth; EDIT: I figured I should add a little background. These are Civ units that I assigned to OPFOR so that they will kill BLUFOR. I'm trying to arm them with AK-47's so they actually can deal damage rather than just stand there and look stupid. Add the magazines first then add the weapon, and try addWeaponGlobal. { _x addMagazines ["CAF_30Rnd_762x39_AK", 3]; _x addWeaponGlobal "caf_ak47"; } forEach units group glb_civnorth; Edited November 7, 2014 by JShock Share this post Link to post Share on other sites
mistaparadox 10 Posted November 7, 2014 Still doesn't work. I know in a normal unit init line, I can put _this addWeapon "caf_ak47"; _this addMagazines ["CAF_30Rnd_762x39_AK", 3]; and nothing will go wrong. Am I going around this the wrong way attempting to use forEach? Share this post Link to post Share on other sites
shuko 59 Posted November 7, 2014 Doesn't spawnGroup return a group already? That would make the "group" command unnecessary at least, but I don't know if that's causing any problems though. forEach units glb_civnorth; Share this post Link to post Share on other sites
dreadedentity 278 Posted November 7, 2014 Just to be clear, you did download a mod that adds AK-47's, right? And you are aware this is the A3 section of the forum? I'm only asking these questions because there are no AK-47's in A3. I know for certain that addWeaponGlobal will simply fail, without reporting, if given an improper parameter, but I'm not sure about addMagazines. You may want to re-check the classnames for the weapon and magazines Share this post Link to post Share on other sites
iceman77 18 Posted November 7, 2014 First thing I did notice was a small syntax error. units group _civNorth can just be units _civNorth Tip: Always make your mission in vanilla first, and then a version with addons. This is beneficial for 3 reasons; #1 Easier to debug when you can say with 100% certainty "I know addons aren't causing the issue". #2 Potential for more help (forums) when debugging. #3 you've a vanilla version =). So.. let's try your code with vanilla. Then after we get that working, lets do it with addons. // Works civnorth = [getMarkerPos "CivNorth", EAST, ["C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; { _x addWeapon "arifle_Katiba_C_ACO_F"; _x addMagazines ["30Rnd_65x39_caseless_green", 3]; } forEach (units civNorth); // Could also be civnorth = [getMarkerPos "CivNorth", EAST, ["C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F", "C_man_w_worker_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; { [_x, "arifle_Katiba_C_ACO_F", 3] call BIS_fnc_addWeapon; } forEach (units civNorth); Share this post Link to post Share on other sites
mistaparadox 10 Posted November 7, 2014 Hey guys, thanks for the help. It was the syntax error that Shuko and Iceman77 pointed out. Probably would've been a much better idea to code in vanilla, yeah, but sorry I didn't do that. For sure will happen next time. Thanks everyone! Share this post Link to post Share on other sites
diehardfc 41 Posted November 10, 2014 I hope this isn't a horrible place to ask, but I'm having a tangentially related issue. I'm not a savvy coder, and was asked to use a spawn script for mission making with my milsim unit. I can get the script to work without difficulty, but I'm now interested in tweaking it so that instead of spawning just a group of stock/vanilla Infantry (1x Squad Leader, 1x Autorifleman, 2x Rifleman, etc.) from one side, it will spawn those units with uniforms, weapons, and equipment from a modpack. The tricky part is that I'd like them to be different for each unit type. So, if I spawn the group of 4 units mentioned above, the Squad Leader would have slightly different gear from the Autorifleman, who would have different gear from the Riflemen. I'm using exported information from the Virtual Arsenal to handle the equipment change, but I don't know how to marry that information to the spawn script. Here's the spawn script, which again, works fine: //null=["markerName"] execVM "spawn\militia_ft.sqf"; //Put on a trigger //Spawns 1 Fireteam of Rebels if (!isServer) exitWith {}; //Take variables _marker = _this select 0; _dest = _this select 1; _cycle = _this select 2; _spawnpos = [(getMarkerPos _marker select 0) + 10, getMarkerPos _marker select 1, getMarkerPos _marker select 2]; //Set up the group _group = createGroup east; sleep(1); //Begin spawning the squad "B_G_Soldier_TL_F" createUnit [getMarkerPos _marker, _group]; //FTL "B_G_Soldier_F" createUnit [getMarkerPos _marker, _group]; //Rifleman "B_G_Soldier_LAT_F" createUnit [getMarkerPos _marker, _group]; //Rifleman(AT) "B_G_Soldier_AR_F" createUnit [getMarkerPos _marker, _group]; //Automatic Rifleman "B_G_Soldier_M_F" createUnit [getMarkerPos _marker, _group]; //Designated Marksman sleep(0.5); //Set the waypoint _wpZero = _group addWaypoint [(getMarkerPos _marker), 10]; _wpZero setWaypointType "MOVE"; _wpZero setWaypointFormation "LINE"; _wpZero setWaypointCompletionRadius 5; _wpOne = _group addWaypoint [(getMarkerPos _dest), 10]; _wpOne setWaypointType "MOVE"; _wpOne setWaypointCompletionRadius 5; if (_cycle) then { _wpTwo = _group addWaypoint [(getMarkerPos _marker), 1]; _wpTwo setWaypointCompletionRadius 5; _wpTwo setWaypointType "CYCLE"; _group setSpeedMode "LIMITED"; } else { _wpTwo = _group addWaypoint [(getMarkerPos _marker), 1]; _wpTwo setWaypointCompletionRadius 5; _wpTwo setWaypointType "GUARD"; }; _group setBehaviour "AWARE"; _group setCombatMode "YELLOW"; And this is the Virtual Arsenal scripting info for a Rifleman: private [_"unit"]; _unit = this select 0 IF(!local _unit) exitwith {}; comment "Remove existing items"; removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; removeGoggles _unit; comment "Add containers"; _unit forceAddUniform "AV_CombatUniform2_OCP"; _unit addItemToUniform "FirstAidKit"; _unit addItemToUniform "Chemlight_green"; _unit addItemToUniform "HandGrenade"; _unit addVest "AV_PlateCarrier1_OCP"; for "_i" from 1 to 3 do {_unit addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {_unit addItemToVest "SmokeShell";}; _unit addItemToVest "SmokeShellBlue"; _unit addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {_unit addItemToVest "30Rnd_556x45_Stanag_Tracer_Red";}; _unit addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 10 do {_unit addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red";}; _unit addHeadgear "AV_ACH1_OCP"; comment "Add weapons"; _unit addWeapon "RH_M4A1_ris"; _unit addPrimaryWeaponItem "acc_pointer_IR"; _unit addPrimaryWeaponItem "RH_ta31rco"; _unit addWeapon "hgun_P07_F"; _unit addWeapon "Binocular"; comment "Add items"; _unit linkItem "ItemMap"; _unit linkItem "ItemCompass"; _unit linkItem "ItemWatch"; _unit linkItem "ItemRadio"; _unit linkItem "ItemGPS"; _unit linkItem "SP_Kneepads_Tan"; comment "Set identity"; _unit setFace "WhiteHead_18"; _unit setSpeaker "Male01ENG"; I feel like this Virtual Arsenal information should either be under the entry of the unit when it spawns or in some kind of execVM script file. If it's the former, I'm not sure how to apply it just to one unit, but if it's the latter, I'm not sure how to call the script. And once called, could I apply a riflemanGear.sqf to the Rifleman, a autoriflemanGear.sqf to the Autorifleman, etc.? Any and all help is sincerely appreciated; I've been Google-ing for days but my lack of knowledge and somewhat broad search terms haven't yielded any results. Share this post Link to post Share on other sites
jshock 513 Posted November 10, 2014 (edited) I would recommend changing your createUnit lines with a createUnit array instead, because your current createUnit command is older (and doesn't return a value). After you do that you should easily be able to add forEach loop for each member of "_group" that has a call line that passes the unit into the loadout script your using, to then use a switch statement inside your loadout script based on the unit classname: //example createUnit command and forEach loop _unit = _group createUnit ["B_G_Soldier_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //make sure the forEach is after all the createUnit commands { nul = [_x] execVM "loadout.sqf"; } forEach units _group; //in loadout script _unit = (_this select 0); switch (_unit) do { case (typeOf _unit == "B_G_Soldier_F"): { comment "Remove existing items"; removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; removeGoggles _unit; comment "Add containers"; _unit forceAddUniform "AV_CombatUniform2_OCP"; _unit addItemToUniform "FirstAidKit"; _unit addItemToUniform "Chemlight_green"; _unit addItemToUniform "HandGrenade"; _unit addVest "AV_PlateCarrier1_OCP"; for "_i" from 1 to 3 do {_unit addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {_unit addItemToVest "SmokeShell";}; _unit addItemToVest "SmokeShellBlue"; _unit addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {_unit addItemToVest "30Rnd_556x45_Stanag_Tracer_Red";}; _unit addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 10 do {_unit addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red";}; _unit addHeadgear "AV_ACH1_OCP"; comment "Add weapons"; _unit addWeapon "RH_M4A1_ris"; _unit addPrimaryWeaponItem "acc_pointer_IR"; _unit addPrimaryWeaponItem "RH_ta31rco"; _unit addWeapon "hgun_P07_F"; _unit addWeapon "Binocular"; comment "Add items"; _unit linkItem "ItemMap"; _unit linkItem "ItemCompass"; _unit linkItem "ItemWatch"; _unit linkItem "ItemRadio"; _unit linkItem "ItemGPS"; _unit linkItem "SP_Kneepads_Tan"; comment "Set identity"; _unit setFace "WhiteHead_18"; _unit setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_G_Soldier_TL_F"): { loadout code for TL }; case (typeOf _unit == "B_G_Soldier_LAT_F"): { loadout code for AT }; case (typeOf _unit == "B_G_Soldier_AR_F"): { loadout code for AR }; case (typeOf _unit == "B_G_Soldier_M_F"): { loadout code for Marksman }; default { hint "Unit not within defined class loadouts"; }; }; Edited November 10, 2014 by JShock Share this post Link to post Share on other sites
diehardfc 41 Posted November 11, 2014 Firstly, my sincere thanks for the assistance - I greatly appreciate the help. Each time someone shares their knowledge in this way, I understand the entire coding structure a little bit better. This community really is the best! That being said, I was wondering if I could impose upon you for an additional bit of troubleshooting: As near as I can tell, these scripts are executing. When I trigger the spawn script, the units appear with the new createUnit commands no problem. It's clear that the loadout script (which I have called "loadout.sqf" as suggested) is executing, as the HINT appears saying, "Unit not defined within defined class loadouts", which is a brilliant way of making sure a script is firing or not firing. Unfortunately, none of the soldiers have their gear changed; they're just vanilla Arma soldiers. At first, I thought it might be based on their unit side, like FIA could not wear AV Indus US Army uniforms and gear, so I switched the soldiers to non-guerrilla NATO BLUFOR types (B_Soldier_F", etc.). Still no luck. I double-checked both files to make sure all the "G" classnames were out and that the loadout classnames were the same as the spawn classnames, and they do match. I checked the mod to make sure it was enabled, and it was. So, if the soldiers are spawning and the HINT is appearing, can you imagine why their equipment isn't being changed? I'm stumped! Share this post Link to post Share on other sites
dreadedentity 278 Posted November 11, 2014 Firstly, my sincere thanks for the assistance - I greatly appreciate the help. Each time someone shares their knowledge in this way, I understand the entire coding structure a little bit better. This community really is the best! That being said, I was wondering if I could impose upon you for an additional bit of troubleshooting: As near as I can tell, these scripts are executing. When I trigger the spawn script, the units appear with the new createUnit commands no problem. It's clear that the loadout script (which I have called "loadout.sqf" as suggested) is executing, as the HINT appears saying, "Unit not defined within defined class loadouts", which is a brilliant way of making sure a script is firing or not firing. Unfortunately, none of the soldiers have their gear changed; they're just vanilla Arma soldiers. At first, I thought it might be based on their unit side, like FIA could not wear AV Indus US Army uniforms and gear, so I switched the soldiers to non-guerrilla NATO BLUFOR types (B_Soldier_F", etc.). Still no luck. I double-checked both files to make sure all the "G" classnames were out and that the loadout classnames were the same as the spawn classnames, and they do match. I checked the mod to make sure it was enabled, and it was. So, if the soldiers are spawning and the HINT is appearing, can you imagine why their equipment isn't being changed? I'm stumped! It sounds like you're not removing the soldier's current clothing Share this post Link to post Share on other sites
jshock 513 Posted November 11, 2014 Well that hint pops up for the default under the switch statment, meaning that there is an error reading the classnames of the units, or you don't have the correct classnames in the switch statment. Try adding -showScriptErrors in your Steam startup parameters and see what errors may pop up. Share this post Link to post Share on other sites
diehardfc 41 Posted November 11, 2014 I added that command to the parameters, but no errors appear onscreen. I also looked for a log, but couldn't find one. If it's not an imposition, here's the code in its entirety from the two scripts: The first is called by trigger: //null=["markerName"] execVM "fireteam.sqf"; //Put on a trigger //Spawns 1 Fireteam if (!isServer) exitWith {}; //Take variables _marker = _this select 0; _dest = _this select 1; _cycle = _this select 2; _spawnpos = [(getMarkerPos _marker select 0) + 10, getMarkerPos _marker select 1, getMarkerPos _marker select 2]; //Set up the group _group = createGroup west; sleep(1); //Begin spawning the squad _unit = _group createUnit ["B_Soldier_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //RIFLEMAN1 _unit = _group createUnit ["B_Soldier_TL_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //TEAM or SQUAD LEADER _unit = _group createUnit ["B_Soldier_LAT_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //AT SOLDIER _unit = _group createUnit ["B_Soldier_AR_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //AUTORIFLEMAN _unit = _group createUnit ["B_Soldier_M_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //MARKSMAN _unit = _group createUnit ["B_Soldier_AAR_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //RIFLEMAN2 _unit = _group createUnit ["B_Soldier_GL_F", (getMarkerPos _marker), [], 0, "CAN_COLLIDE"]; //GRENADIER //make sure the forEach is after all the createUnit commands { nul = [_x] execVM "loadout.sqf"; } forEach units _group; sleep(0.5); //Set the waypoint _wpZero = _group addWaypoint [(getMarkerPos _marker), 10]; _wpZero setWaypointType "MOVE"; _wpZero setWaypointFormation "LINE"; _wpZero setWaypointCompletionRadius 5; _wpOne = _group addWaypoint [(getMarkerPos _dest), 10]; _wpOne setWaypointType "MOVE"; _wpOne setWaypointCompletionRadius 5; if (_cycle) then { _wpTwo = _group addWaypoint [(getMarkerPos _marker), 1]; _wpTwo setWaypointCompletionRadius 5; _wpTwo setWaypointType "CYCLE"; _group setSpeedMode "LIMITED"; } else { _wpTwo = _group addWaypoint [(getMarkerPos _marker), 1]; _wpTwo setWaypointCompletionRadius 5; _wpTwo setWaypointType "GUARD"; }; _group setBehaviour "AWARE"; _group setCombatMode "YELLOW"; This is the second, called from within the script above: _unit = (_this select 0); switch (_unit) do { case (typeOf _unit == "B_Soldier_F"): { comment "Remove existing items for Rifleman"; removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; removeGoggles _unit; comment "Add containers"; _unit forceAddUniform "AV_CombatUniform2_OCP"; _unit addItemToUniform "FirstAidKit"; _unit addItemToUniform "Chemlight_green"; _unit addItemToUniform "HandGrenade"; _unit addVest "AV_PlateCarrier1_OCP"; for "_i" from 1 to 3 do {_unit addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {_unit addItemToVest "SmokeShell";}; _unit addItemToVest "SmokeShellBlue"; _unit addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {_unit addItemToVest "30Rnd_556x45_Stanag_Tracer_Red";}; _unit addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 10 do {_unit addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red";}; _unit addHeadgear "AV_ACH1_OCP"; comment "Add weapons"; _unit addWeapon "RH_M4A1_ris"; _unit addPrimaryWeaponItem "acc_pointer_IR"; _unit addPrimaryWeaponItem "RH_ta31rco"; _unit addWeapon "hgun_P07_F"; _unit addWeapon "Binocular"; comment "Add items"; _unit linkItem "ItemMap"; _unit linkItem "ItemCompass"; _unit linkItem "ItemWatch"; _unit linkItem "ItemRadio"; _unit linkItem "ItemGPS"; _unit linkItem "SP_Kneepads_Tan"; comment "Set identity"; _unit setFace "WhiteHead_18"; _unit setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_Soldier_TL_F"): { comment "Remove existing items for Team Leader"; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; comment "Add containers"; this forceAddUniform "AV_CombatUniform2_OCP_shortsleeve"; this addItemToUniform "FirstAidKit"; this addItemToUniform "Chemlight_green"; this addItemToUniform "HandGrenade"; this addVest "US_2010_Multicam_Modular2"; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addItemToVest "SmokeShellBlue"; this addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {this addItemToVest "RH_15Rnd_9x19_M9";}; for "_i" from 1 to 7 do {this addItemToVest "1Rnd_HE_Grenade_shell";}; for "_i" from 1 to 2 do {this addItemToVest "30Rnd_556x45_Stanag";}; this addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 8 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";}; this addItemToBackpack "30Rnd_556x45_Stanag"; this addHeadgear "AV_ACH3_OCP"; this addGoggles "G_Shades_Black"; comment "Add weapons"; this addWeapon "RH_M4A1_ris"; this addPrimaryWeaponItem "acc_pointer_IR"; this addPrimaryWeaponItem "RH_ta31rco"; this addWeapon "RH_m9"; this addWeapon "Binocular"; comment "Add items"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "ItemWatch"; this linkItem "ItemRadio"; this linkItem "ItemGPS"; this linkItem "SP_Kneepads_Tan"; comment "Set identity"; this setFace "AfricanHead_03"; this setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_Soldier_LAT_F"): { comment "Remove existing items for AT Soldier"; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; comment "Add containers"; this forceAddUniform "US_2010_Multicam_FieldUniform2"; this addItemToUniform "FirstAidKit"; this addItemToUniform "Chemlight_green"; this addItemToUniform "HandGrenade"; for "_i" from 1 to 3 do {this addItemToUniform "30Rnd_556x45_Stanag";}; this addVest "US_2010_Multicam_PlateCarrier"; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addItemToVest "SmokeShellBlue"; this addItemToVest "Chemlight_green"; for "_i" from 1 to 7 do {this addItemToVest "1Rnd_HE_Grenade_shell";}; for "_i" from 1 to 5 do {this addItemToVest "30Rnd_556x45_Stanag_Tracer_Red";}; this addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 8 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";}; for "_i" from 1 to 3 do {this addItemToBackpack "HandGrenade";}; for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShell";}; this addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red"; for "_i" from 1 to 4 do {this addItemToBackpack "STI_84MM_HE";}; for "_i" from 1 to 2 do {this addItemToBackpack "STI_84MM_HEAT";}; this addHeadgear "AV_ACH1_OCP"; comment "Add weapons"; this addWeapon "RH_M16A4"; this addPrimaryWeaponItem "RH_ta31rco"; this addWeapon "STI_MAAWS"; this addWeapon "RH_m9"; this addWeapon "Binocular"; comment "Add items"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "ItemWatch"; this linkItem "ItemRadio"; this linkItem "ItemGPS"; this linkItem "SP_Kneepads_Tan"; comment "Set identity"; this setFace "GreekHead_A3_09"; this setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_Soldier_AR_F"): { comment "Remove existing items for Autorifleman"; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; comment "Add containers"; this forceAddUniform "US_2010_Multicam_FieldUniform2"; this addItemToUniform "FirstAidKit"; this addItemToUniform "Chemlight_green"; this addItemToUniform "HandGrenade"; this addVest "US_2010_Multicam_PlateCarrier"; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addItemToVest "SmokeShellBlue"; this addItemToVest "Chemlight_green"; for "_i" from 1 to 7 do {this addItemToVest "1Rnd_HE_Grenade_shell";}; this addItemToVest "sti_100Rnd_762x51_Tracer"; this addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 8 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";}; for "_i" from 1 to 3 do {this addItemToBackpack "HandGrenade";}; for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShell";}; for "_i" from 1 to 5 do {this addItemToBackpack "sti_100Rnd_762x51_Tracer";}; this addItemToBackpack "sti_100Rnd_762x51"; this addHeadgear "US_2010_Multicam_ECHHelmet1"; this addGoggles "SP_Goggles_Black"; comment "Add weapons"; this addWeapon "STI_MK48MOD0"; this addPrimaryWeaponItem "RH_ta31rco"; this addWeapon "RH_m9"; this addWeapon "Binocular"; comment "Add items"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "ItemWatch"; this linkItem "ItemRadio"; this linkItem "ItemGPS"; this linkItem "SP_Kneepads_Tan"; comment "Set identity"; this setFace "WhiteHead_16"; this setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_Soldier_M_F"): { comment "Remove existing items for Marksman"; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; comment "Add containers"; this forceAddUniform "AV_CombatUniform2_OCP_shortsleeve"; this addItemToUniform "FirstAidKit"; this addItemToUniform "Chemlight_green"; this addItemToUniform "HandGrenade"; this addVest "US_2010_Multicam_Modular2"; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addItemToVest "SmokeShellBlue"; this addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {this addItemToVest "RH_15Rnd_9x19_M9";}; for "_i" from 1 to 7 do {this addItemToVest "1Rnd_HE_Grenade_shell";}; for "_i" from 1 to 2 do {this addItemToVest "hlc_20Rnd_762x51_B_M14";}; this addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 8 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";}; this addItemToBackpack "hlc_20Rnd_762x51_B_M14"; for "_i" from 1 to 9 do {this addItemToBackpack "hlc_20Rnd_762x51_T_M14";}; for "_i" from 1 to 3 do {this addItemToBackpack "HandGrenade";}; for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShell";}; this addHeadgear "US_2010_Multicam_PASGTHelmet1"; comment "Add weapons"; this addWeapon "hlc_rifle_M21"; this addPrimaryWeaponItem "hlc_optic_LRT_m14"; this addWeapon "RH_m9"; this addWeapon "Binocular"; comment "Add items"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "ItemWatch"; this linkItem "ItemRadio"; this linkItem "ItemGPS"; this linkItem "SP_Kneepads_Tan"; comment "Set identity"; this setFace "AsianHead_A3_02"; this setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_Soldier_AAR_F"): { comment "Remove existing items from Rifleman2"; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; comment "Add containers"; this forceAddUniform "AV_CombatUniform2_OCP_shortsleeve"; this addItemToUniform "FirstAidKit"; this addItemToUniform "16Rnd_9x21_Mag"; this addItemToUniform "Chemlight_green"; this addVest "AV_PlateCarrier1_OCP"; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addItemToVest "SmokeShellBlue"; this addItemToVest "Chemlight_green"; for "_i" from 1 to 4 do {this addItemToVest "30Rnd_556x45_Stanag_Tracer_Red";}; this addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 10 do {this addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red";}; this addHeadgear "US_2010_Multicam_PASGTHelmet2"; comment "Add weapons"; this addWeapon "RH_M4A1_ris"; this addPrimaryWeaponItem "acc_pointer_IR"; this addPrimaryWeaponItem "RH_ta31rco"; this addWeapon "STI_M136"; this addWeapon "Binocular"; comment "Add items"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "ItemWatch"; this linkItem "ItemRadio"; this linkItem "ItemGPS"; this linkItem "SP_Kneepads_Tan"; comment "Set identity"; this setFace "WhiteHead_18"; this setSpeaker "Male01ENG"; }; case (typeOf _unit == "B_Soldier_GL_F"): { comment "Remove existing items"; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; comment "Add containers"; this forceAddUniform "AV_CombatUniform2_OCP_shortsleeve"; this addItemToUniform "FirstAidKit"; this addItemToUniform "Chemlight_green"; this addItemToUniform "HandGrenade"; this addVest "US_2010_Multicam_Modular2"; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addItemToVest "SmokeShellBlue"; this addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {this addItemToVest "30Rnd_556x45_Stanag";}; for "_i" from 1 to 3 do {this addItemToVest "RH_15Rnd_9x19_M9";}; for "_i" from 1 to 7 do {this addItemToVest "1Rnd_HE_Grenade_shell";}; this addBackpack "AV_Kitbag_OCP"; for "_i" from 1 to 10 do {this addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red";}; for "_i" from 1 to 8 do {this addItemToBackpack "1Rnd_HE_Grenade_shell";}; this addHeadgear "AV_ACH2_OCP"; comment "Add weapons"; this addWeapon "RH_M4A1_ris_M203"; this addPrimaryWeaponItem "acc_pointer_IR"; this addPrimaryWeaponItem "RH_ta31rco"; this addWeapon "RH_m9"; this addWeapon "Binocular"; comment "Add items"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "ItemWatch"; this linkItem "ItemRadio"; this linkItem "ItemGPS"; this linkItem "SP_Kneepads_Tan"; comment "Set identity"; this setFace "WhiteHead_04"; this setSpeaker "Male01ENG"; }; default { hint "Unit not within defined class loadouts"; }; }; Share this post Link to post Share on other sites
jshock 513 Posted November 11, 2014 Ok for debug purposes, put a hint on line two of the loadout.sqf: _unit = (_this select 0); hint format ["%1", _unit];//<<this switch (_unit) do { case (typeOf _unit == "B_Soldier_F"): { ...... Share this post Link to post Share on other sites