Page MenuHomeFeedback Tracker

The addItem command will fail in several situations
Reviewed, WishlistPublic

Description

The addItem command appears to fail to add some item types. If the
unit is dead, the number of items that cannot be added increases.
{F21286} {F21287}

Details

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

A mission that attempts to reproduce the observed addItem behavior is
included. The code in init.sqf attempts to handle the addition of
arbitrary items to a character, with item names obtained from
'configFile >> "CfgWeapons"'. For each item, the code attempts to add
the item and then verifies that it has been added. After removing any
added item, these steps are repeated for the next item, etc.

The code first goes through the items once, then repeats the
sequence with the unit being dead. A summary of the failed commands
are copied the clipboard at the end.

Running the mission on dev build 0.75.108541 produced the output
below. Some of these possibly use the wrong command (unsure if
addItem or addGoggles should be used for "Binoculars" as neither
appears to work) and some items are not attempted handled at all
("Laserdesignator_mounted"), but there are still several unexpected failures and
a clear difference depending on whether the unit is alive or not, even
if the same code is used to add the same item names.

alive failures:

  Binocular(addItem)
  Rangefinder(addItem)
  Medikit(addItem)
  ToolKit(addItem)
  Laserdesignator_mounted()
  Laserdesignator(addItem)
  Zasleh2(addItem)

dead failures:

ItemWatch(addItem)
ItemCompass(addItem)
ItemGPS(addItem)
ItemRadio(addItem)
ItemMap(addItem)
MineDetector(addItem)
Binocular(addItem)
Rangefinder(addItem)
NVGoggles(addItem)
FirstAidKit(addItem)
Medikit(addItem)
ToolKit(addItem)
Laserdesignator_mounted()
Laserdesignator(addItem)
Zasleh2(addItem)
muzzle_snds_H(addItem)
muzzle_snds_L(addItem)
muzzle_snds_M(addItem)
muzzle_snds_B(addItem)
muzzle_snds_H_MG(addItem)
optic_Arco(addItem)
optic_Hamr(addItem)
optic_Aco(addItem)
optic_ACO_grn(addItem)
optic_Aco_smg(addItem)
optic_ACO_grn_smg(addItem)
optic_Holosight(addItem)
optic_Holosight_smg(addItem)
optic_SOS(addItem)
acc_flashlight(addItem)
acc_pointer_IR(addItem)
optic_MRCO(addItem)
muzzle_snds_acp(addItem)

Event Timeline

andero2 edited Steps To Reproduce. (Show Details)Aug 6 2013, 8:36 PM
andero2 edited Additional Information. (Show Details)
andero2 set Category to Scripting.
andero2 set Reproducibility to Always.
andero2 set Severity to None.
andero2 set Resolution to Open.
andero2 set Legacy ID to 599787497.May 7 2016, 3:53 PM
sms added a subscriber: sms.May 7 2016, 3:53 PM
sms added a comment.Aug 7 2013, 10:39 AM

Medikit can be added only into backpack. Even though vest capacity might be enough to carry Medikit.

Try addWeapon when addItem fails

andero2 added a subscriber: andero2.May 7 2016, 3:53 PM

Thank you for the feedback. Adding a backpack fixes several of the
item addition failures, giving the result below. I have updated the
uploaded mission file with this change.

Using addWeapon on Binocular-type items causes the command to succeed,
but there are problems with adding e.g., NVGoggles added via addWeapon
(see http://feedback.arma3.com/view.php?id=4809).

The difference between alive and dead units still remains; the primary
problem appears to be adding various item types to dead characters
(using addWeapon does not change this).

alive failures:
Binocular(addItem)
Rangefinder(addItem)
Laserdesignator(addItem)
Zasleh2(addItem)

dead failures:
ItemWatch(addItem)
ItemCompass(addItem)
ItemGPS(addItem)
ItemRadio(addItem)
ItemMap(addItem)
MineDetector(addItem)
Binocular(addItem)
Rangefinder(addItem)
NVGoggles(addItem)
FirstAidKit(addItem)
Medikit(addItem)
ToolKit(addItem)
Laserdesignator(addItem)
Zasleh2(addItem)
muzzle_snds_H(addItem)
muzzle_snds_L(addItem)
muzzle_snds_M(addItem)
muzzle_snds_B(addItem)
muzzle_snds_H_MG(addItem)
optic_Arco(addItem)
optic_Hamr(addItem)
optic_Aco(addItem)
optic_ACO_grn(addItem)
optic_Aco_smg(addItem)
optic_ACO_grn_smg(addItem)
optic_Holosight(addItem)
optic_Holosight_smg(addItem)
optic_SOS(addItem)
acc_flashlight(addItem)
acc_pointer_IR(addItem)
optic_MRCO(addItem)
muzzle_snds_acp(addItem)

Binocular
Rangefinder
Laserdesignator

are weapons so addweapon works on both dead and alive

itemwatch itemcompass...etc use assignItem to add to dead

weapon items there are bunch of commands for that

addPrimaryWeaponItem, addSecondaryWeaponItem

I won't argue this business is a mess but you should also try all commands. Here is good start http://killzonekid.com/arma-2-arma-3-scripting-commands-list/ search for word 'item'

I am reporting this _because_ it is a mess, so that it can be
cleaned up and fixed.

Same issue here. I have two mission on Steam Workshop broken because of this.

workaround: Adding a backpack fixes the additem nvgoogles.