-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPCs suicidally try to heal you #57254
Comments
I don't agree with all of this.
Agreed
Agreed.
Cautious agree. There are some niche cases where we may want it to happen but generally, NPC should not offer healing if there is an enemy in LOS.
Disagree. If you have two NPCs on guard duty and one is heavily injured, I definitely want the other guard to go help them. It seems like pretty stupid behaviour to have one guard stand around and watch their allies bleed out. Eventually we would want some better prioritization but I don't think there's ever a case where this behaviour should be disallowed. In terms of managing this bug for stable, we only need the third option: We need to ensure NPCs will not offer healing if there is an enemy in LOS. Additionally, characters should not accept healing if there is an enemy in their LOS. From an algorithm standpoint:
Later on this can become more nuanced but I think it works for now. |
In a perfect world, NPCs wouldn't watch each other bleed out, but guard mode is currently a pretty important band-aid. The fact that it mostly turns off NPC AI is extremely important to their survivability as they are not currently capable of making intelligent decisions about when they should behave in certain ways. |
Perhaps, but I don't think that's an argument in favour of keeping basic AI functions on them. It's an argument in favour of tuning their AI further. Can you name a situation where the stated algorithm would be bad behaviour from an NPC on guard mode? |
They're in a vehicle which is parked but needs to be ready for the player to hop in and drive the group to safety where they can then tend the wounded NPC without everyone getting eaten. For their safety, the player has ordered them to stand in places where they cannot see a turret which will shoot them if they step out of cover. The player is attempting to create a distraction in order to clear an escape route, which requires that everyone remain silent until the nearby zombies have gone off to investigate the talking doll or whatever. The NPC has zero medical skill and is holding valuable medical supplies. The skilled player is trying to move in to administer treatment but is slightly slower or farther away. The player has decided to leave a critically wounded NPC behind while fleeing an unwinnable situation and wants the other NPC to follow them or stay in the vehicle so they can escape instead of stopping to render aid. Some of these could be more interesting than they are (particularly the last one) but the code does not currently exist to handle those kinds of complex interactions, and having guard mode keep NPCs from making their own decisions as much as possible will cut down on cases where the AI causes companions to make suicidal decisions with no hope of player intervention. |
Actually, looking at the healing code in npcmove.cpp it may be possible to fix this for stable really, really easily. Starting here: Line 1815 in 4651ea2
I'm not sure if there's code in other places governing this, but if my read is correct we can probably solve this specific issue for stable with the following change:
As far as I'm seeing we're currently offering healing as a 1 in 3 chance, without any further situational assessment. This should just add the situational assessment. |
Our replies were almost simultaneous, lol. Hopefully that doesn't cause mine to get lost. |
I see yours. Those are valid concerns but I don't think there is sufficient reason to put in special casing for guard mode for stable, presuming my single line fix suggestion works. Rather I think that's good call to discuss adding a specific command that gets an NPC to hold position firmly, and/or looking at the root of the problem of NPCs walking out of vehicles or into danger. Both of those are relevant things that need fixing and shouldn't be all that hard to do, and leaning more on micromanagement through guard mode will mask the need. |
I was trying to reproduce this for the purposes of playtesting the linked PR, but I am unable to get NPCs to suicidally heal in combat. If they are out of line of sight when the injury occurs (added bleed effect via debug) then they still either flee or engage when coming into sight - they do not continue trying to heal. Can you provide some more info on when you encountered this? Maybe a save? |
I posted this issue ages ago so I don't have a save. One notable situation had me wandering around in the depths of a trap-riddled cave and my npc guarding near the exit (same z level) who could not see me ran over to heal me. I had not disarmed or spotted all traps in the area so this was not desirable. Another time, I was inside a house trying to fight a juggernaut while leaving my vulnerable NPC outside so they wouldn't engage. The juggernaut hurt me and the NPC ran inside to try to help, freaked out when they saw the juggernaut, and fled halfway across the town into a mob of zombies. If they'd been staying put it wouldn't have been an issue. In neither case could the NPC see me when I was injured, they were simply nearby. A guarding NPC will stay put and watch you fight at a safe distance until you start bleeding, then they'll run over into range of a fight you'd prefer they didn't join. I-am-Erk's fix patches that behavior, so that's good enough for a merge. It may not solve the first two cases, but that would be a separate issue (npcs "seeing" you get wounded from out of LoS) |
After many tries I got one sort of reproduction of the "suicidal heal" behavior without Erk's patch, so reproduction on this was inconsistent to say the least. (A NPC continually chased me in circles as I ran away from a hulk). I threw a simple debugmsg into npc::address_needs The only other place |
IIRC, bleeding was recently moved to a limb-based effect rather than a hardcoded state, so it's possible NPCs are seeing it in fewer places now, causing the issue less frequently than was the case when this issue was opened. |
I think there are some issues here needing addressing, with NPCs not calling needs, but it appears it can be deferred. |
Describe the bug
If you have a friendly NPC, even if they're guarding, can't see you, and there's a dangerous situation going on, any time you get hurt, they'll run over and try to bandage you. This is not only annoying, it doesn't make a ton of sense. Someone on the other side of a cave shouldn't know my leg is bleeding if I didn't say anything.
A temporary fix for anyone running into this issue is to have NPCs not carry medicine, but that's often a bad idea and doesn't make sense in roleplay.
Steps to reproduce
Give bandages to a friendly NPC
Get hurt
They will come try to heal you
Expected behavior
NPCs should have a toggleable option in dialog for whether to heal allies or not, and they also should have a check for if they can actually see their ally before they run over and try to heal. They should also never do this in combat, though it's possible there's a check there already and I'm just seeing corner cases. Lastly, they should never attempt to heal others if they've been instructed to guard.
Screenshots
No response
Versions and configuration
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
No Fungal Growth [no_fungal_growth],
Bionic Professions [package_bionic_professions]
]
Additional context
No response
The text was updated successfully, but these errors were encountered: