API ReferenceGE Extensionsscenario
Waypoint Action
A scenario goal that displays flash messages when the player reaches specific waypoints. Unlike other goals, this is purely informational - it doesn't trigger win or fail conditions.
A scenario goal that displays flash messages when the player reaches specific waypoints. Unlike other goals, this is purely informational - it doesn't trigger win or fail conditions.
Internal State
| Field | Type | Description |
|---|---|---|
M.instances | varies | Assigned as {} |
Public API (Exports)
| Function | Signature | Description |
|---|---|---|
M.init | (scenario) | Parses and validates wayPointAction goals from scenario JSON |
M.processState | (scenario, state, stateData) | Checks waypoint progress; shows messages |
M.updateFinalStatus | (scenario, instance) | No-op (no pass/fail status) |
Goal JSON Schema
{
"goal": {
"wayPointAction": {
"wayPointNum": [2, 5, 8],
"wayPointMsg": ["Turn left!", "Speed up!", "Almost there!"]
}
}
}| Field | Type | Default | Description |
|---|---|---|---|
wayPointNum | number[] | required | Waypoint indices to trigger messages at |
wayPointMsg | string[] | " " | Messages to display (parallel array with wayPointNum) |
How It Works
initfilters goals forid == "wayPointAction", validateswayPointNumis a table- On
onRaceWaypointReachedevent (only whilerunning+racing):- Gets current waypoint index from
scenario_waypoints.getVehicleWaypointData() - Iterates
wayPointNumarray - each entry must be a number - If
vehWpData.curmatches a waypoint number, shows the correspondingwayPointMsg
- Gets current waypoint index from
- Messages displayed via
helper.flashUiMessagewith 2-second duration updateFinalStatusis empty - this goal has no scoring impact
Usage Example
-- In scenario JSON: show messages at waypoints 3 and 7
{
"vehicles": {
"scenario_player0": {
"goal": {
"wayPointAction": {
"wayPointNum": [3, 7],
"wayPointMsg": [
"Watch out for the sharp turn!",
"Final stretch - give it everything!"
]
}
}
}
}
}Key Notes
- Only triggers during
onRaceWaypointReachedwhen state isrunning+racing wayPointNumandwayPointMsgare parallel arrays (index 1 matches index 1)- Validates both scenario
lapConfigandwayPointNumare non-empty - Non-number entries in
wayPointNumare logged as errors and skipped - If
wayPointMsgis not provided, defaults to a space string" " - This is an informational goal - it never causes pass/fail
See Also
- Scenario Bus Driver - Bus Route Scenario Logic - Related reference
- Scenario Damage Goal - Damage-Based Win/Fail Condition - Related reference
- Scenario Demolition Derby - Last Vehicle Moving Wins - Related reference
- Scenario System Guide - Guide