Opsive Character Controllers Support
ucc.jpg

This page describes how to set up the Dialogue System with Opsive's character controllers. (An Opsive character controller asset is required.)

Opsive character controllers copyright © Opsive.

Overview

This integration for Opsive's Character Controllers:

  • Gives you the ability to control characters and the camera during conversations.
  • Allows you to check and change characters' attributes and inventory in conversations.
  • Saves characters' states in saved games and across scene changes.

It works for these Opsive controllers:

Setup

Enable Integration

To enable Dialogue System integration, select menu item Tools → Opsive → (Controller) → Integrations Manager. Scroll down to Dialogue System for Unity, and click Enable.

Set Up Characters

  1. Add a Dialogue Manager GameObject by adding the prefab in Plugins ► Pixel Crushers ► Dialogue System ► Prefabs.
  2. Inspect your character's Ultimate Character Locomotion component. Add a Converse ability:
    uccConverse.png
    • Leave the Start Type and Stop Type set to Manual. The Dialogue System will manually activate this ability when the character is involved in a conversation.
    • Tick Hide UI if you want to hide the player HUD during conversations with the character.
    • Tick Disable Gameplay Input if you want to disable player input during conversations.
    • Tick Detach Camera if you want to control the camera using sequencer commands.
    • Untick Allow Positional Input and Allow Rotation Input to prevent characters from moving during conversations.
    • Untick Allow Equipped Slots → Slot 0 and Slot 1 to make the character holster its equipment during conversations.
  3. Inspect your character's Unity Input component if present. Add a Conversing state:
    uccUnityInput.png
    This state activates while the Converse ability is active. It makes the mouse cursor visible. You can change the state's behavior by inspecting its properties.
  4. If you want to save this character's position, attributes, and inventory in saved games and across scene changes, add a UCC Saver component:
    uccSaver.png

Set Up Interaction

  1. Add a Dialogue System Trigger Interactable Target component to the interactable object (e.g., NPC). Leave the Trigger dropdown set to On Use. Configure the rest of the component as normal for a Dialogue System Trigger.
    uccInteractableTrigger.png
  2. Add an Interactable component, and assign the Dialogue System Trigger Interactable Target to it.

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. To enable these Lua functions, add a UCC Lua component to your Dialogue Manager.

If you're creating a multiplayer game, you can also use the Dialogue System's Lua Networking Functions to synchronize variables and quest states across all clients.

uccGetAttribute( characterName:string, attributeName:string )

  • Returns the value of an attribute on a character. If characterName is blank, it will use the character tagged 'Player'.
  • Example: Variable["Health"] = uccGetAttribute("", "Health")

uccSetAttribute( characterName:string, attributeName:string, value:number )

  • Sets the value of an attribute on a character. If characterName is blank, it will use the character tagged 'Player'.
  • Example: uccSetAttribute("", "Health", 100)

uccGetItemCount( characterName:string, itemName:string )

  • Returns the amount of an item or ammo contained in a character's inventory. If characterName is blank, it will use the character tagged 'Player'.
  • Example: Variable["NumApples"] = uccGetItemCount("", "Apple")

uccAddItem( characterName:string, itemName:string, amount:number )

  • Adds an amount of items or ammo to a character's inventory. If characterName is blank, it will use the character tagged 'Player'.
  • Example: uccAddItem("", "AssaultRifle", 1)

uccRemoveItem( characterName:string, itemName:string, amount:number )

  • Removes an amount of items from a character's inventory. If characterName is blank, it will use the character tagged 'Player'. Note: You can only remove items with this function, not ammo.
  • Example: uccRemoveItem("", "AssaultRifle", 1)

<< Third Party Integration