SRP icon indicating copy to clipboard operation
SRP copied to clipboard

NPC detection - stealth

Open Pikson opened this issue 1 year ago • 4 comments

Hi, i'm pulling my hair out trying to tweak NPC detection so they don't detect someone dying from 20 metres away and immediately shoot me...

I'm testing everything on a renegade camp in the swamps:

  • I've tried commenting all the relevants sound files (AI distance detection- death sounds, hit sounds and bullet hit sounds) - nothing worked but also one of the sound files is damaged and can't be commented (sounds\material\bullet\collide\bullet_hit_1 idk if it's relevant)
  • I've played with actor.ltx sound threshold - didn't work
  • I've played with xr_danger.script values - didn't work

Editing bullet sounds actually worked and they don't detect me if I shoot the ground around them, but nothing works for killing NPC's.

Do you have any idea if it's possible to tweak this?

Pikson avatar Feb 24 '24 21:02 Pikson

I've used actoreditor instead of leveleditor in the x-ray SDK. I've commented everything again. I've also gone to another renegade camp and it seems like it finally worked. I was able to kill enemies without others noticing. Maybe the enemies I had saved the game next to were bugged.

Now what I want to do:

  • Test sound detection values to find the best solution
  • Check if enemies can see dead bodies and react to them (would be nice if they did so you have to move bodies away)
  • Check if enemy goes alert if he sees another dying but is too far away to hear the voice line
  • Check if one alerted enemy alerts everybody else immediately or if it's dependable on voice lines or shooting

If you have any info of these things, please elaborate.

Pikson avatar Feb 25 '24 16:02 Pikson

https://www.reddit.com/r/stalker/comments/1aycrdj/game_sound_files_tweaking_for_better_stealth/

I've asked the same here and one of the user replied that after a kill everyone near is alerted abotu this in the xr_death script and their reaction also depends on other conditions like sound detection. This means in short that if you kill an enemy without other noticing, save the game and reload, the script is refreshed and everyone in the vicinity is alerted. This script was somewhat fixed in the zone reclamation project for SoC.

@Decane are you deep enough in the coding of this game to be able to find out how this xr_death script works and could you try to do the same solution as in ZRP?

Pikson avatar Feb 26 '24 14:02 Pikson

The game's scripts do not "remember" who killed an NPC across a load boundary, even in vanilla. The reply in that Reddit thread references the following code in the vanilla xr_death.script:

db.storage[victim:id()].death.killer = who:id()

But everything in db.storage[victim:id()] is discarded on load because the scripts get reloaded too.

And when a save is created, death.killer is not saved. To confirm this yourself, just print the entire NPC storage table at the end of function xr_logic.load_obj using print_tbl(obj_st); you'll see the death field is missing across all loaded NPCs, including those you personally slugged before saving.

Finally, in vanilla CS, the killer field above is referenced (only) in a handful of functions in xr_conditions.script and xr_effects.script. Of these, the only one that's actually used is xr_conditions.actor_enemy, but not in a way that's relevant to player detection. And in the SRP specifically, the killer field isn't used even there, so the code cited above has been deleted outright from the SRP variant of xr_death.script.

TL;DR - xr_death.script has nothing to do with your detection problem.

Decane avatar Feb 26 '24 23:02 Decane

Well, the answer might be in xr_danger.script as per NatVak's (he's ZRP's author I believe) reply on my reddit thread. But the file is "huge and there's no way I can decipher that spaghetti code and be able to fix AI behaviour succesfully, at least not in a short time. I'm gonna pass on this and manage with just the sound editing"

Thanks for answering anyway.

Pikson avatar Feb 27 '24 19:02 Pikson