-
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
Fleeing NPCs will now attack player that got too close #77622
base: master
Are you sure you want to change the base?
Conversation
This doesn't appear to consider cases where the fleeing state was just set. If you're fighting with a NPC and wound them they might decide to flee, but will instead always choose to attack you with this PR. Therefore they will just stand there and fight to the death as long as you're in melee range. |
Ok, have something to suggest to resolve this case? |
Not any good ones, unfortunately. Maybe they should just directly compare their speed to the target's speed to see if they even have a chance of getting away. The player changing stance is the only thing that normally changes a creature's speed, and the player's ability to sprint is limited... so this should mostly work. |
Co-authored-by: RenechCDDA <[email protected]>
You mean, if NPC is faster than a PC, then NPC should always run and don't strike PC when the latter got too close? |
Yes. It doesn't make sense for them to flee if they can't reasonably get away. Ideally we would track this in a more complicated manner where they try to flee and then reconsider if their attacker is able to catch up to them. But then you'll need to cache it into their 'memory' and handle the considerations for that. It would be a much more difficult and invasive change |
I encountered the case where this solution fails - when NPC is cornered, he won't fight back, but will endlessly and foolishly try to move, despite there's nowhere left to go. I guess I'll go the other way - fleeing NPC will fight back unless his HP isn't lower than some threshold. In that case he won't fight back, but will flee no matter what. |
Maybe could give them a cooldown timer before they aggro back? Let's say, they will only attack you if they are cornered for more than 2~3 turns. This should resolve the problem of the npc never running if they are meleeing you |
…alth Also NPCs will change their attitude to `NPCATT_FLEE_TEMP ` when they decide to flee during danger assessment
Summary
Features "Fleeing NPCs will now attack player that got too close"
Purpose of change
Describe the solution
Player gets adjacent to fleeing NPC -> NPC (if they have more than 30% health) attacks the player.
Also NPC will change their attitude to
NPCATT_FLEE_TEMP
if they decide to flee during danger assessment. This fixes the issue of NPC still having the attitude ofAttacking to kill
despite they decided to flee when they realized that things are going bad for them.Describe alternatives you've considered
Make NPCs attack only 50% or 75% of time.
Make NPCs fire their ranged weapons when distance between him and player is 2 or 3.
Testing
Spawned NPC, gave him fleeing attitude. Ran to him, got a hit in the face.
Additional context
None.