Detection API

Set Target To Follow

Assigns a new target for an AI to follow. This will turn the AI into a Pet or Companion AI depending on its Behavior Type.

Note: The optional CopyFactionData parameter will copy the Target to Follow's Faction Data so it will react the same way the follower does to detected targets. This requires the Target to Follow to be another AI (if this condition is not met, this parameter will be ignored). This option is enabled by default.

EmeraldAPI.Detection.SetTargetToFollow(EmeraldSystem EmeraldComponent, Transform Target, bool CopyFactionData = true)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Detection.SetTargetToFollow(EmeraldComponent, PlayerTransform.transform.position, true);

Clear Target To Follow

Clears the AI's Target to Follow transform so it will be no longer be following it. This will also stop the AI from being a Companion or Pet AI.

EmeraldAPI.Detection.ClearTargetToFollow(EmeraldSystem EmeraldComponent, Transform Target)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Detection.ClearTargetToFollow(EmeraldComponent);

Check For Player Detection

Checks to see if the player is currently within the AI's detection radius by returning true or false (this can be true even if the player is an enemy).

EmeraldAPI.Detection.CheckForPlayerDetection(EmeraldSystem EmeraldComponent, Transform Target)
//Example - It is recomended that EmeraldComponent is cached somewhere
EmeraldSystem EmeraldComponent = GetComponent<EmeraldSystem>();
EmeraldAPI.Detection.CheckForPlayerDetection(EmeraldComponent);

Set Ignored Target

Adds the specified ignored target to the static EmeraldDetection IgnoredTargetsList. This will not allow the target to be detected by any AI.

EmeraldAPI.Detection.SetIgnoredTarget(Transform TargetTransform)
//Example
EmeraldAPI.Detection.SetIgnoredTarget(YourPlayerGameObject.transfrom);

Clear Ignored Target

Removes the specified ignored target from the static EmeraldDetection IgnoredTargetsList.

EmeraldAPI.Detection.ClearIgnoredTarget(Transform TargetTransform)
//Example
EmeraldAPI.Detection.ClearIgnoredTarget(YourPlayerGameObject.transfrom);

Clear All Ignored Targets

Clears all ignored targets from the static EmeraldDetection IgnoredTargetsList.

EmeraldAPI.Detection.ClearAllIgnoredTargets()
//Example
EmeraldAPI.Detection.ClearAllIgnoredTargets();

Last updated