Emerald AI 2.0

This page describes how to set up the Dialogue System with Emerald AI 2.0 by Black Horizon Studios. (Emerald AI 2.0 is required.)

Emerald AI copyright © Black Horizon Studios.


Emerald AI Setup

  1. Import the package Third Party Support/Emerald AI Support. This will unpack files into the folder Third Party Support/Emerald AI Support.
  2. Play the example scene in the Example subfolder to familiarize yourself with the integration.
    • The NPC gives you a quest to kill 3 skeletons. The skeletons' OnDeath events are configured to call DialogueSystemTrigger.OnUse to increment a kill counter.
    • The skeletons and spiders have Persistent Emerald AI Data components to remember their location and state. The player has a Persistent Position Data component to remember its position.
  3. To your own scene, add the Dialogue Manager prefab from the Prefabs folder.
  4. Add an Emerald AI Lua component to the Dialogue Manager.
  5. To remember AIs' states, add Persistent Emerald AI Data components to them.
  6. Use the Lua functions documented below.

Emerald AI Lua Functions

You can use the Lua functions below in your dialogue entry Scripts and Conditions (or anywhere you use Lua). Note the exact number and type of parameters required for each function.

Lua Function Description
DamageEmeraldAI("faction", amount, "targetType") Damages all AI of the specified faction. Damage comes from the type specified by targetType (Player, AI, or NonAITarget).
SetEmeraldBehavior("faction", "behavior") Sets the behavior (Aggressive, Cautious, Companion, Passive, or Pet) of all AI of the specified faction.
SetEmeraldDestination("faction", "destination") Sets the destination (name of a GameObject) of all AI of the specified faction.
EmeraldAIFollow("faction", "target", "followAs") Makes all AI of the specified faction follow a target (name of a GameObject) as either Companion or Pet.
EmeraldAIStay("faction") Makes all aI of the specified faction stop following.

Examples:

DamageEmeraldAI("Undead", 50, "Player")
SetEmeraldBehavior("Undead", "Aggressive")
SetEmeraldDestination("Spider", "Web")
EmeraldAIFollow("Dog", "Master", "Pet")
EmeraldAIStay("Dog")

<< Third Party Support