Deftly Support

This page describes how to set up the Dialogue System with Deftly by Cleverous. (Deftly is required.)

Deftly copyright © Cleverous.

Deftly Setup

  1. Import the package Third Party Support ► Deftly Support. This will unpack files into the folder Third Party Support ► Deftly Support.
  2. Play the example scene in the Example subfolder to familiarize yourself with the integration. The three NPCs each demonstrate something different:
    • Conversation (including checking and giving weapons) triggered by proximity selector.
    • Bark triggered by proximity selector.
    • Bark triggered when NPC is attacked.
  3. To your own scene, add the Dialogue Manager prefab from the Prefabs folder.
  4. Add a Deftly Lua Functions component to the Dialogue Manager.
    • Assign all weapon prefabs that can be given during conversations to the Weapon Database list.
  5. To Subjects that will engage in conversations – at least the player(s) – add a Deftly Dialogue Subject component.
    • If you want the game to be paused during conversations with this Subject, tick Pause Game During Conversations. Otherwise, if you want to keep the game running but temporarily make all Subjects peaceful, use the SetPeaceful() Lua function described in Deftly Lua Functions.
  6. Optional: To the player(s), add a Proximity Selector if you want to use it to interact with other objects in the scene.
  7. If you want a Subject to bark using Deftly's floating text system, add a Deftly Floating Text Bark UI component.
  8. If you want a Subject to react to events such as being attacked, add a Deftly Subject Unity Events component. For example, you can add an entry to the OnAttacked() event to invoke BarkTrigger.OnUse.
  9. To control Deftly values in the Dialogue System, use the Deftly Lua Functions described below.

Deftly 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.

GetLevel( subject:string )

Description: Returns a subject's level. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetLevel("")


GetXp( subject:string )

Description: Returns a subject's XP. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetXp("")


GiveXp( subject:string, amount:number )

Description: Gives XP to a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GiveXp("", 50)


GetHealth( subject:string )

Description: Returns a subject's health. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetHealth("")


AddHealth( subject:string, amount:number )

Description: Adds heatlh to a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: AddHealth("", 50)


RemoveHealth( subject:string, amount:number )

Description: Removes health from a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: RemoveHealth("", 50)


GetArmor( subject:string )

Description: Returns a subject's armor. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetArmor("")


AddArmor( subject:string, amount:number )

Description: Adds heatlh to a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: AddArmor("", 50)


RemoveArmor( subject:string, amount:number )

Description: Removes armor from a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: RemoveArmor("", 50)


GetStrength( subject:string )

Description: Returns a subject's strength. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetStrength("")


SetStrength( subject:string, amount:number )

Description: Sets a subject's strength. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: SetStrength("", 10)


GetAgility( subject:string )

Description: Returns a subject's agility. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetAgility("")


SetAgility( subject:string, amount:number )

Description: Sets a subject's agility. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: SetAgility("", 10)


GetDexterity( subject:string )

Description: Returns a subject's dexterity. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetDexterity("")


SetDexterity( subject:string, amount:number )

Description: Sets a subject's dexterity. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: SetDexterity("", 10)


GetEndurance( subject:string )

Description: Returns a subject's endurance. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetEndurance("")


SetEndurance( subject:string, amount:number )

Description: Sets a subject's endurance. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: SetEndurance("", 10)


GetKills( subject:string )

Description: Returns a subject's kill count. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetKills("")


GetDeaths( subject:string )

Description: Returns how many times a subject has died. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetDeaths("")


GetCoin( subject:string )

Description: Returns a subject's coin amount. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetCoin("")


AddCoin( subject:string, amount:number )

Description: Gives coin to a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: AddCoin("", 10)


RemoveCoin( subject:string, amount:number )

Description: Removes coin from a subject. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: RemoveCoin("", 10)


GetScore( subject:string )

Description: Returns a subject's score. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetScore("")


AddScore( subject:string, amount:number )

Description: Adds to a subject's score. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: AddScore("", 50)


GetGodMode( subject:string )

Description: Returns a subject's God Mode setting. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetGodMode("")


SetGodMode( subject:string, value:Boolean )

Description: Sets a subject's God Mode setting. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: SetGodMode("", true)


GetUnlimitedMags( subject:string )

Description: Returns a subject's Unlimited Mags setting. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GetUnlimitedMags("")


SetUnlimitedMags( subject:string, value:Boolean )

Description: Sets a subject's Unlimited Mags setting. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: SetUnlimitedMags("", true)


HasWeapon( subject:string, weapon:string )

Description: Returns true if the subject has a weapon whose Title (not GameObject name) matches the specified name. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: HasWeapon("", "Railgun")


AddWeapon( subject:string, weapon:string )

Description: Gives the subject a weapon whose Title (not GameObject name) matches the specified name. The weapon must be listed in the Deftly Lua Function component's Weapon Database list. If the subject string is blank, use the current conversation's actor; if no conversation is active, use the player.

Example: GiveWeapon("", "Melody Cannon")


<< Third Party Integration