Game Development Reference
In-Depth Information
7. Drag-and-drop this component from the NPC into the condition field of inter-
action of Element 0 . This associates this condition with the required interac-
tion code. Note that if we forget to add the component to the DecisionMgr
as we have done, the condition component will never get evaluated.
8. Drag-and-drop an instance of response_changeState , and add it to the
NPC.
9. Set the NPC reference to the NPC that owns the component, and set the new
state to turnToPlayer .
10. Drag-and-drop this component from the NPC into the response field of the
interaction of Element 0 . This associates the response with the required in-
teraction code.
11. Drag-and-drop an instance of condition_fartherThanThresh , and add
it to the NPC.
12. Set the thresh to 20 units, trackObj to the npc , and baseObj to Player .
13. Drag-and-drop this component from the NPC into the condition field of the
Interaction tab of Element 1 . This associates this condition with the second
interactions code.
14. Drag-and drop-another instance of response_setState onto the NPC. Set
the NPC to the parent NPC and the state to patrol .
Congratulations, we have configured the NPC DecisionMgr component to stop
when it is close enough and turn to face the player. When the player leaves, the NPC
Search WWH ::




Custom Search