Jump to content
The Real Bunc

Unexpected Command behaviour: magazinesTurret with MK6 Mortar

Recommended Posts

I've been doing some work with mortars and I have come across a very strange ( and I would suggest broken) behaviour with the MK6 mortar and the use of the command magazinesTurret and I wonder if anyone can throw some light on this as it appears that the command isn't working ( at least with the MK6)

 

Place a MK6 mortar ( w or w/o gunner) - name it mortar1

In attributes make sure its fully armed

mortar1 magazinesTurret [0]         - Result > array including the 8Rnd Mo shell magazines, and flares and smoke as expected. All good.

{_x=="8Rnd_82mm_Mo_shells"} count (mortar1 magazinesTurret [0])      - counts the number of 8Rnd magazines and produces the answer 4 if Mk6 is fully loaded.

 

Now set Ammunition to 0 in attributes ( you can check that there is indeed zero ammunition if you are in the MK6.)

Now run the same two code snips again.

mortar1 magazinesTurret [0]  - Result is array ["8Rnd_82mm_M0_shells"]  !!!!!!   and

{_x=="8Rnd_82mm_Mo_shells"} count (mortar1 magazinesTurret [0])    -  gives the result 1 !!!!!!

 

In other words when the MK6 is completely empty of ammo the magazinesTurret command is still reporting a magazine of shells!

(Note I've checked the turret path and it's correct)

 

Anyone any ideas? Is this command broken for the MK6? It seems to be. Does it produce erroneous results for other vehicle turrets like this?

Anyone trying to run rearm scripts on the MK6 or checks of ammo is going to run into significant problems with these sorts of erroneous results.

Interestingly mortar1 ammo "8Rnd_82mm_Mo_shells"  always seems to produce a zero 0 result even when the MK6 is fully ammoed up. I assume the ammo command just doesn't work with the MK6 or turrets?

 

I'm looking to auto rearm mortars and this very odd behaviour is making it really hard to test ammo levels for the mortar. Ideas?

 

  • Like 1

Share this post


Link to post
Share on other sites

Interesting

Use getArtilleryAmmo [mortar1] to check if you have some remaining "8Rnd_82mm_Mo_shells" (or other type) shells.

  • Like 1

Share this post


Link to post
Share on other sites

Helpful as always @pierremgi.  getArtilleryAmmo seems much more reliable. The other two commands give very odd results but that is much more reliable for what I'm needing. 

Share this post


Link to post
Share on other sites

Working as intended. As per the Biki, the command magazinesTurret returns empty magazines when used in any but the driver turret. You can use the alternate syntax to exclude all empty magazines.

 

_mags = count (mortar1 magazinesTurret [0,0]);
systemChat format ["%1 mags", _mags];

//0 mags

 

  • Like 2

Share this post


Link to post
Share on other sites

Sometimes these little exceptions get buried in the comments at the bottom of the page, and alternative syntaxes can offer flexibility/utility you might not have thought of. Definitely worth the time to scan through the full page when checking out a new command. Have fun!

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

×