From Valve Developer Community
Revision as of 04:05, 7 March 2021 by Gaming chair (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Path corner.png

path_corner is a point entity available in all Source games.

Entity description


  • A path_corner is a corner in a path, either for a func_train or an NPC. path_corners can be chained together to form complex routes. To create a path_corner chain simply shift+drag an existing path_corner. The values will automatically be filled in. To manually make a chain (or link one up in a circle), edit the Next stop target property.
  • A path_corner_crash is identical to a path_corner, but can be enabled and disabled for a crash point; when an NPC is searching for a crash point, it will not search for generic path_corners
  • The path_corner entity is !FGD for base.fgd, so it only will appear in Hammer for Half-Life 2

In code, it is represented by theCPathCornerclass, defined in thepathcorner.cppfile.


A path_corner can be a destination for an NPC. When told to, NPCs will stop other movement and walk steadily towards a path_corner. It is entirely scripted behavior. Note that the Train Speed and wait values do not affect NPCs.

To make an NPC move to a path_corner edit the Target Path Corner keyvalue, either in Hammer or through the I/O system. Alternatively, an NPC can be made to follow a path_corner chain by using the aiscripted_schedule or scripted_sequence entities.

  • See also Assaults for an alternative way to create NPC routes without using path_corner.

Limitations and bugs

  • A path_corner (or the first path_corner on a chain) must be within 576 units for NPCs to find it.


Note that the example map does not have any info_nodes. They are not needed to have an NPC follow a path.



Name (targetname) <string>
The targetname that other entities refer to this entity by.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (in all games since Left 4 Dead 2)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call.
Note.png Note: Try to avoid expensive operations in this function, as it may cause performance problems.
Next stop target (target) <string>
Wait here (secs) (wait) <float>
New train speed (speed) <float>
Leave at zero to leave path follower's speed the same


  • 1 : Wait for retrigger
  • 2 : Teleport to THIS path_corner



Removes this entity from the world.
Removes this entity and its children from the world.
Note.png Note: Entities already remove orphaned children upon being removed, but this input removes all children on the same frame, being marginally faster than Kill.
AddOutput <string>
Adds a keyvalue/output to this entity. It can be potentially very dangerous, use with care.
KV Format: <key> <value>
I/O Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
Same as a player invoking +use; may not do anything depending on the entity. Can also be invoked by firing an output that does not specify an input.
RunScriptFile <script> (in all games since Left 4 Dead 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since Left 4 Dead 2)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Bug.png Bug: In Left 4 Dead 2, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning.png Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
CallScriptFunction <string> (in all games since Left 4 Dead 2) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin <coordinates> (in all games since Alien Swarm) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (in all games since Alien Swarm) !FGD
Set this entity's angles.
  • SetNextPathCorner
<target_destination> Set target path_corner



OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (only in Left 4 Dead Left 4 Dead 2)
This output fires when the entity is killed and removed from the game.
  • OnPass
Fires when a path follower passes this point. (activator is the train)