NPCs and Swing Doors

In a few isolated instances, I have seen scientist and security NPCs open use-to-open-based swing doors while attempting to get from one area to another. However, I have not been reliably able to replicate this.

As the latest release of OCPD is planned to feature a few isolated prototypes of NPCs that actually move around the level, I would be interested in finding out if there was a way to make swing doors like those in Office Complex reliably openable by npc_human_scientist and npc_human_security as they move from place to place to perform scripted sequences. I am fairly sure there is a way to do it through scripted sequences, but each door would require complicated logic to run different scripts if it is open or closed and even more complicated logic to make this method applicable to every NPC on the map as opposed to a specific named one.

I know that one of the ways to do it would be with an NPC-only trigger that opens the door when NPC enters it and closes when NPC exits it (so -> trigger_multiple).

Another way I can think of is having a scripted_sequence that plays animation of door opening in front of the door, which also triggers the door opening with a custom delay or on animation end.

However, there is also another entity: hint node. Hint node with type of “Enter/exit pinch” should work in the doorway.

Now, I am not sure what exactly do you mean by “swing doors”? Do you mean prop_door_rotating or do you mean physics-based door that are opened by momentum (traveling/pushing through them)? If it’s the former, then all of those should work, in fact, if NPC’s programming allows it to open doors, none of it should be needed. In case of latter, I think the last one might work.

Because, I don’t recall any doors in Office Complex other than the standard prop_door_rotating.

There’s a few entities in base that can do this or can be made to do this.

https://developer.valvesoftware.com/wiki/Func_lookdoor
This could be hooked up to respond to NPCs in theory, perhaps with a filter_activator_class to ensure only the right NPCs trigger it.

I think there’s some kind of entity specifically designed to grab an NPC and make them use an object that isn’t scripted_sequence. I’ll update this post when I can verify this at home.

Scripted_sequence could also work, but this would not be AI-driven and require taking the NPC out of AI to force them to open the door with an animation.

Yeah, I meant prop_door_rotating. I’ve been having a hard time coercing NPCs to move across hint nodes under their own power, though, and they definitely will not use them when moving to a scripted scene.

The problem with logic-based and scripting-based approaches is that they can get rather complicated if the door is one players can open arbitrarily, as that requires at the very least enabling and disabling scripted sequences. I might have better luck with less override-based NPC controllers to get them to move around, though. Stuff like scripted sentences, etc. I’ll see what happens when I get home from work.

UPDATE: Looks like scripted schedules don’t show the desired behavior either. NPCs will shuffle around for a while and then stand in front of doors without opening them. That said, I may be able to get better results with, in the case of double doors, two hint nodes per door.

Also, don’t forget to put in info_node_hint set to Entrance/Exit Pinch, this will help resolve issues with the AI bunching up on a door and not going through. The official wiki says to avoid having combat around doors if possible, and to use scripts or assaults when things like room clearing are necessary.

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.