Forums » General

Weapon groups work differently than I thought

May 31, 2014 meridian link
I was looking into the API functions related to weapon groups in order to potentially implement a new feature in one of my plugins, and I discovered that weapon groups don't work the way that I thought they did. I figure that I'm not the only person to misunderstand how they work (additionally, bug reports such as this one are actually intended behavior), and since I haven't seen it explained anywhere, here goes my explanation...

How I expected them to work:
Changing to a given weapon group would set all triggers to that group and all triggers are always set to the same weapon group.

How it actually works:
Each trigger can be assigned to a different weapon group, and the order in which a sequence of weapon groups are selected matters. That is to say that going from weapon group 1 to 2 to 3 can potentially result in a different configuration than selecting weapon group 2 then 1 then 3.

The way that this works is that when switching weapon groups, if a given trigger has no weapons assigned for that group, then that trigger remains set to what it was previously, and triggers that do have assignments for that group will switch.

The following example illustrates how it works:
Say that a hornet is equipped with a neutron blaster, a charge cannon, flares, and gemini missiles, with the following weapon group assignments:
Group 1 primary trigger: Neut
Group 1 secondary trigger: None
Group 2 primary trigger: Charge Cannon
Group 2 secondary trigger: None
Group 3 primary trigger: None
Group 3 secondary trigger: Flares
Group 4 primary trigger: None
Group 4 secondary trigger: Gems

With this configuration, switching to weapon group 1 or 2 sets the energy weapon assigned to the primary trigger (neut or charge cannon, respectively), while leaving the secondary trigger unchanged. Similarly, switching to weapon group 3 or 4 sets the projectile weapon assigned to the secondary trigger (flares or gems, respectively), while leaving the primary trigger unchanged.

And elaborating on the example used earlier, switching to weapon groups 1 then 2 then 3 would result in the charge cannon assigned to the primary trigger and flares assigned to secondary, whereas switching to weapon groups 2 then 1 then 3 would result in the neut assigned to primary and flares secondary.

Of course, this example is for illustrative purposes only and is not a configuration that would make sense to actually use. In fact, the only way I see making use of this hidden "feature" would be with a ship that had lots of weapon ports (more than any ship currently available) and the player didn't want to have all the weapons enabled at the same time.

The one downside of having weapon groups implemented this way is that it makes setting weapons to an unassigned "safe" state not very practical. One way to do it (but only if you have a scanner equipped) is to make the scanner the only weapon assigned to every trigger.
May 31, 2014 TheRedSpy link
Instead of having none mean that it inherits the setting from the last group, there should be both a 'none' and 'inherit' setting. 'None' setting it to actually do nothing, and 'inherit' setting it to what none does now. then we get best of both worlds.
Jun 01, 2014 meridian link
I hear you, TRS, and while having both a 'none' and 'inherit' setting sounds good in theory, implementing it in the GUI would be tricky and would probably end up confusing many users. Not to mention the API functions would need a significant overhaul to accommodate both possible configurations.

In the end, I don't think the added complexity is worth the small gains that would be had by allowing both. Keep things the way they are; there's something to be said for simplicity.

I wrote a plugin to set all addons to a safe state, which is good enough for my own needs.
Jun 03, 2014 abortretryfail link
I did this same thing as a "safety" switch for TU mines, but I just assigned an empty group for that.

The game is weird about empty weapon groups...