vaaf_rup 0 Posted April 11, 2007 Hi, I've got a mission where the BLUEFOR squad has very limited equipment. I manipulate their loadout with the following script, called from a trigger with execVM: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeAllWeapons _this; _this addMagazine "15Rnd_9x19_M9SD"; _this addWeapon "M9SD"; _this addMagazine "SmokeShellRed"; This works OK, but the pistol is unusable (can't fire, can't reload) for a player unless he cycles through the smoke grenade and back to the pistol with the "F" key. No problem if you're aware of it. Seems to be a result of the script manipulation, which doesn't seem to "refresh" the internal knowledge of the equipment config. The annoyance is the AI, who are constantly reporting "out of ammo" even though they do have a magazine. Is there a simple way to force the game to refresh its knowledge of the loadout? Hope this makes sense. Thanks Share this post Link to post Share on other sites
Big Dawg KS 6 Posted April 12, 2007 Try adding the weapon last (after all other magazines are added). Share this post Link to post Share on other sites
fasad 1 Posted April 12, 2007 This first problem is caused by not selecting the pistol as the current weapon. add something like this to the end of the script:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"><unit> selectWeapon "M9SD" The out of ammo calls are caused by the units having very low ammo! I don't know of a way to shut them up other than giving them more. Share this post Link to post Share on other sites
vaaf_rup 0 Posted April 12, 2007 Accept that the AI are low on ammo, so that is why they're complaining. I was just confused that they reported both "low ammo" and "out of ammo". I have tried both of these suggestions with the following script modification: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// equips a standard running man removeAllWeapons _this; _this addMagazine "SmokeShellRed"; _this addMagazine "15Rnd_9x19_M9SD"; _this addWeapon "M9SD"; _this selectWeapon "M9SD"; and it doesn't make a difference to the weapon behaviour; i.e. the pistol is still unusable until I cycle F. You can check it out for yourself: join the mission "Running Man" on the public server "VAAF Public Server 2 (ruprecht)". Any more ideas? Share this post Link to post Share on other sites
fasad 1 Posted April 12, 2007 I tested the script suggested as a single line on activation block for a radio trigger. Adding the extra line allowed the player to instantaneously fire the pistol as expected. trigger On activation code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{removeAllWeapons _x; _x addMagazine "SmokeShellRed"; _x addMagazine "15Rnd_9x19_M9SD"; _x addWeapon "M9SD"; _x selectWeapon "M9SD"} forEach (units (group player)) However, now I've re-tested it, I note the AI will not fire the M9SD except at very close range. Share this post Link to post Share on other sites
vaaf_rup 0 Posted April 12, 2007 Hmm, I wonder if it's the fact that I'm calling it in an external script with execVM that makes the difference? Share this post Link to post Share on other sites
TiGGa 0 Posted April 12, 2007 I have a similar problem with weapons carrying a grenade launcher (like the M16A4 with M203). I'm adding magazines first and then the weapon. Each time though I won't see the ammunition count in the top left though. I have to cycle through the firing modes with "F". There is no problem with other weapons though, only with grenade launchers. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeAllWeapons player; for [{_a=0},{_a<6},{_a=_a+1}] do { player addMagazine "30Rnd_556x45_Stanag"; }; for [{_a=0},{_a<3},{_a=_a+1}] do { player addMagazine "HandGrenadeTimed"; }; for [{_a=0},{_a<4},{_a=_a+1}] do { player addMagazine "1Rnd_HE_M203"; }; player addMagazine "FlareWhite_M203"; player addMagazine "FlareGreen_M203"; player addMagazine "FlareRed_M203"; player addMagazine "FlareYellow_M203"; player addMagazine "SmokeShell"; player addMagazine "SmokeShellGreen"; player addMagazine "SmokeShellRed"; player addWeapon "Binocular"; player addWeapon "NVGoggles"; player addWeapon "M16A4_GL"; player selectWeapon "M16A4_GL"; Share this post Link to post Share on other sites
fasad 1 Posted April 12, 2007 Aha! The selectWeapon command seems to actually be a selectMuzzle command. try: <unit> selectWeapon "M16Muzzle" To find weapon muzzles, use this EV in the init line: this addEventHandler ["fired", {hint format["weapon = %1\nmuzzle = %2",_this select 1, _this select 2]}] If someone can confirm this, I'll fix the wiki article Share this post Link to post Share on other sites
TiGGa 0 Posted April 12, 2007 Confirmed. I tried player selectWeapon "M16Muzzle"; and it worked. Share this post Link to post Share on other sites
vaaf_rup 0 Posted April 12, 2007 ... but then why doesn't it work for pistols? Share this post Link to post Share on other sites
fasad 1 Posted April 13, 2007 It works as expected. I cannot reproduce any problems using this sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{removeAllWeapons _x; _x addMagazine "SmokeShellRed"; _x addMagazine "15Rnd_9x19_M9SD"; _x addWeapon "M9SD"; _x selectWeapon "M9SD"} forEach (units (group player)) Share this post Link to post Share on other sites
vaaf_rup 0 Posted April 13, 2007 Fasad, the only difference between mine and yours is I'm calling an external script via execVM and you're putting the code right there in the forEach. My pistols don't work, your pistols do. Does anybody know why? I'm off to try Fasad's method before my brain explodes. Share this post Link to post Share on other sites
fasad 1 Posted April 13, 2007 Can you explain exactly how you are executing your script? I've executed your exact code (with the additional switchWeapon line) in every method I know of, and they all work perfectly. On activation strings, exec'ing a sqs, execVM'ing a sqf, and calling a compiled sqf, both directly in the editor and as commands within another script file. Share this post Link to post Share on other sites