wiggum2 31 Posted December 16, 2011 Hi ! I use this script to respawn players with the same loadout they died with and it works. As you can see i already have a "selectWeapon" part. private ["_unit","_corpse","_w","_m","_b","_bm","_bw","_structure","_type","_muzzles"]; _unit = _this select 0; _corpse = _this select 1; // Get weapons from corpse _w = weapons _corpse; _m = magazines _corpse; _b = typeOf unitBackpack _corpse; _bm = getMagazineCargo unitBackpack _corpse; _bw = getWeaponCargo unitBackpack _corpse; deleteVehicle _corpse; // Structure of action text _structure="<t font='EtelkaMonospaceProBold' size='0.8' color='#885555ff'>"; // Give the unit the weapons back removeAllWeapons _unit; removeAllItems _unit; removeBackpack _unit; { _unit addmagazine _x } foreach _m; { _unit addweapon _x } foreach _w; if(_b != "") then { _unit addBackpack _b; clearWeaponCargo (unitBackpack _unit); clearMagazineCargo (unitBackpack _unit); for "_i" from 0 to (count (_bm select 0) - 1) do { (unitBackpack _unit) addMagazineCargo [(_bm select 0) select _i,(_bm select 1) select _i]; }; for "_i" from 0 to (count (_bw select 0) - 1) do { (unitBackpack _unit) addWeaponCargo [(_bw select 0) select _i,(_bw select 1) select _i]; }; }; sleep 0.1; // Select a correct weapon if (count weapons _unit > 0) then { if ((primaryWeapon _unit) != "") then { _type = primaryWeapon _unit; _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles"); if (count _muzzles > 1) then { _unit selectWeapon (_muzzles select 0); } else { _unit selectWeapon _type; }; } else { _type = ((weapons _unit) select 0); _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles"); if (count _muzzles > 1) then { _unit selectWeapon (_muzzles select 0); } else { _unit selectWeapon _type; }; }; }; Now the problem is that after respawn the player has to press the F key (switch weapons) twice to select a weapon. He always respawns with no weapon selected (regardless of which weapon) Is this a ArmA bug or did i miss something ? Share this post Link to post Share on other sites
celery 8 Posted December 16, 2011 Do a hintSilent format ["%1\n%2",_muzzles,_type]; after they're both defined and report what it says. The sleep is unnecessary btw. Share this post Link to post Share on other sites
wiggum2 31 Posted December 16, 2011 The hint shows: ["this","M203Muzzle"] M4A1_HWS_GL_camo Share this post Link to post Share on other sites
celery 8 Posted December 16, 2011 if (count _muzzles > 1) then { -> if !("this" in _muzzles) then { :) Share this post Link to post Share on other sites
zonekiller 171 Posted December 16, 2011 _unit selectWeapon primaryWeapon _unit; right at the end that should be all you need Share this post Link to post Share on other sites
celery 8 Posted December 16, 2011 _unit selectWeapon primaryWeapon _unit;right at the end that should be all you need Some weapons (such as G36) don't recognize their own classname as their primary muzzle, so it's better to have a more elaborate solution for maximum compatibility. Share this post Link to post Share on other sites