lozz08 10 Posted January 1, 2011 I want to be able to instantly add a weapon to a soldier in-game. But when I try to do so by an in-game trigger, a strange problem occurs. The gun is given to me, but I cannot fire it, or look down the sights. In order to use the weapon, I must then drop then weapon and pick it up again. When I pick the weapon up again, my soldier goes through the animation of changing to a rocket launcher weapon before unslinging his rifle and holding it. Seems pretty strange... Share this post Link to post Share on other sites
sxp2high 22 Posted January 1, 2011 You have to remove the old weapon first... OldWeapon = primaryWeapon player; player removeWeapon OldWeapon; player addWeapon "NewGun"; Share this post Link to post Share on other sites
lozz08 10 Posted January 1, 2011 Ah, you champion, it works. Before I was using removeallweapons _caller command in my .sqs file but it didn't work. Share this post Link to post Share on other sites
galzohar 31 Posted January 2, 2011 (edited) Also sometimes you need to select the new weapon - That is, add a player selectWeapon "NewGun"; command at the end. In order to make this work for primary weapons with a grenade launcher, use this at the end instead of the above: _primaryWeapon = primaryWeapon player; if (_primaryWeapon!="") then { player selectweapon _primaryWeapon; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primaryWeapon >> "muzzles"); player selectWeapon (_muzzles select 0); }; Of course if the unit doesn't have a primary weapon (ex, if you added a pistol and he has no primary weapon), then you need to first add the first command (player selectWeapon "NewGun";) and then add this code. It will select whatever primaryWeapon returns and then if the unit has a primary weapon with a GL it'll correctly pick the right muzzle for it. Edited January 2, 2011 by galzohar Share this post Link to post Share on other sites