X0 i0 walkway
x0_i0_walkway
Include library holding the code for WalkWayPoints.
NOTE: This file includes x0_i0_spawncond .
Known Issues
When arriving at a waypoint that has the variable X2_L_WAYPOINT_SETFACING set to 1 on it, the creature will either face east or, if the waypoint is a POST waypoint, do a step (dance) every heartbeat. This is caused by a minor bug in the WalkWayPoints function and can be fixed by replacing lines 414-421 with following block of code:
// *Bugfix - prevent NPCs from facing east or twitching on each HB at POST_/etc. waypoints
if (GetDistanceToObject(oWay) > 1.5 || GetArea(oWay)!= GetArea(OBJECT_SELF))
ActionMoveToObject(oWay, nRun);
if (GetLocalInt(oWay,"X2_L_WAYPOINT_SETFACING") == 1 && fabs(GetFacing(oWay) - GetFacing(OBJECT_SELF)) > 20.0)
ActionDoCommand(SetFacing(GetFacing(oWay)));
Alternatively, this block of code can be used (it addresses the issue above as well as the issue where, after a conversation, the creature continues facing wherever the PC was). Insert this block of code beginning at line 387:
//Bugfix - if I'm already at my POST, I should not continue walking waypoints
object oPostWP = GetNearestObjectByTag("POST_" + GetTag(OBJECT_SELF));
if (GetDistanceToObject(oPostWP) < 1.5)
{
//Bugfix - if I'm not using the correct facing, reset my facing
if (GetLocalInt(oPostWP, "X2_L_WAYPOINT_SETFACING") == 1 && (GetFacing(OBJECT_SELF) != (GetFacing(oPostWP))) )
{
SetFacing(GetFacing(oPostWP));
}
return;
}
NOTE: Use one fix OR the other, NOT both.
Constants
| Name | Value | Brief Description |
|---|---|---|
| NW_WALK_FLAG_BACKWARDS | 0x00000008 | Set when the creature is walking back. |
| NW_WALK_FLAG_CONSTANT | 0x00000002 |
If set, the creature will walk its waypoints constantly, moving on in each OnPerception event. |
| NW_WALK_FLAG_INITIALIZED | 0x00000001 | If set, the creature's waypoints have been initialized. |
| NW_WALK_FLAG_IS_DAY | 0x00000004 | Set when the creature is walking day waypoints. |
| sWalkwayVarname | NW_WALK_CONDITION |
Functions
| Name | Brief Description |
|---|---|
| Checks to see if an NPC has a valid waypoint to walk to. | |
| Determine whether a creature has associated waypoints. | |
| GetNearestWalkWayPoint | Get the number of the nearest of the creature's current set of waypoints (respecting day/night). |
| GetNextWalkWayPoint | Get the creature's next waypoint. If it has just become day/night, or if this is the first time we're getting a waypoint, we go to the nearest waypoint in our new set. |
| GetWalkCondition | Get whether the condition is set. |
| GetWaypointSuffix | Get a waypoint number suffix, padded if necessary. |
| LookUpWalkWayPoints | Look up the caller's waypoints and store them on the creature. |
| SetWalkCondition | Set a given condition. |
| Make an NPC creature walk a series of preset waypoints. |
author: Mistress; editor: Pstemarie;