Difference between revisions of "HPL3/Areas/PathNode Area"
m |
(added examples and usage) |
||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
− | The PathNode Area is an area that acts as a point entity that generates a | + | Helper Function: [[Ai_Helper | helper_ai.hps]] |
+ | |||
+ | The PathNode Area is an area that acts as a point entity that generates a navigable path for agents to use for pathfinding. Each area much be assigned to each enemy entity using the function <code>Pathfinder_Track_Add()</code> and the agent must be started on the path using the function <code>Pathfinder_Track_Start()</code>. These Functions require the helper_ai.hps script to be included in the map file. Not all agents can be used with the pathnode system as some are designed to be used in specific situations. | ||
== Properties == | == Properties == | ||
The PathNode Area takes no properties | The PathNode Area takes no properties | ||
+ | |||
+ | == Script Example == | ||
+ | A simple for loop can be used to add <code>n</code> path nodes to an agents pathfinding. | ||
+ | <syntaxhighlight lang="c++"> | ||
+ | for(int i = 1; i <= n; i++) | ||
+ | { | ||
+ | Pathfinder_Track_Add("_agent_", "PathNodeArea_" + n, 0.0f, 0.5f, "", false); | ||
+ | }</syntaxhighlight> | ||
+ | |||
+ | where <code>"_agent_"</code> is the name of the agent to assign to the node. | ||
+ | |||
+ | To start the agent on the path node network you can call the <code>Pathfinder_Track_Start()</code> function. | ||
+ | |||
+ | <syntaxhighlight lang="c++">Pathfinder_Track_Start("_agent_", true, 1.0f, "");</syntaxhighlight> |
Latest revision as of 15:58, 1 February 2024
Overview
Helper Function: helper_ai.hps
The PathNode Area is an area that acts as a point entity that generates a navigable path for agents to use for pathfinding. Each area much be assigned to each enemy entity using the function Pathfinder_Track_Add()
and the agent must be started on the path using the function Pathfinder_Track_Start()
. These Functions require the helper_ai.hps script to be included in the map file. Not all agents can be used with the pathnode system as some are designed to be used in specific situations.
Properties
The PathNode Area takes no properties
Script Example
A simple for loop can be used to add n
path nodes to an agents pathfinding.
for(int i = 1; i <= n; i++)
{
Pathfinder_Track_Add("_agent_", "PathNodeArea_" + n, 0.0f, 0.5f, "", false);
}
where "_agent_"
is the name of the agent to assign to the node.
To start the agent on the path node network you can call the Pathfinder_Track_Start()
function.
Pathfinder_Track_Start("_agent_", true, 1.0f, "");