Forum rules - please read before posting.

Get character to speak every 5s if condition is met

Morning everyone,

I would like to have some text pop up close to a door in my scene every, say, 5s when a condition is met. This should stop when the condition is not met.

What I've done is the following. I've created an NPC character which is out of sight behind the door and I've attached an AnimatorController with two states to represent whether the condition is met. I can see the Animator's states working fine and transitioning when running the game. I've then added an ActionList component to the NPC character with Dialogue/Play speech + Wait components in a loop. Finally, I've tried adding Animations which enable/disable the ActionList based on the state, but nothing happens.

Any help appreciated!
Peri

Comments

  • Enabling an ActionList component through animation won't trigger it - it's enabled by default.

    To run an ActionList when the scene begins, attach the ActionList Starter component and check Run on scene start?.

    What is the condition that is to be met? This is best represented by an AC Variable.

    If you attach a Variables component to the same object, you can define within it e.g. a Bool variable to represent the condition (i.e. when True, the character should speak, when False, they should stop).

    You'd then be able to update your ActionList by preceding the above Actions with a Variable: Check Action to determine this bool variable's value, and only run the loop if True.

  • Thanks Chris, that worked!

    If I may, I have a follow up question: is there a way to have NPCs subtitles appear on top of them but subtitles coming from examining/using hotspots appear on top of the hotspots (i.e. at cursor and freeze)?

    I've tried creating a new menu so that I could route NPC speech through the "on top of character" menu, and user interactions through the new "cursor and freeze" menu, but I cannot find any info on how to do that.

    Thanks again!

  • You can create two Subtitles menus, one that displays character speech, and another that displays narration (i.e. speech with no character) by duplicating the original menu and configuring their For speakers of type properties.

    For the menu that's configured to display only narration, you should then be able to set its Position type to Appear At Cursor Then Freeze to have lines that it displays appear by the cursor.

  • That makes a lot of sense, many thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.