OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Delian on June 24, 2022, 02:25:46 am

Title: [DONE] Highest reaction priority for preferred weapon
Post by: Delian on June 24, 2022, 02:25:46 am
I have a soldier that has two weapons: A melee weapon, and a firearm (specialWeapon with specialUseEmptyHand: true) with a melee attack.
I right-click on the firearm to give its hand reaction priority.
An enemy walks into melee range. The soldier reacts with a melee attack.
Expected behavior:
The soldier should react with the preferred hand - the melee attack of the firearm.
Actual behavior:
The soldier reacts with the melee weapon.

In practice, I'm playing xpz and I have a soldier with built-in kung fu and a shield. The soldier reacts with the shield instead of kung-fu.
Title: Re: [Bug] Melee reaction priority
Post by: Meridian on June 24, 2022, 08:31:45 am
That's a feature.

It's always melee first, gunbutt second, firearm third. Regardless of indicated preference.
Title: Re: [Bug] Melee reaction priority
Post by: Delian on June 24, 2022, 10:01:30 am
I'm ok with it being default behavior. It's actually correct that in a melee range, melee weapon is prioritized over gunbutt, because if you have a pistol and a sword, then the sword should be used.

However, I still think that if I did indicate priority, then gunbutt should be prioritized over melee weapon. Think about it. If you have a ranged weapon and a melee weapon, what would priority do?
It's certainly not for a ranged attack, since a melee weapon can't attack at range. If you have only one ranged weapon, then priority obviously won't change anything.
So it's simply logic that the player wanted to set up priority for a melee attack. This isn't a maybe; in this case we can say with 100% certainty that this is what the player wanted. That the player wanted to prioritze the melee attack of one hand over the melee attack of the other hand.

So yeah, I can see the reason why it's melee first and gunbutt second by default. But we're talking about the "manual override of default behavior" here, which is what the preference indication does. Or should do?
Title: Re: [Bug] Melee reaction priority
Post by: Meridian on July 05, 2022, 04:56:00 pm
I went through all the same thoughts when I was analyzing and implementing this.
It's not that I disagree, it's just always more complicated than what it looks like and compromises are made.

My improvements over the already-available OG and OXC features (of "last active hand") are:
1/ keep it OXC-compatible (OXC also always does melee first, gunbutt second, hardcoded)
2/ visualize it (yellow dot... far from best, but at least something)
3/ allow to select also non-hand special weapons (OG/OXC only supported what's really in hand... no lobster claws, no "martial arts", etc.)

If I implement what you want, I will break compatibility with OXC from point 1... and will be publicly hung by my balls by purists and nitpickers... which I generally try to avoid.


I'll put this on my todolist again to see what I can do... but I can't promise anything.
Title: Re: [Bug] Melee reaction priority
Post by: Delian on July 05, 2022, 10:34:09 pm
Thanks.

I think that gunbutts are modded behavior, so it shouldn't apply to pure games either way...
Then again, I also think that priority should've been implemented as a "strict" priority, instead of the current "only if it's the same type of weapon and attack", because it would provide for a less confusing user experience. But I digress.
Title: Re: [Bug] Melee reaction priority
Post by: N7Kopper on July 14, 2022, 02:31:37 pm
Thanks.

I think that gunbutts are modded behavior, so it shouldn't apply to pure games either way...
Then again, I also think that priority should've been implemented as a "strict" priority, instead of the current "only if it's the same type of weapon and attack", because it would provide for a less confusing user experience. But I digress.
Modded relative to OpenXCom, not the original engine; and even in the original engine, adding rifle butts was just a matter of putting the attack option back in, because it was removed last-minute to the point that even the manual has it as a feature in the screenshots. (You could even do it by merging them with a stun rod!)

Honestly, I think it would be best to make this a toggle, like with extended reload costs - the default is 15 TUs to reload no matter what, but you can choose to add the TUs it takes to move the ammo to your off-hand to reload costs if you want.
Title: Re: [DONE] Highest reaction priority for preferred weapon
Post by: Meridian on February 07, 2024, 09:37:59 am
The preferred weapon (marked with a yellow dot) should now be used for reactions (whenever possible) regardless of the other weapon's type.

If not possible (e.g. melee weapon at range, not enough TUs, not enough ammo, etc.), the other weapon will get a chance to shine.

Please test.

https://github.com/MeridianOXC/OpenXcom/commit/1b18f38c52e303d95c3d0afefe477576a60341e6
Title: Re: [DONE] Highest reaction priority for preferred weapon
Post by: Delian on February 19, 2024, 07:00:57 pm
Works great, and much less confusing than the original implementation.