Isolating NPC's AI?

A

Aavenr

Guest
Hey guys,

I have got this big outdoors section on my level taking place inside what is essentially a big basin with a building structure on the center. There are enemies lining up the rock walls of the basin and along bridges that connect it to the main building. The idea is to make this a stealth level of sorts where you can take out each enemy one by one from afar or from point-blank range.

I have tried to sort of isolate each enemy from each and from the player by not giving them a common squad name, and having them turn their backs to the player. However, the problem I am encountering is that whenever the player kills a given enemy or is spotted by one of them and that enemy starts firing back, the rest of them -- which are pretty far away on other bridges, rocks, etc -- hear it, immediately turn towards the player and next thing you know, there is a dozen enemies shooting at the player all at the same time.

So what I want to do is to sort of isolate them into their own world if you will. I can control their visual perception by tweaking their orientation towards the world but I haven't been able to block them from each other.

I also want any them to be available at all times for the player to shoot at, and that they can also respond accordingly. So it's not like I can just put them in a dormant state until a player-activated trigger wakes them up.

I have been researching and testing all day to find a workable solution to this scenario but to no avail. So my question is, do you know if there is any way -- without actually having to go dirty and actually programming a custom NPC -- of shutting off their hearing sense, or blocking them from any action until they have been directly damaged?

Any help would be greatly appreciated. :)
 
Have you tried locking them in a scripted sequence and ticking the Override AI flag? Perhaps then parent each character to a func_button of func_breakable to detect damage, to then stop the scripted sequence of the NPC taking damage so, if they are still alive, they have the change to fight back.
 
Thanks a lot for your help! Your idea was certainly worth a shot, but fortunately somebody tipped me about a more accesible and effective solution.

The trick is to place an ai_relationship entity for each enemy which would set them as neutral towards the player by default. Then, for each enemy you script an OnFoundPlayer output aimed at the ai_relationship with the RevertRelationship input. This way, when the enemy sees the player he will roll back to his natural antagonist state and engage him in combat.
 
ah cool. i had noticed this problem before and wondered how to go about making it more realistic.
 
You might also find the "tools/blockLOS" texture useful (stands for "Block Line-of-Sight"). Brushes textured with this can't be seen through by NPCs (otherwise, it's invisible and passable). I believe you can put it on a func_brush to toggle it on and off.
 
Ah, that relationship idea sounds great! Do the other NPC's notice if other NPC's are killed? Do they have a reasction to it?
 
Well, if it's done with the ai_relationship entity they won't do anything unless they see you
 
Back
Top