AdirB 18 Posted November 16, 2015 Hello, I've tried to give gear for specific unit classname but it didn't work. I did this: if ((typeOf player) isEqualTo 'B_officer_F') then { removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; removeGoggles this; for "_i" from 1 to 3 do {this addItemToUniform "ACE_fieldDressing";}; this addItemToUniform "ACE_EarPlugs"; for "_i" from 1 to 3 do {this addItemToUniform "16Rnd_9x21_Mag";}; this addItemToUniform "RH_30Rnd_556x45_M855A1"; for "_i" from 1 to 4 do {this addItemToVest "RH_30Rnd_556x45_M855A1";}; for "_i" from 1 to 3 do {this addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {this addItemToVest "Chemlight_red";}; for "_i" from 1 to 3 do {this addItemToVest "rhs_mag_mk84";}; for "_i" from 1 to 2 do {this addItemToVest "SmokeShell";}; this addWeapon "RH_M16A2"; this addWeapon "hgun_Rook40_F"; this linkItem "ItemMap"; this linkItem "ItemCompass"; this linkItem "tf_microdagr"; this linkItem "tf_anprc152_2"; }; Please, someone can tell me the right way to do that? Share this post Link to post Share on other sites
davidoss 552 Posted November 16, 2015 if ((typeOf player) == "B_officer_F") then { removeAllWeapons player; removeAllItems player; removeAllAssignedItems player; removeUniform player; removeVest player; removeBackpack player; removeHeadgear player; removeGoggles player; player forceAddUniform "U_B_CombatUniform_mcam"; for "_i" from 1 to 3 do {player addItemToUniform "ACE_fieldDressing";}; player addItemToUniform "ACE_EarPlugs"; for "_i" from 1 to 3 do {player addItemToUniform "16Rnd_9x21_Mag";}; player addItemToUniform "RH_30Rnd_556x45_M855A1"; player addVest "V_PlateCarrier_Kerry"; for "_i" from 1 to 4 do {player addItemToVest "RH_30Rnd_556x45_M855A1";}; for "_i" from 1 to 3 do {player addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {player addItemToVest "Chemlight_red";}; for "_i" from 1 to 3 do {player addItemToVest "rhs_mag_mk84";}; for "_i" from 1 to 2 do {player addItemToVest "SmokeShell";}; player addWeapon "RH_M16A2"; player addWeapon "hgun_Rook40_F"; player linkItem "ItemMap"; player linkItem "ItemCompass"; player linkItem "tf_microdagr"; player linkItem "tf_anprc152"; }; You forgot add the uniform and vest before adding items. This code need to be run from initPlayerLocal.sqf The variable player not exist server side If type of player then scope is player The item "tf_anprc152_2" not exist correct one is "tf_anprc152" TFR changes the radio classname in player inventory to unique one on server Share this post Link to post Share on other sites
schadler17 36 Posted November 16, 2015 // Player Loadouts Via Classnames // Written by Schadler.C private ["_unit", "_type", "_side"]; _unit = _this select 0; _type = (typeOf _unit); _side = (side _unit); // Remove Starting Items removeallWeapons _unit; removeAllAssignedItems _unit; removeBackpack _unit; // Common Items _unit addWeapon "ItemMap"; _unit addWeapon "ItemCompass"; _unit addWeapon "ItemWatch"; _unit addItem "FirstAidKit"; // Start Gear Assignment switch (_side) do { // Blufor Loadout case west: { // Common WEST Gear _unit addWeapon "NVGoggles"; // Common Ammo/Items/etc here if needed. switch (_type) do { // Commander case "rhsusf_usmc_marpat_d_officer": { // Backpack/Radio _unit addBackpack "tf_rt1523g_big_rhs"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "optic_Hamr"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "ItemGPS"; _unit linkItem "tf_anprc152"; _unit addWeapon "Laserdesignator"; _unit addMagazine "LaserBatteries"; }; // Squad Leader case "rhsusf_usmc_marpat_d_squadleader": { // Backpack/Radio _unit addBackpack "tf_rt1523g_big_rhs"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "optic_Hamr"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "ItemGPS"; _unit linkItem "tf_anprc152"; _unit addWeapon "Laserdesignator"; _unit addMagazine "LaserBatteries"; }; // Team Leader case "rhsusf_usmc_marpat_d_teamleader": { // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit addWeapon "Binocular"; _unit linkItem "tf_anprc152"; }; // UAV Operator case "rhsusf_usmc_marpat_d_uav": { // Backpack/Radio _unit addBackpack "tf_rt1523g_big_rhs"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; // Items _unit linkItem "B_UavTerminal"; _unit linkItem "tf_anprc152"; }; // Rifleman case "rhsusf_usmc_marpat_d_rifleman": { // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "optic_Hamr"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit addWeapon "Binocular"; _unit linkItem "tf_anprc152"; }; // Medic case "rhsusf_usmc_marpat_d_rifleman_light": { // Backpack _unit addBackpack "B_kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShell", 8]; _unit addMagazines ["rhs_mag_m67", 2]; // Items _unit linkItem "tf_anprc152"; (unitbackpack _unit) addItemCargoGlobal ["FirstAidKit", 15]; _unit addItem "Medikit"; _unit addWeapon "Binocular"; }; // Grenadier case "rhsusf_usmc_marpat_d_grenadier": { // Weapons _unit addWeapon "rhs_weap_m4a1_m320"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_mag_M441_HE", 8]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Combat Engineer case "rhsusf_usmc_marpat_d_engineer": { // Backpack _unit addBackpack "B_kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["DemoCharge_Remote_Mag", 5]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; _unit linkItem "MineDetector"; }; // Light MG case "rhsusf_usmc_marpat_d_autorifleman_m249": { // Backpack _unit addBackpack "B_Kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m249_pip_L"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhsusf_100Rnd_556x45_soft_pouch", 6]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Heavy MG case "rhsusf_usmc_marpat_d_machinegunner": { // Backpack _unit addBackpack "B_Kitbag_rgr"; // Weapons _unit addWeapon ""; _unit addPrimaryWeaponItem ""; // Ammo _unit addMagazines ["", 0]; _unit addMagazines ["rhs_mag_m67", 0]; _unit addMagazines ["SmokeShell", 0]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Light AT case "rhsusf_usmc_marpat_d_riflemanat": { // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; _unit addWeapon "rhs_weap_M136"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_m136_mag", 1]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Heavy AT case "rhsusf_usmc_marpat_d_javelin": { // Backpack _unit addBackpack "B_Kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; _unit addWeapon "rhs_weap_fgm148"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_fgm148_Magazines_AT", 2]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Marksman case "rhsusf_usmc_marpat_d_marksman": { // Weapons _unit addWeapon "rhs_weap_m14ebrri_leu"; _unit addPrimaryWeaponItem "rhsusf_acc_LEUPOLDMK4"; // Ammo _unit addMagazines ["rhsusf_20Rnd_762x51_m118_special_Mag", 8]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Sniper case "rhsusf_usmc_marpat_d_sniper": { // Remove Default Uniform removeUniform _unit; removeGoggles _unit; removeVest _unit; removeHeadgear _unit; removeAllAssignedItems _unit; // Uniform _unit addUniform "U_B_GhillieSuit"; _unit addHeadgear "rhs_Booniehat_marpatwd"; _unit addVest "rhsusf_spc_marksman"; // Weapons _unit addWeapon "rhs_weap_XM2010"; _unit addPrimaryWeaponItem "rhsusf_acc_LEUPOLDMK4_2"; _unit addPrimaryWeaponItem "rhsusf_acc_harris_bipod"; // Ammo _unit addMagazines ["rhsusf_5Rnd_300winmag_xm2010", 10]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Rangefinder"; }; // Crewman case "rhsusf_usmc_marpat_d_crewman": { // Weapons _unit addWeapon "rhs_weap_m4a1"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["SmokeShell", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; _unit linkItem "ItemGPS"; }; // Heli Pilot case "rhsusf_usmc_marpat_d_helipilot": { // Parachute _unit addBackpack "B_Parachute"; // Weapons _unit addWeapon "rhs_weap_m4a1"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["SmokeShell", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; _unit linkItem "ItemGPS"; }; // Default default {/*Default Loadout or Error Message*/}; }; }; // Opfor Loadout case east: { /* EAST LOADOUT HERE! */ }; case guer: { /* RESISTANCE LOADOUT HERE! */ }; case civ: { /* CIV LOADOUT HERE! */ }; }; Something I've made and never released. Multiple Classnames can be defined with different loadouts for each. Called for in initPlayerLocal.sqf: _nil = [player] execVM "scripts\units\defaultGear.sqf"; Share this post Link to post Share on other sites
Mamba Six 11 Posted November 16, 2015 Just note that isEqualTo is case-specific, so capitalization matters. The engine may not necessarily return the exact string. Therefore, the == operator is better as it ignores capitalization for strings. Another implementation is to use if (toUpper(_object) isEqualTo "B_OFFICER_F") then { ... };.Sent from my SM-G900V using Tapatalk Share this post Link to post Share on other sites
AdirB 18 Posted November 16, 2015 if ((typeOf player) == "B_officer_F") then { removeAllWeapons player; removeAllItems player; removeAllAssignedItems player; removeUniform player; removeVest player; removeBackpack player; removeHeadgear player; removeGoggles player; player forceAddUniform "U_B_CombatUniform_mcam"; for "_i" from 1 to 3 do {player addItemToUniform "ACE_fieldDressing";}; player addItemToUniform "ACE_EarPlugs"; for "_i" from 1 to 3 do {player addItemToUniform "16Rnd_9x21_Mag";}; player addItemToUniform "RH_30Rnd_556x45_M855A1"; player addVest "V_PlateCarrier_Kerry"; for "_i" from 1 to 4 do {player addItemToVest "RH_30Rnd_556x45_M855A1";}; for "_i" from 1 to 3 do {player addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {player addItemToVest "Chemlight_red";}; for "_i" from 1 to 3 do {player addItemToVest "rhs_mag_mk84";}; for "_i" from 1 to 2 do {player addItemToVest "SmokeShell";}; player addWeapon "RH_M16A2"; player addWeapon "hgun_Rook40_F"; player linkItem "ItemMap"; player linkItem "ItemCompass"; player linkItem "tf_microdagr"; player linkItem "tf_anprc152"; }; You forgot add the uniform and vest before adding items. This code need to be run from initPlayerLocal.sqf The variable player not exist server side If type of player then scope is player The item "tf_anprc152_2" not exist correct one is "tf_anprc152" TFR changes the radio classname in player inventory to unique one on server // Player Loadouts Via Classnames // Written by Schadler.C private ["_unit", "_type", "_side"]; _unit = _this select 0; _type = (typeOf _unit); _side = (side _unit); // Remove Starting Items removeallWeapons _unit; removeAllAssignedItems _unit; removeBackpack _unit; // Common Items _unit addWeapon "ItemMap"; _unit addWeapon "ItemCompass"; _unit addWeapon "ItemWatch"; _unit addItem "FirstAidKit"; // Start Gear Assignment switch (_side) do { // Blufor Loadout case west: { // Common WEST Gear _unit addWeapon "NVGoggles"; // Common Ammo/Items/etc here if needed. switch (_type) do { // Commander case "rhsusf_usmc_marpat_d_officer": { // Backpack/Radio _unit addBackpack "tf_rt1523g_big_rhs"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "optic_Hamr"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "ItemGPS"; _unit linkItem "tf_anprc152"; _unit addWeapon "Laserdesignator"; _unit addMagazine "LaserBatteries"; }; // Squad Leader case "rhsusf_usmc_marpat_d_squadleader": { // Backpack/Radio _unit addBackpack "tf_rt1523g_big_rhs"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "optic_Hamr"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "ItemGPS"; _unit linkItem "tf_anprc152"; _unit addWeapon "Laserdesignator"; _unit addMagazine "LaserBatteries"; }; // Team Leader case "rhsusf_usmc_marpat_d_teamleader": { // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit addWeapon "Binocular"; _unit linkItem "tf_anprc152"; }; // UAV Operator case "rhsusf_usmc_marpat_d_uav": { // Backpack/Radio _unit addBackpack "tf_rt1523g_big_rhs"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; // Items _unit linkItem "B_UavTerminal"; _unit linkItem "tf_anprc152"; }; // Rifleman case "rhsusf_usmc_marpat_d_rifleman": { // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "optic_Hamr"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit addWeapon "Binocular"; _unit linkItem "tf_anprc152"; }; // Medic case "rhsusf_usmc_marpat_d_rifleman_light": { // Backpack _unit addBackpack "B_kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["SmokeShell", 8]; _unit addMagazines ["rhs_mag_m67", 2]; // Items _unit linkItem "tf_anprc152"; (unitbackpack _unit) addItemCargoGlobal ["FirstAidKit", 15]; _unit addItem "Medikit"; _unit addWeapon "Binocular"; }; // Grenadier case "rhsusf_usmc_marpat_d_grenadier": { // Weapons _unit addWeapon "rhs_weap_m4a1_m320"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_mag_M441_HE", 8]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Combat Engineer case "rhsusf_usmc_marpat_d_engineer": { // Backpack _unit addBackpack "B_kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["DemoCharge_Remote_Mag", 5]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; _unit linkItem "MineDetector"; }; // Light MG case "rhsusf_usmc_marpat_d_autorifleman_m249": { // Backpack _unit addBackpack "B_Kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m249_pip_L"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; // Ammo _unit addMagazines ["rhsusf_100Rnd_556x45_soft_pouch", 6]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Heavy MG case "rhsusf_usmc_marpat_d_machinegunner": { // Backpack _unit addBackpack "B_Kitbag_rgr"; // Weapons _unit addWeapon ""; _unit addPrimaryWeaponItem ""; // Ammo _unit addMagazines ["", 0]; _unit addMagazines ["rhs_mag_m67", 0]; _unit addMagazines ["SmokeShell", 0]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Light AT case "rhsusf_usmc_marpat_d_riflemanat": { // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; _unit addWeapon "rhs_weap_M136"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_m136_mag", 1]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Heavy AT case "rhsusf_usmc_marpat_d_javelin": { // Backpack _unit addBackpack "B_Kitbag_rgr"; // Weapons _unit addWeapon "rhs_weap_m4a1_grip"; _unit addPrimaryWeaponItem "rhsusf_acc_SFMB556"; _unit addPrimaryWeaponItem "rhsusf_acc_compm4"; _unit addWeapon "rhs_weap_fgm148"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red", 2]; _unit addMagazines ["rhs_fgm148_Magazines_AT", 2]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Marksman case "rhsusf_usmc_marpat_d_marksman": { // Weapons _unit addWeapon "rhs_weap_m14ebrri_leu"; _unit addPrimaryWeaponItem "rhsusf_acc_LEUPOLDMK4"; // Ammo _unit addMagazines ["rhsusf_20Rnd_762x51_m118_special_Mag", 8]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; }; // Sniper case "rhsusf_usmc_marpat_d_sniper": { // Remove Default Uniform removeUniform _unit; removeGoggles _unit; removeVest _unit; removeHeadgear _unit; removeAllAssignedItems _unit; // Uniform _unit addUniform "U_B_GhillieSuit"; _unit addHeadgear "rhs_Booniehat_marpatwd"; _unit addVest "rhsusf_spc_marksman"; // Weapons _unit addWeapon "rhs_weap_XM2010"; _unit addPrimaryWeaponItem "rhsusf_acc_LEUPOLDMK4_2"; _unit addPrimaryWeaponItem "rhsusf_acc_harris_bipod"; // Ammo _unit addMagazines ["rhsusf_5Rnd_300winmag_xm2010", 10]; _unit addMagazines ["rhs_mag_m67", 2]; _unit addMagazines ["SmokeShell", 2]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Rangefinder"; }; // Crewman case "rhsusf_usmc_marpat_d_crewman": { // Weapons _unit addWeapon "rhs_weap_m4a1"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["SmokeShell", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; _unit linkItem "ItemGPS"; }; // Heli Pilot case "rhsusf_usmc_marpat_d_helipilot": { // Parachute _unit addBackpack "B_Parachute"; // Weapons _unit addWeapon "rhs_weap_m4a1"; // Ammo _unit addMagazines ["rhs_mag_30Rnd_556x45_M855A1_Stanag", 5]; _unit addMagazines ["SmokeShell", 2]; _unit addMagazines ["SmokeShellRed", 1]; _unit addMagazines ["SmokeShellOrange", 1]; _unit addMagazines ["SmokeShellBlue", 1]; // Items _unit linkItem "tf_anprc152"; _unit addWeapon "Binocular"; _unit linkItem "ItemGPS"; }; // Default default {/*Default Loadout or Error Message*/}; }; }; // Opfor Loadout case east: { /* EAST LOADOUT HERE! */ }; case guer: { /* RESISTANCE LOADOUT HERE! */ }; case civ: { /* CIV LOADOUT HERE! */ }; }; Something I've made and never released. Multiple Classnames can be defined with different loadouts for each. Called for in initPlayerLocal.sqf: _nil = [player] execVM "scripts\units\defaultGear.sqf"; Just note that isEqualTo is case-specific, so capitalization matters. The engine may not necessarily return the exact string. Therefore, the == operator is better as it ignores capitalization for strings. Another implementation is to use if (toUpper(_object) isEqualTo "B_OFFICER_F") then { ... };.Sent from my SM-G900V using Tapatalk Thank you all :) is there something I can do to make 'player' work on server side? Maybe if I add "if(Isserver)"? Share this post Link to post Share on other sites
davidoss 552 Posted November 16, 2015 This is hard to understand for new scriptwriter. If you write a script with variable player you need run this script only on server clients Server side we using isPlayer or Playableunits and more others Share this post Link to post Share on other sites
AdirB 18 Posted November 16, 2015 This is hard to understand for new scriptwriter. If you write a script with variable player you need run this script only on server clients Server side we using isPlayer or Playableunits and more others I think I understand. 'Player' variable works only on units that are in use by clients, I got it right? Is there another way to write this script to make in MP? Share this post Link to post Share on other sites
R3vo 2654 Posted November 16, 2015 I think I understand. 'Player' variable works only on units that are in use by clients, I got it right? Is there another way to write this script to make in MP? Read this http://killzonekid.com/arma-scripting-tutorials-basic-multiplayer-coding-v2/ KK basically answers all the questions in this paper. Share this post Link to post Share on other sites
davidoss 552 Posted November 16, 2015 your script works in MP but you need to run it from initPlayerLocal.sqf. This file is executed only by server clients at connect. It is like init.sqf but for clients only. or you can run the code from bottom init.sqf but you need to add statements for .e.g: if (hasInterface) then { waitUntil {!isnull player}; waitUntil {alive player}; code... }; Share this post Link to post Share on other sites
AdirB 18 Posted November 17, 2015 your script works in MP but you need to run it from initPlayerLocal.sqf. This file is executed only by server clients at connect. It is like init.sqf but for clients only. or you can run the code from bottom init.sqf but you need to add statements for .e.g: if (hasInterface) then { waitUntil {!isnull player}; waitUntil {alive player}; code... }; if the file initPlayerLocal.sqf can be executed in multiplayer then I guess it's ok. because if the players are not conntected there's no point to make the server execut the gear that not in use. Share this post Link to post Share on other sites