Game Development Reference
In-Depth Information
node and navigate to Create | Actions | Custom Action . Set the Repeat property to
Until Success because we want it to continue processing this node until it returns a
success and then move on to the next node. Name the custom action node Select
Next Target . You'll notice that you can put spaces in the name. This is useful as it
shows up in the behavior tree, making it easier to follow:
We could add the script now, but we'll finish the rest of the nodes in the tree and then
come back; for now, we will assume that the script will find a spot to walk to. The
next action is to walk to it. This needs two things happening simultaneously, anim-
ation and actual walking, which means that we will use the Parallel decision node.
Right-click on the sequence node and select Create | Decisions | Parallel . Name it
Walk to Target .
Under Walk to Target ,right-clickandgoto Create | Actions | Animate .Nameit Ap-
pear Walking . Set the animation state to walk . Also under Walk to Target , right-
click and navigate to Create | Actions | Move . Name it Move . Set the Move Speed
property to 1 , so it moves 1 meter per second. The Move Target value should be
set to TargetPoint without the quotes. TargetPoint doesn't exist yet; our script will
create it.
The last step that the NPC must perform is generate a wait moment. To give the NPC
more life, we will make sure that it uses an idle animation, which also means two
things must happen simultaneously. Right-click on the root sequence node ( SEQ )
and go to Create | Decisions | Parallel . Name it Look Busy . Add an animation ac-
tion under this and set idle as its Animation State and Stand here as its name.
Also, under the Look Busy node, we will right-click and go to Create | Actions |
Wait for Timer . Name it For a couple seconds . Set the Seconds property to 2 .
Search WWH ::




Custom Search