Jump to content
Sign in to follow this  
epicgoldenwarrior

Loadout script not working

Recommended Posts

Seems to work for blufor, doesnt give opfor any weapons though, why?:

waitUntil {!isNull player};

_unit = _this select 0;
removeallweapons _unit;
removeallcontainers _unit;

_unit unassignitem "NVGoggles_OPFOR";
_unit adduniform "U_OG_Guerilla2_1"; 
_unit addvest "V_Chestrig_blk"; 
_unit addheadgear "H_Watchcap_blk"; 
_unit addmagazines ["30Rnd_9x21_Mag", 5];   
_unit addmagazines [""9Rnd_45ACP_Mag", 3]; 
_unit addweapon "SMG_02_ACO_F";
_unit addweapon "hgun_ACPC2_F";  
_unit addPrimaryWeaponItem "optic_ACO_grn"; 
_unit addPrimaryWeaponItem "acc_flashlight"; 
_unit additem "FirstAidKit";


if(true) exitWith{};

this is activated via eventhandler, and it works but weapons dont come up. Why?

Share this post


Link to post
Share on other sites

Don't know if it could be the issue but the following line has two double quotes at the beginning of the classname and a single double quote at the end.

_unit addmagazines [""9Rnd_45ACP_Mag", 3]; 

Share this post


Link to post
Share on other sites

Well it's right before the add weapon lines, so if the script errors out at that line, it won't run the following lines after (I would think).

Share this post


Link to post
Share on other sites

Try something like this. It's what we use and it's very robust.

_class = typeOf _this;

comment "Remove existing items";
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;

switch _class do {

case "O_Soldier_TL_F": {

	comment "Team Lead";
	comment "Add containers";
	_this forceAddUniform "MNP_CombatUniform_RU_Med_DB";
	for "_i" from 1 to 2 do {_this addItemToUniform "AGM_Bandage";};
	_this addItemToUniform "AGM_MapTools";
	_this addItemToUniform "AGM_Epipen";
	for "_i" from 1 to 3 do {_this addItemToUniform "hlc_30Rnd_545x39_EP_AK";};
	_this addVest "MNP_Vest_RU_D2";
	_this addItemToVest "AGM_Morphine";
	for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
	for "_i" from 1 to 2 do {_this addItemToVest "SmokeShellred";};
	_this addItemToVest "AGM_Bandage";
	for "_i" from 1 to 8 do {_this addItemToVest "hlc_30Rnd_545x39_EP_AK";};
	_this addHeadgear "MNP_MilCap_RU_D";

	comment "Add weapons";
	_this addWeapon "hlc_rifle_ak12";

	comment "Add items";
	_this linkItem "ItemMap";
	_this linkItem "ItemCompass";
	_this linkItem "tf_microdagr";
	_this linkItem "tf_fadak";
	_this linkItem "ItemGPS";
	_this linkItem "AGM_Vector";
};
};

For every class you want to customize. We run full custom gear as you can see from the classnames so we switch every player/ai with a command like:

_somegearplease = player execVM "class.sqf";

for players, executed in onplayerrespawn.sqf because of our JiP settings

{
if (side _x == east) then 
{
	_x execVM "aiGear.sqf";
};
} 	forEach allUnits;

for (opfor) ai, executed in initserver.sqf

This works perfectly in a listen or dedicated environment.

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
Sign in to follow this  

×