Page MenuHomeFeedback Tracker

magazineTurretAmmo and setMagazineTurretAmmo do not function as expected if there are multiple magazines of the same type
New, WishlistPublic

Description

In Slammer Up for example there are 3 mags of 2000Rnd_65x39_Belt, lets call then mag#1, mag#2, mag#3

Initially magazineTurretAmmo reports ammo in mag#1 and setMagazineTurretAmmo will also set new ammo count in mag#1

But when the mag is finished and new mag#2 is reloaded, magazineTurretAmmo is still reporting ammo for mag#1 even though it is discarded. If you try to set ammo again setMagazineTurretAmmo sets it for mag#3 instead and magazineTurretAmmo starts reporting ammo for mag#3 as well.

mag#2 that is currently loaded therefore cannot be read or altered in any way.

Details

Legacy ID
581806029
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

get in slammer up as commander, execute

vehicle player setMagazineTurretAmmo ["500Rnd_127x99_mag_Tracer_Red", 1, [0,0]];
hint str (vehicle player magazineTurretAmmo ["500Rnd_127x99_mag_Tracer_Red",[0,0]]);

ammo count shows 1 and so is hint

fire away and reload

execute

hint str (vehicle player magazineTurretAmmo ["500Rnd_127x99_mag_Tracer_Red",[0,0]]);

it shows 0, however the loaded mag is full, it still shows ammo for used mag.

execute

vehicle player setMagazineTurretAmmo ["500Rnd_127x99_mag_Tracer_Red", 1, [0,0]];
hint str (vehicle player magazineTurretAmmo ["500Rnd_127x99_mag_Tracer_Red",[0,0]]);

the loaded mag is still full but hint shows 1, which means it set ammo on 3rd mag not on 2nd.

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Scripting.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Open.
Killzone_Kid set Legacy ID to 581806029.May 7 2016, 7:40 PM
Killzone_Kid edited a custom field.
Killzone_Kid added a subscriber: Killzone_Kid.

Also see this ticket http://feedback.arma3.com/view.php?id=22179 setMagazineTurretAmmo locality is also broken

Did some tests on this and it seems there has been some changes, there are now only 2 mags of 500Rnd_127x99_mag_Tracer_Red in slammer up commander turret (TurretPath:[0,0]) which actually means there is a workaround now:

When you empty a mag (or both mags) this will brake magazineTurretAmmo function as you said, but it reports all mags has a ammocount of 0, like this:
["500Rnd_127x99_mag_Tracer_Red:0","500Rnd_127x99_mag_Tracer_Red:0","SmokeLauncherMag:2"]

So when magazineTurretAmmo reports 0 rounds in all mags we know at least 1 full mag has been used, we can always get the ammo Count (and set it) of the current magazine with the ammo function (tank ammo "LMG_M200"), that way we can actually get all the info we need. However if there is more than 2 mags of the same magazine type this workaround wont Work, for example in the mortar, but there are very few vehicles that have more than 2 mags of same type in the same turretPath.

Encountered this bug with a modded vehicle I'm building. Have 4 turrets with the same weapon and magazine and can not get their ammo count as the command reads only the one magazine.

Actually got it working! :

		_magazine_01 = _walker magazinesTurret [0,0];
		_magazine_02 = _walker magazinesTurret [0,1];
		_magazine_03 = _walker magazinesTurret [0,2];
		_magazine_04 = _walker magazinesTurret [0,3];
		
		_ammoCount_01 = _walker magazineTurretAmmo [_magazine_01 select 0, [0,0]];
		_ammoCount_02 = _walker magazineTurretAmmo [_magazine_02 select 0, [0,1]];
		_ammoCount_03 = _walker magazineTurretAmmo [_magazine_03 select 0, [0,2]];
		_ammoCount_04 = _walker magazineTurretAmmo [_magazine_04 select 0, [0,3]];

It actually does read the ammo from right magazines!