This article's documentation is for anything that uses the Source engine. Click here for more information.

Path corner: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(seems false)
 
(23 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{lang|title=path_corner}}
{{LanguageBar}}
{{TabsBar|main=gs|base=path_corner}}
{{Ent not in fgd}}
{{this is a|point entity|name=path_corner|sprite=1}}
{{CD|CPathCorner|file1=pathcorner.cpp}}{{toc-right}}


{{infotable
{{clarify|{{ent|path_track}} vs {{mono|path_corner}} }}
|path_corner
|img=[[Image:path_corner.png]]
|type=e0
|engine=2
|in=0
}}


{{entity|path_corner|type=e0}}


 
== Entity description ==
==Entity description==
=== Notes ===
===Notes===
* 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''' 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 {{Not in FGD}} for '''base.fgd''', so it only will appear in Hammer for [[Half-Life 2]]
{{Code class|[https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/game/server/pathcorner.cpp#L15 CPathCorner]|[https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/game/server/pathcorner.cpp pathcorner.cpp]}}
{{clr}}


===NPCs===
=== NPCs ===
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.
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.


Line 30: Line 22:
* It is either difficult or impossible to tell an NPC which direction to face once they've reached a path corner. If this is important, you may want to consider using [[Assaults]] instead.
* It is either difficult or impossible to tell an NPC which direction to face once they've reached a path corner. If this is important, you may want to consider using [[Assaults]] instead.


====Examples====
==== Examples ====
* See the [[apc_on_path]] and the [[npc_scanner_on_path]] prefabs for examples on usage.
* See the [[apc_on_path]] and the [[npc_scanner_on_path]] prefabs for examples on usage.
* [http://www.steamreview.org/external/vdc/source_ai/apc_drive.zip Download Example (VMF)]
* [http://www.steamreview.org/external/vdc/source_ai/apc_drive.zip Download Example (VMF)]


Note that the example map does not have any [[info_node|info_nodes]]. They are not needed to have an NPC follow a path.
Note that the example map does not have any [[info_node|info_nodes]]. They are not needed to have an NPC follow a path.
 
{{clr}}
==Keyvalues==
== Keyvalues ==
*{{KV Targetname}}
{{KV Targetname}}
{{KV|Next stop target|string|intn=target|}}
{{KV|Next stop target|string|intn=target|}}
{{KV|Wait here (secs)|float|intn=wait|}}
{{KV|Wait here (secs)|float|intn=wait|}}
{{KV|New train speed|float|intn=speed|Leave at zero to leave path follower's speed the same}}
{{KV|New train speed|float|intn=speed|Leave at zero to leave path follower's speed the same}}


==Flags==
== Flags ==
* 1 : Wait for retrigger
{{fl|1|Wait for retrigger}}
* 2 : Teleport to THIS path_corner
{{fl|2|Teleport to THIS path_corner}}
 
== Inputs ==
{{I|SetNextPathCorner|param=target_destination|Set target [[path_corner]]}}
{{I|InPass|Called internally by game|nofgd=1}}
 
== Outputs ==
{{O|OnPass|activator = activator of the InPass input, usually the train
|caller = caller of the InPass input, usually the train|Fires when a path follower passes this point.}}
 
== FGD Code ==
The path_corner entity is not in defined the base.fgd that all games share. It only exists in the halflife2.fgd.<br>You may copy the FGD entry from the expand box below to the bottom of your [[base.fgd]] to make it appear in {{hammer|2}}.
{{ExpandBox|title=FGD entry from halflife2.fgd|{{pre|<nowiki>@PointClass base(Targetname, Angles) size(16 16 16) line(255 255 255, targetname, target) color(247 181 82) = path_corner : "Generic path point"
[
spawnflags(Flags) =
[
1: "Wait for retrigger" : 0
2: "Teleport to THIS path_corner" : 0
]
target(target_destination) : "Next stop target"
wait(integer) : "Wait here (secs)" : 0
speed(integer) : "New Train Speed" : 0
yaw_speed(integer) : "New Train rot. Speed" : 0
 
// Inputs
input SetNextPathCorner(string) : "Sets next pathcorner"
 
// Outputs
output OnPass(void) : "Fires when a path follower passes this point"
]</nowiki>}}}}


==Inputs==
== See also ==
*{{I Targetname}}
* {{ent|path_track}}
* '''SetNextPathCorner'''
: <target_destination> Set target [[path_corner]]


==Outputs==
[[Category:AI]]
*{{O Targetname}}
[[Category:Entities]]
*'''OnPass'''
: Fires when a path follower passes this point. {{activator|train}}
[[Category:AI]][[Category:Entities]]

Latest revision as of 07:39, 24 May 2025

English (en)한국어 (ko)Translate (Translate)
Icon-NotInFGD.png
This entity is not in the Counter-Strike: SourceDay of Defeat: SourceTeam Fortress 2Left 4 DeadLeft 4 Dead 2Counter-Strike: Global Offensive FGD by default.
See below for instructions on making it available.
Path corner.png

path_corner is a point entity available in all Source Source games.

C++ Class hierarchy
CPathCorner
CPointEntity
CBaseEntity
C++ pathcorner.cpp
Clarify: path_track vs path_corner


Entity description

Notes

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

NPCs

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.
  • It is either difficult or impossible to tell an NPC which direction to face once they've reached a path corner. If this is important, you may want to consider using Assaults instead.

Examples

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

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

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

Flags

Wait for retrigger : [1]
Teleport to THIS path_corner : [2]

Inputs

SetNextPathCorner <targetnameRedirectInput/string>
Set target path_corner
InPass  !FGD
Called internally by game

Outputs

OnPass
!activator = activator of the InPass input, usually the train
!caller = caller of the InPass input, usually the train
Fires when a path follower passes this point.

FGD Code

The path_corner entity is not in defined the base.fgd that all games share. It only exists in the halflife2.fgd.
You may copy the FGD entry from the expand box below to the bottom of your base.fgd to make it appear in Hammer Hammer.

FGD entry from halflife2.fgd 
@PointClass base(Targetname, Angles) size(16 16 16) line(255 255 255, targetname, target) color(247 181 82) = path_corner : "Generic path point"
[
	spawnflags(Flags) =
	[
		1: "Wait for retrigger" : 0
		2: "Teleport to THIS path_corner" : 0
	]
	target(target_destination) : "Next stop target"
	wait(integer) : "Wait here (secs)" : 0
	speed(integer) : "New Train Speed" : 0
	yaw_speed(integer) : "New Train rot. Speed" : 0

	// Inputs 
	input SetNextPathCorner(string) : "Sets next pathcorner"

	// Outputs
	output OnPass(void) : "Fires when a path follower passes this point"
]

See also