Jump to content
bux578

[BUG] Script command "magazinesDetail" doesn't include all magazines

Recommended Posts

Arma 3 1.58

 

The script command "magazinesDetail" doesn't include the loaded Laser Designator battery. It's not possible to get the magazine ID when the binocular is not equipped.

 

Steps to reproduce:

  1. Place a unit in the editor (e.g. JTAC)
  2. Make sure it has a Laser Designator and Laser Batteries
  3. Start the mission
  4. Make sure the Laser Batteries are loaded into the Designator
  5. Equip the primary weapon
  6. Run "magazinesDetail player"

Share this post


Link to post
Share on other sites

I suggest using getUnitLoadout, as it is the only command that returns lasedesignator battery properly

Share this post


Link to post
Share on other sites

>The script command "magazinesDetail" doesn't include the loaded Laser Designator battery.

Pretty sure this is intended behaviour. It returns no loaded magazine (incl. primary weapon, pistols, other muzzles etc.). Just like the regular "magazines" command which this is an derivate from.

 

>I suggest using getUnitLoadout, as it is the only command that returns lasedesignator battery properly

Not entirely true. It is also returned by "weaponsItems". You can create a forEach loop that reports the magazine(s):

{
    if ((_x select 0) isEqualTo binocular _unit) exitWith {
        _magazine = (_x select 4) param [0, ""];
    };
} forEach weaponsitems _unit;

This is still faster than "getUnitLoadout" (even with few items in inventory), which is a pretty expensive command and might be overkill if you only want the binoculars magazine.

 

>It's not possible to get the magazine ID when the binocular is not equipped.

This is the real issue here. You cannot retrieve the magazine IDs of loaded magazines (any rifle, binocular, grenade launcher, 120mm ...), except with "currentMagazineDetail(Turret)". "getUnitLoadout" does not do magazines IDs afaik.

Share this post


Link to post
Share on other sites

Not entirely true. It is also returned by "weaponsItems". You can create a forEach loop that reports the magazine(s):

{
    if ((_x select 0) isEqualTo binocular _unit) exitWith {
        _magazine = (_x select 4) param [0, ""];
    };
} forEach weaponsitems _unit;

This is still faster than "getUnitLoadout" (even with few items in inventory), which is a pretty expensive command and might be overkill if you only want the binoculars magazine.

 

 

You really think this:

getUnitLoadout _unit select 8 param [4, [[]]] select 0

is too slow and the loop is better?

Share this post


Link to post
Share on other sites

No, but my point was that "getUnitLoadout" is not the only command that reports the binoculars magazine. "weaponsItems" does that as well.

 

Also sorry for bringing it up, because it is completely missing the point.

"getUnitLoadout" does not report the same format as "magazinesDetail" (localized name with magazine id), which is what this ticket is about.

B_recon_JTAC_F

player call CBA_fnc_binocularMagazine
0.0382 ms

getUnitLoadout player param [8, []] param [4, [""]] select 0 
0.0733 ms

Share this post


Link to post
Share on other sites

 

No, but my point was that "getUnitLoadout" is not the only command that reports the binoculars magazine. "weaponsItems" does that as well.

 

Also sorry for bringing it up, because it is completely missing the point.

"getUnitLoadout" does not report the same format as "magazinesDetail" (localized name with magazine id), which is what this ticket is about.

B_recon_JTAC_F

player call CBA_fnc_binocularMagazine
0.0382 ms

getUnitLoadout player param [8, []] param [4, [""]] select 0 
0.0733 ms

 

Fair enough. If memory serves me well, weaponsItems was also useless until the engine method was fixed when getUnitLoadout was created. Anyway, there is even faster way of getting name of the loaded mag:

_muzzle = currentMuzzle _unit;
_unit selectWeapon binocular _unit;
_magazine = currentMagazine _unit;
_unit selectWeapon _muzzle;

Share this post


Link to post
Share on other sites

 

Fair enough. If memory serves me well, weaponsItems was also useless until the engine method was fixed when getUnitLoadout was created. Anyway, there is even faster way of getting name of the loaded mag:

_muzzle = currentMuzzle _unit;
_unit selectWeapon binocular _unit;
_magazine = currentMagazine _unit;
_unit selectWeapon _muzzle;

 

This has multiple problems:

- the gunlight or IR laser will be turned off

- the weapon mode (e.g. full auto) will be reset to semi

 

You can restore the weapon mode with "action 'SwitchMagazine'", but that would turn the gunlight/ir laser off as well. (and it's itself rather slow and hacky)

You could restore the state of the gunlight/ir laser by using "action 'IRLaserOn/GunLightOn'", but those have a bug where they reset the weapon mode...

 

You can restore only one of them. :/

Share this post


Link to post
Share on other sites

> - the weapon mode (e.g. full auto) will be reset to semi

that is on the list of fixes, no ETA

  • Like 1

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

×