Module Route
(SP) (MP) (FSM) Route AI or players to waypoints or zones.
1) #ROUTEZONE class, extends StateMachine#STATEMACHINE
The #ROUTEZONE class implements the core functions to route an AIR Controllable player Unit to a Zone. The player receives on perioding times messages with the coordinates of the route to follow. Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
1.1) ROUTEZONE constructor:
- ROUTEZONE.New(): Creates a new ROUTEZONE object.
1.2) ROUTEZONE state machine:
The ROUTEZONE is a state machine: it manages the different events and states of the Controllable it is controlling.
1.2.1) ROUTEZONE Events:
- ROUTEZONE.Start( Controllable ): Start the route to the zone. Messages will appear within defined intervals.
1.2.2) ROUTEZONE States:
- UnArrived: The player is still underway to the zone.
- Arrived: The Controllable has arrived at the zone.
1.2.3) ROUTEZONE state transition functions:
State transition functions can be set by the mission designer customizing or improving the behaviour of the state. There are 2 moments when state transition functions will be called by the state machine:
Before the state transition. The state transition function needs to start with the name OnBefore + the name of the state. If the state transition function returns false, then the processing of the state transition will not be done! If you want to change the behaviour of the AIControllable at this event, return false, but then you'll need to specify your own logic using the AIControllable!
After the state transition. The state transition function needs to start with the name OnAfter + the name of the state. These state transition functions need to provide a return value, which is specified at the function description.
1.3) Manage the ROUTEZONE parameters:
The following methods are available to modify the parameters of a ROUTEZONE object:
Global(s)
| ROUTEZONE |
Type ROUTEZONE
| ROUTEZONE.ClassName | |
| ROUTEZONE.DisplayCategory | |
| ROUTEZONE.DisplayCount | |
| ROUTEZONE.DisplayInterval | |
| ROUTEZONE.DisplayMessage | |
| ROUTEZONE.DisplayTime | |
| ROUTEZONE:New(Task, Unit, ProcessUnit, TargetZone) |
Creates a new routing state machine. |
| ROUTEZONE.ProcessUnit | |
| ROUTEZONE.TASK | |
| ROUTEZONE.TargetZone | |
| ROUTEZONE:onleaveUnArrived(ProcessUnit, Event, From, To) |
StateMachine callback function |
Global(s)
Type Route
Type ROUTEZONE
ROUTEZONE class
Field(s)
- #string ROUTEZONE.ClassName
- #string ROUTEZONE.DisplayCategory
-
Route is the default display category
- #number ROUTEZONE.DisplayCount
- #number ROUTEZONE.DisplayInterval
- #boolean ROUTEZONE.DisplayMessage
- #number ROUTEZONE.DisplayTime
-
10 seconds is the default
- ROUTEZONE:New(Task, Unit, ProcessUnit, TargetZone)
-
Creates a new routing state machine.
The task will route a CLIENT to a ZONE until the CLIENT is within that ZONE.
Parameters
Return value
#ROUTEZONE: self
- ROUTEZONE:onleaveUnArrived(ProcessUnit, Event, From, To)
-
StateMachine callback function
Parameters
-
Controllable#CONTROLLABLE ProcessUnit: -
#string Event: -
#string From: -
#string To:
-