Unique animation based on conversation actor

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
darkdollgames
Posts: 6
Joined: Fri Sep 20, 2024 9:57 pm

Unique animation based on conversation actor

Post by darkdollgames »

I'm currently using the Dialogue System Events component to set an animation trigger in the OnConversationStart event, which works fine. But if I wanted to set a different anim trigger based on certain NPCs, is there an easy way to do that or do I need to create a script to determine which NPC the player is talking to and set the trigger accordingly?
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unique animation based on conversation actor

Post by Tony Li »

A script would be the most succinct solution. Add a script with an OnConversationStart(Transform) method to the actor's GameObject. (See Character GameObject Assignments.) Check that the transform passed to the method is this actor.

Alternatively, if you don't want to do any scripting, add a Dialogue System Trigger that's set to OnConversationStart. In the Conditions > Lua Conditions section, check that Variable["ConversantIndex"] is the Name of the actor, with certain characters "sanitized" as described here. Then select Add Action > Play Sequence to start an animation using sequencer command(s), or Add Action > OnExecute() UnityEvent to generally set up any actions in the inspector, such as assigning the actor's Animator component and selecting a method.
Post Reply