Jump to content
Sign in to follow this  
meatshield

Need help making loadout scrip work with JIP players

Recommended Posts

Howdy,

I've got a fully working loadout script which works just fine when players pick a slot before the mission starts, then the mission is started, everyone gets what there supposed to. However if someone comes AFTER the mission has started, or died, backed out, picked another slot, and re-joined, it doesnt work :(

Heres the loadout script with the only the first loadout included -

_unit = _this select 0;
_strLoadout = _this select 1;

if (!isServer) exitWith {};

removeAllWeapons _unit;
removeAllAssignedItems  _unit;
removebackpack _unit;
removeGoggles _unit;
removeHeadgear _unit;

switch (_strLoadout) do
{
case "rifleman":
{
// Add clothing
	_unit addUniform "U_O_CombatUniform_ocamo";
	_unit addHeadgear "H_HelmetO_ocamo";
	_unit addVest "V_HarnessO_brn";
	_unit addBackpack "B_AssaultPack_ocamo";

// Add weapons & grenades
	_unit addMagazines ["30Rnd_65x39_caseless_green", 10];
	_unit addWeapon "arifle_Katiba_F";
	_unit addPrimaryWeaponItem "acc_pointer_IR";
	_unit addPrimaryWeaponitem "optic_ARCO";

	_unit addMagazines ["HandGrenade", 2];

// Add items 
	_unit addItem "NVGoggles_OPFOR";  
	_unit assignItem "NVGoggles_OPFOR";
	_unit addItem "ItemRadio";  
	_unit assignItem "ItemRadio";  
	_unit addItem "ItemCompass";  
	_unit assignItem "ItemCompass";  
	_unit addItem "ItemMap";  
	_unit assignItem "ItemMap";  		
	_unit addItem "ItemWatch";  
	_unit assignItem "ItemWatch";  		
	_unit addItem "ItemGPS"; 
	_unit assignItem "ItemGPS"; 
	_unit addItem "FirstAidKit";
	_unit addItem "FirstAidKit";
	_unit addItem "FirstAidKit";
	_unit addItem "FirstAidKit";
};
};


_primaryWeapon = primaryWeapon _unit;
_unit selectweapon _primaryWeapon;
// Fix for weapons with grenade launcher
_muzzles = getArray(configFile>>"cfgWeapons" >> _primaryWeapon >> "muzzles");
_unit selectWeapon (_muzzles select 0);

The script is called from the init file of each player, with

null = [this, "rifleman"] call compile preprocessFile "kitout.sqf"

.

The script has the loadouts for every role in it, which makes it really easy to change and make sure they match, so i'd like to keep it that way if possible. Anyone have any ideas what i'm doing wrong that isnt making it work with JIP players? :confused:

Share this post


Link to post
Share on other sites

Try removing the isServer check

---------- Post added at 09:09 AM ---------- Previous post was at 09:08 AM ----------

Or have it check for

if (!local _unit) exitWith {};

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  

×