Game Development Reference
In-Depth Information
to various AI classes, such as the AI's mind and senses. Here, we access Work-
ingMemory and can get the different memory items as well as set values for them.
That is all the action needs to do so that ActionResult can leave returning suc-
cess.
If we run the project now, we should see the ship patrol for 5 seconds, but instead of
moving back to the game base, the ship just stops. The last thing we need to add is
a move node to the home base. Set the move target to "gameBase" (RAIN requires
the quotes), and as we want the ship to return home faster than it patrols, change
the speed to 10 . And since we want the ship to stop as soon as it is near the base,
change the Repeat dropdown to Until Success and set a Close Enough distance
to 0.1 . This will make the ship go to the gameBase target and stop. The screen
should look as shown:
If we run the demo now, the ship will patrol for 5 seconds and then just stop again.
The issue here is the Sequencer node: it goes through its children returning on the
first fail. After the stopPatrolling node is activated, the constraint nodes will return
failure, so when the sequencer calls, it stops after the first constraint. To remedy this,
right-click on the sequencer node and change its type to Selector and rename it to
selector .
Search WWH ::




Custom Search