Difference between revisions of "Info node"
Tom Edwards (talk | contribs) (AI Basics moved to Introduction to AI) |
Gatelych83 (talk | contribs) (→Usage: 1 will cause nodegraphs to not rebuild) |
||
(32 intermediate revisions by 21 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[File: info_node.png | right | 300px]] | |
+ | {{base_point|info_node}} | ||
+ | __TOC__ | ||
+ | {{clr}} | ||
+ | |||
+ | ==Entity description== | ||
+ | It is a ground [[navigation node]] for ground moving [[NPC]]s. Navigation nodes are baked into the [[nodegraph]] so that NPCs can move to them. | ||
+ | |||
+ | * Ground nodes fall to the ground when they spawn, so you can place them up to 128 units above any solid world geometry, which excludes func_brush, and they will still work. | ||
+ | |||
+ | * When placing nodes on [[displacement]]s, place them slightly above the terrain to ensure connections are properly made. Use the [[Transform]] tool (Ctrl+M) to move many nodes quickly. | ||
+ | |||
+ | == Usage == | ||
+ | Create an interesting map, place some enemies in it, and run it. Don't kill them straight away but turn on [[mat_wireframe]] and watch their actions as you move around. You'll see them, more or less, run straight at you and shoot. This is because they have no bearings in the world other than your position. | ||
+ | |||
+ | Leave the game and lay down info_node entities across the map, preferably at each point where the AI would have to choose what to do, or anywhere the AI might want to go - basically, any important place for the AI. Then recompile and do the same as last time. You should now see them group and attack together if they need to, seek cover, throw grenades at far more suitable times, try to get around you and more - all because you added a few nodes. | ||
+ | |||
+ | This alone has fully set up your AI for a map. | ||
+ | |||
+ | {{note|If, for some reason, your NPCs are not moving to the nodes or are simply not moving at all despite the existence of nodes, the first thing you want to try is to add a few [[info_node_hint|hint]] nodes with contextual information like Crouch Cover Low. If they are not moving to those nodes either, then the game did not build or rebuild the node graph data. In order to get them to build automatically at every new compile you make, create an autoexec.cfg in your cfg folder and add '''ai_norebuildgraph 0'''. You may also use the command '''map_edit''' right after compiling your map, as this command will force the nodes to rebuild when you edit, add or remove nodes while in-game. Check [[Nodegraph|the nodegraph page]] for a full explanation on nodegraph usage.}} | ||
+ | |||
+ | ==Keyvalues== | ||
+ | {{KV Targetname}} | ||
+ | {{KV Node}} | ||
+ | |||
+ | ==Flags== | ||
+ | * 1 : [[NPC_Hull#human_hull|Force human permission]] | ||
+ | * 2 : [[NPC_Hull#small_centered_hull|Force small_centered permission]] | ||
+ | * 4 : [[NPC_Hull#wide_human_hull|Force wide_human permission]] | ||
+ | * 8 : [[NPC_Hull#tiny_hull|Force tiny permission]] | ||
+ | * 16 : [[NPC_Hull#wide_short_hull|Force wide_short permission]] | ||
+ | * 32 : [[NPC_Hull#medium_hull|Force medium permission]] | ||
+ | * 64 : [[NPC_Hull#tiny_centered_hull|Force tiny_centered permission]] | ||
+ | * 128 : [[NPC_Hull#large_hull|Force large permission]] | ||
+ | * 256 : [[NPC_Hull#large_centered_hull|Force large_centered permission]] | ||
+ | * 512 : Keep editor position | ||
+ | |||
+ | ==Inputs== | ||
+ | {{I Targetname}} | ||
+ | |||
+ | ==Outputs== | ||
+ | {{O Targetname}} | ||
+ | |||
+ | == See also == | ||
+ | * [[hint nodes]] | ||
+ | * [http://www.btinternet.com/~varsity_uk/VDC/Source_AI/info_node_demo.zip Example map (VMF)] | ||
+ | |||
+ | [[Category:AI]] |
Latest revision as of 11:32, 23 December 2019
info_node
is a point entity available in all Source games.
Entity description
It is a ground navigation node for ground moving NPCs. Navigation nodes are baked into the nodegraph so that NPCs can move to them.
- Ground nodes fall to the ground when they spawn, so you can place them up to 128 units above any solid world geometry, which excludes func_brush, and they will still work.
- When placing nodes on displacements, place them slightly above the terrain to ensure connections are properly made. Use the Transform tool (Ctrl+M) to move many nodes quickly.
Usage
Create an interesting map, place some enemies in it, and run it. Don't kill them straight away but turn on mat_wireframe and watch their actions as you move around. You'll see them, more or less, run straight at you and shoot. This is because they have no bearings in the world other than your position.
Leave the game and lay down info_node entities across the map, preferably at each point where the AI would have to choose what to do, or anywhere the AI might want to go - basically, any important place for the AI. Then recompile and do the same as last time. You should now see them group and attack together if they need to, seek cover, throw grenades at far more suitable times, try to get around you and more - all because you added a few nodes.
This alone has fully set up your AI for a map.

Keyvalues
Targetname:
- Name
(targetname)
<string>
- The targetname that other entities refer to this entity by.
- Entity Scripts
(vscripts)
<scriptlist>
(in all games since)
- 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)
- 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: Try to avoid expensive operations in this function, as it may cause performance problems.
- Node ID
<integer>
- Read-only internal Hammer value.
Flags
- 1 : Force human permission
- 2 : Force small_centered permission
- 4 : Force wide_human permission
- 8 : Force tiny permission
- 16 : Force wide_short permission
- 32 : Force medium permission
- 64 : Force tiny_centered permission
- 128 : Force large permission
- 256 : Force large_centered permission
- 512 : Keep editor position
Inputs
Targetname:
Kill
- Removes this entity from the world.
KillHierarchy
- Removes this entity and its children from the world.
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
toFireUser4
- 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)
- 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)
- 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: In
, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
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) !FGD
- Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin
<coordinates>
(in all games since) !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) !FGD
- Set this entity's angles.
Outputs
Targetname:
OnUser1
toOnUser4
- These outputs each fire in response to the firing of the like-numbered
FireUser1
toFireUser4
Input; see User Inputs and Outputs. OnKilled
(only in)
- This output fires when the entity is killed and removed from the game.