NPC use of Portals
From Valve Developer Community
- Create two prop_portals, a few feet in front of some walls.
- Set up a path for your NPC to follow using path_corners. Place whatever path you want in front of a portal, then one directly behind it. (Note: so far the path_corner going behind the portal must be in walkable space, or the NPC won't go to it. A workaround might be to make a brush that is walkable only to nonplayers somehow).
- Place a path_corner in front of the other portal, followed by whatever path you want the NPC to walk afterwards. Note: The path_corner behind the first portal does NOT need to point to the one in front of the other portal. Doing so may in fact confuse you or cause clutter, since Hammer adds a direction line between two connected path_corners, which this does not need.
- Create an NPC and set his Target Path Corner to the start of the first path.
- Place a trigger_multiple in front of the second portal, filtered to only the NPC you want. This trigger will tell the NPC to stop walking to the old path_corner that is behind the first portal, and tell him to start on the next path in front of the second portal.
- Set the trigger outputs to a aiscripted_schedule with the schedule "Walk Goal Path" and the goal entity being the path_corner in front of the second portal.
- Set the triggers flag to only "NPCs."
- Make sure you have a filter_activator_name set for the trigger, so it knows to only do this if the NPC walks through. Set this up like you would for using the box to trigger a button.