NPC use of Portals: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (cats)
(Updated link for the example map to the new thinking with portals website)
Line 14: Line 14:


== External links ==
== External links ==
* [http://forums.thinkingwithportals.com/downloads.php?view=detail&df_id=183 Example Map] Example map using this tutorial. VMF included.
* [https://forums.thinking.withportals.com/downloads.php?view=detail&df_id=183 Example Map] Example map using this tutorial. VMF included.
* [http://www.youtube.com/watch?v=k6JUUOH9O78 Example Video] Example video using this tutorial
* [http://www.youtube.com/watch?v=k6JUUOH9O78 Example Video] Example video using this tutorial


[[Category: Portal]]
[[Category: Portal]]
[[Category: Level Design Tutorials]]
[[Category: Level Design Tutorials]]

Revision as of 17:19, 28 August 2019

Making NPCs walk through Portals is very easy. All it takes is a bit of trigger and path work and is all done from within Hammer (so no AIs stumbling through the Portals).

Steps

  • 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.

See also

External links