Page MenuHomeFeedback Tracker

Wrong weapon types
Closed, ResolvedPublic


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"


Legacy ID
No Bug
Steps To Reproduce
  1. player addWeapon "hgun_Rook40_snds_F"
  2. put the "muzzle_snds_L" from the weapon
  3. hint format["output: %1", currentWeapon player];
  4. output: "hgun_Rook40_snds_F"
Additional Information

This bug also affect getWeaponcargo ->

Event Timeline

shukari edited Steps To Reproduce. (Show Details)Nov 13 2014, 3:35 AM
shukari edited Additional Information. (Show Details)
shukari set Category to Scripting.
shukari set Reproducibility to Always.
shukari set Severity to None.
shukari set Resolution to No Bug.
shukari set Legacy ID to 3655616949.May 7 2016, 7:49 PM

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.

shukari added a subscriber: shukari.May 7 2016, 7:49 PM

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...

ruebe added a subscriber: ruebe.May 7 2016, 7:49 PM
ruebe added a comment.Jul 15 2015, 6:49 PM

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. :/