- Area node structure, for the structure of waypoint nodes
- Paths, for other types of path systems
- Waypoint Path tutorial, for a beginner-level tutorial on how to create a basic waypoint path
Paths can be used for a variety of things such as:
- Creatures or characters can move along a path for specific scripted movement (Note: This might be better to do with an automated system, see HeroPath).
- Waypoints can be used to mark arbitrary locations, such as places of interest, or where characters should be placed when they teleport to an area
- Paths can have Follower nodes that traverse the waypoint, and thus other things can be parented to the follower (great for special effects).
Paths, and their waypoints, are created in HeroBlade by the area designer (never in HeroScript).
Creating a Path
Via the Paths Panel, various waypoints are added. These waypoints can be dragged around and placed exactly, just like any other graphical element.
- Every area is required to have a path named
Arrival_1. This path will contain the point or points that a character will by default be sent to when they teleport to an area.
- The point(s) of this path must be placed on the ground of an area. Otherwise the character will be placed at a location in the air, and "fall" to ground level!
For more information about creating and configuring a path, please see the Path Tutorial.
Waypoints can be checked with the appropriate functions:
Get Start Waypoint
GetStartWaypoint(path as noderef) as ID
This function returns the ID of the first waypoint in the specified path.
startID as ID = GetStartWaypoint(path)
Get End Waypoint
GetEndWaypoint(path as noderef) as ID
This function returns the end waypoint in the specified path.
endID as ID = GetEndWaypoint(path)
Get Waypoint Location
This function returns the world space location of the specified waypoint in the specified path, as a Vector3.
GetWaypointLocation(path as noderef, waypoint as ID) as Vector3
wplocation as Vector3 = GetWaypointLocation(path, waypoint)
Get Next Waypoint
GetNextWaypoint(path as noderef, pointID as ID) as ID
This function returns the next waypoint after
path. If it is given the last waypoint, it returns a value of 0.
nextID as ID = GetNextWaypoint(path, pointID)
Get Nearest Waypoint
GetNearestWaypoint(path as noderef, location as vector3)
This function returns the next closest waypoint of this Path, given the specified location. Note that this is an "as the crow flys" sense of closest -- it may not necessarily mean the easiest one to get to!
nearestID as ID = GetNearestWaypoint(path, location)
Get Previous Waypoint
This function returns the previous waypoint before
path. If it is given the first waypoint, it returns a value of 0.
prevID as ID = GetPrevWaypoint(path, pointID)
Get Waypoint Data
When waypoints are selected in HeroBlade, a text box allows arbitrary text to be entered and stored with the waypoint. This function retrieves that text.
GetWaypointData(path as noderef, waypoint as ID) as string
comment as string = GetWaypointData( pathNode, waypointID)
Get Path by Name
GetPathByName(pathname as string) as noderef
A follower is a special kind of node which can attach itself to a path, and move at a specified rate of speed. It is normally invisible, but can be viewed while editing an Area, or linked to some other node (like a boat or glowing object), and then that object will move in whatever way is specified by the path and follower. There can be multiple followers linked to a path, or no followers. For example, the
arrival_01 path is used to designate where players should be sent to when they enter an area, and therefore the path does not require any followers.
Creating a Follower
Follower nodes are created in one of two ways:
- Via the Create Menu in HeroBlade, select Path Follower.
- In the Paths Panel, by selecting a path and then clicking on Create Follower
Followers are always associated with a particular path, and then the Follower's properties can be adjusted to specify how fast it should move, what it should do when it arrives at waypoints or the end of a path, and so forth.
To see path followers, ensure that they are turned on in the Filters Menu.
To select path followers, go to the Paths Panel and click on Select Followers.
To start a follower moving, select it via the above method, look at its properties in the Properties Panel, and set PAUSE to FALSE.
This function returns a list of hbnode node references that contains all followers that are set to follow the specified path.
GetFollowers(path as noderef) as list of noderef of class hbnode
followers as List of Noderef of Class hbnode followers = GetFollowers(mypath)
On Follower Reached Waypoint
OnFollowerReachedWaypoint(path as noderef of class hbpath, waypoint as ID)
When a path follower reaches a waypoint, if its script field is set and this callback function exists in the specified script, it will be called with
me set to the path follower. The MasterCamera script is a primary example of a script that uses this function. Note that path followers exist only on the client, and that the script being called must be a client-side script.
Reset Path Follower
ResetPathFollower(follower as noderef of class hbnode, resetRotation as boolean)
This function will reset a path follower to its starting location and set it to seek the next waypoint. If resetRotation is TRUE, it will also snap to point directly at its next waypoint. If resetRotation is FALSE, it will retain its current rotation.
Please also see the section on:
If you add a path named
Demo to an area, when you load the area, the camera
will automatically start at its first waypoint, looking toward its second waypoint, and auto-select rooms (F1) will be automatically turned on, but the path will not be selected.
// pathNode as node pathNode = 42 pointID as integer pointID = GetStartWaypoint( pathNode) v3 as vector3 while (pointID != 0) loop v3 = GetWaypointLocation( pathNode, pointID) pointID to GetNextWaypoint( pathNode, pointID) . pointID = GetEndWaypoint( pathNode) pointID = GetNearestWaypoint( pathNode, v3); //
// pointID = GetEndWaypoint( pathNode) v3 as vector3 while (pointID != 0) loop v3 = GetWaypointLocation( pathNode, pointID) pointID = GetPreviousWaypoint( pathNode, pointID) . //
- IsCharacterServerDriven(char as noderef), a function which will return a boolean value to indicate whether or not a given character is being run by server-specified waypoints.
- Camera Commands, which may run a camera along a waypoint path
- Waypoint Path Tutorial, a beginner-level tutorial on how to create a basic waypoint path