If you have a "hgun_Rook40_snds_F" and put the "muzzle_snds_L" away the type of the weapon is like befor "hgun_Rook40_snds_F".
If you now save this because you have a housing or invetory saving script you have the chance to have unlimited "muzzle_snds_L". You must only put the "muzzle_snds_L" away and put the "muzzle_snds_L" and the weapon in a crate. Now getWeaponcargo or currentWeapon return "hgun_Rook40_snds_F" but it is now a "hgun_Rook40_F"
Description
Details
- Legacy ID
- 3655616949
- Severity
- None
- Resolution
- No Bug
- Reproducibility
- Always
- Category
- Scripting
- player addWeapon "hgun_Rook40_snds_F"
- put the "muzzle_snds_L" from the weapon
- hint format["output: %1", currentWeapon player];
- output: "hgun_Rook40_snds_F"
This bug also affect getWeaponcargo -> http://feedback.arma3.com/view.php?id=21693
Event Timeline
Just spoke with developer, this is intended behaviour. The class of the weapon doesnt change when you remove or add attachments.
My suggestion would be, always use base classes and if you want to add attachments you can always do that after you added weapon. Or use event handler to detect when attachment is separated and replace weapon class? In any case this is open for debate and further improvement.
EDOT: there are also weaponsItemsCargo and weaponsItems commands.
Ok, thank you for your time. I update now the hole mission to basic classnames... but it is not really nice i supose that the engine dont support that...
In any case this is open for debate and further improvement.
IMHO this is a clear design wart/mistake, and only base weapons should ever exist as classes (under cfgweapons). In order to still be able to easily configure units with "specially equipped weapons", such weapon configurations should be defined somewhere else in the config, similar to how groups are defined on top of units/vehicles. It's pretty much the same composition game, really.
Guess, in general the config should be normalized similar to database schemas. Third normal form should be enough. ;)
A different approach might be to automatically replace such special weapons with the corresponding base class of the weapon by engine the moment they're spawned/created (granted, this smells super hacky). Doing such a thing manually, however (with event handlers and what not... as you suggest), doesn't seem really appropriate to me.
If this isn't fixed for A3, take note and please make sure to not do the same mistake again for the next iteration of the game. :/