Emerald AI 2024 Support

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

Emerald AI copyright © Black Horizon Studios.
\htmlonly

Emerald AI Setup

This package works with Emerald AI 2024.

  1. Import the packages in these folders:
    • Plugins ► Pixel Crushers ► Common ► Third Party Support ► Emerald 2024 Support and
    • Plugins ► Pixel Crushers ► Dialogue System ► Third Party Support ► Emerald 2024 Support
  2. This will unpack files into these folders:
    • Pixel Crushers ► Common ► Third Party Support ► Emerald 2024 Support and
    • Pixel Crushers ► Dialogue System ► Third Party Support ► Emerald 2024 Support.
  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 and positions, add Emerald AI Saver 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.

In the '...' Lua wizard dropdowns, these functions are available in Custom > Emerald.

Lua Function Description
GetEmeraldAIHealth("ai") Returns the current health of an AI specified by GameObject name.
DamageEmeraldAI("ai", amount, "targetType") Damages an AI. Damage comes from the type specified by targetType (Player, AI, or NonAITarget).
EmeraldAIEmote("ai", soundID, animationID) Plays a sound effect ID and/or animation ID. Pass -1 as the ID if you don't want to play either one.
EmeraldAIFollow("ai", "target") Makes an AI follow a target (name of a GameObject).
EmeraldAIStay("ai") Makes an AI stop following.
GetEmeraldPlayerRelation("ai") Returns the AI's faction relation to the player ("Player" faction).
GetEmeraldFactionRelation("ai", "targetFaction") Returns the AI's faction relation to a target faction.
SetEmeraldPlayerRelation("ai", "relation") Sets the AI's relation to the player to "Enemy", "Neutral", or "Friendly".
SetEmeraldFactionRelation("ai", "targetFaction", "relation") Sets the AI's relation to targetFaction to "Enemy", "Neutral", or "Friendly".
SetEmeraldFaction("ai", "newFaction") Changes an AI's faction.
SetEmeraldBehavior("ai", "behavior") Sets an AI's behavior (Aggressive, Cautious, Passive).
SetEmeraldDestination("ai", "destination") Sets an AI's movement destination (name of a GameObject).
SetEmeraldItem("ai", itemID, enable) Sets an item enabled or disabled. To disable all items, pass -1 for itemID and false for enable.
SetEmeraldWeapon("ai", "type", enable) Enables or disables an AI's weapon. For "type", you must specify "Weapon Type 1" or "Weapon Type 2".
SetEmeraldWander("ai", "wander") Sets an AI's wander type (Destination, Dynamic, Stationary, Waypoints).

Examples:

DamageEmeraldAI("Skeleton", 50, "Player")
SetEmeraldBehavior("Skeleton", "Aggressive")
SetEmeraldWeapon("Skeleton", "Melee", true)
SetEmeraldDestination("Spider", "Web")
SetEmeraldFactionRelation("Skeleton", "Player", "Enemy")
EmeraldAIFollow("Dog", "Player")
EmeraldAIStay("Dog")
Definition Player_DialogueSystem.cs:13

<< Third Party Integration