Creating a Pet AI

Note: It is recommended that users have fully setup an AI's Player Tag, Animation Profile, and other basic steps before proceeding.

Creating a Pet AI

Pet AI are intended for non-combat usage and will follow their user set Target to Follow. They cannot be detected by other AI and will not flee or attack. They have no other behavior settings other than a Target to Follow option.

To make a Pet AI, simply set the Current Behavior Type to Passive within the Behavior Component and assign the desired Target to Follow.

Setting a Target to Follow Through Code

There are two ways to assign a Target to Follow through code, if desired.

Through the EmeraldAPI

The first method is to assign a Target to Follow through the static EmeraldAPI class. The TransformToFollow would be the target you would like the owner of the EmeraldComponent to follow.

EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Detection.SetTargetToFollow(EmeraldComponent, TransformToFollow);

Through the Detection Component

The second method is through the AI's own detection component. The TransformToFollow would be the target you would like the owner of the EmeraldComponent to follow.

EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldComponent.DetectionComponent.SetTargetToFollow(TransformToFollow);

Was this helpful?