Game Development Reference
In-Depth Information
more detail about them in the next chapter. For now, create three expression nodes
as children of the Random node by right-clicking on Random and navigating to
Create | Actions | Expression . An expression node allows us to execute a single
statement, which is called an expression in RAIN. Rename the expression nodes
Choose Location 1 , Choose Location 2 , Choose Location 3 . Then, in
the expression field for the nodes, set the first to location = navigationtar-
get(Location1) , and do the same for the other location expression nodes, using
numbers 2 and 3. These expression nodes create a variable location that is a ran-
domly determined navigation target that we can use as a target to walk to. The setup
should look like this:
All that is left is to add nodes to walk to the target. Right-click on the root node
and navigate to Create | Decisions | Waypoint Path (not waypoint patrol like last
time). In the waypoint path node, set the Waypoint Network field to PatrolNet-
work (with quotes) to tell it which network to use. Set the Path Target field to loca-
tion (without quotes), which is the variable we stored our random target to walk to.
Finally, set up the rest of the tree as shown earlier, with an animation node and a
child Move node. The final setup should look as shown in the following screenshot:
If you run the project now, the character will randomly patrol the area of the level by
randomly walking from one navigation target location to the next and always walking
through the middle of the level.
Search WWH ::




Custom Search