CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.71k stars 4.2k forks source link

NPCs still occasionally preferring non weapon weapons for combat #65776

Open Maleclypse opened 1 year ago

Maleclypse commented 1 year ago

Describe the bug

NPCs will still randomly drop their gun or melee weapon and pick up a leather belt or helmet to attack with.

After a escaping a group of bandits last night because two of them dropped weapons to use their belt and helmet I wonder if https://github.com/cataclysmbnteam/Cataclysm-BN/pull/2773 and it's precursor would improve weapon NPC weapon selection but it's probably beyond me to apply these changes. Hopefully someone else is able to look into this.

Attach save file

N/A

Steps to reproduce

Meet a group of bandits, watch in awe as half of them go from weapons to random objects as weapons.

Expected behavior

NPCs to use at least a decent weapon even if they don't always use the best weapon for any given situation.

Screenshots

No response

Versions and configuration

Current

Additional context

No response

KheirFerrum commented 1 year ago

Non weapons used for combat was more likely solved by

Which is a much easier port. It's not the most elegant solution, but to properly fix it would require someone to deep dive into why NPCs consider armour to be better than their guns.

I suspect it has to do with their ranged cache which is what's causing companions to need setting to "shoot without moving", but if they're prioritizing armour over melee weapons like katanas, clubs, or similar, then it's very likely an issue with melee_value() being broken.

I-am-Erk commented 1 year ago

TBH the solution linked above isn't terrible, it's a similarly coarse version of what we have already with guns. However that solutions is just "don't ever use wearables in melee except guns", which is problematic. I think we can get more robust than that without much effort. Gonna take a peek at the pr