Scene Event works only once
Scene Event works only once
Hello,
I was trying to change the animation while character in conversation. (Idle -> Talk)
My character has two state, idle (base layer) and talk (overlap layer). New State is empty state. I set a transition "New State -> Talk" to "Talk" trigger.
Then, I added "SetTrigger" event to dialogue's Scene Event. This first dialogue runs the command, that's ok.
But in the next dialogue state, I want to Character A return Idle animation while Character B is starting to Talk animation.
I added Scene Event again, but it doesn't work in the game. Is it one time-only event?
If it is, how should I change the animations while they are in conversation?
Thanks in advance!
I was trying to change the animation while character in conversation. (Idle -> Talk)
My character has two state, idle (base layer) and talk (overlap layer). New State is empty state. I set a transition "New State -> Talk" to "Talk" trigger.
Then, I added "SetTrigger" event to dialogue's Scene Event. This first dialogue runs the command, that's ok.
But in the next dialogue state, I want to Character A return Idle animation while Character B is starting to Talk animation.
I added Scene Event again, but it doesn't work in the game. Is it one time-only event?
If it is, how should I change the animations while they are in conversation?
Thanks in advance!
Re: Scene Event works only once
Hi,
Scene events execute every time the node is used in a conversation, not just once.
However, for animator control, I recommend using the AnimatorTrigger() sequencer command instead of scene events. If you're using triggers, you'll also want to use another trigger to return to Idle. Resetting the Talk trigger won't return the animator to Idle. Example Sequence field value:
The first line in the Sequence sets the Talk trigger on the speaker.
The second line waits until the typewriter effect has finished. Then it sets a trigger named Idle.
Scene events execute every time the node is used in a conversation, not just once.
However, for animator control, I recommend using the AnimatorTrigger() sequencer command instead of scene events. If you're using triggers, you'll also want to use another trigger to return to Idle. Resetting the Talk trigger won't return the animator to Idle. Example Sequence field value:
Code: Select all
AnimatorTrigger(Talk);
required AnimatorTrigger(Idle)@Message(Typed)
The second line waits until the typewriter effect has finished. Then it sets a trigger named Idle.
Re: Scene Event works only once
Hi, thanks your the help. I added your code to Sequencer and deleted scene events but there's a little problem.
Sequencer does not work as intended. Character A plays talk animation in the beginning and never stops even the conversation order goes to Characer B.
Sequencer does not work as intended. Character A plays talk animation in the beginning and never stops even the conversation order goes to Characer B.
Re: Scene Event works only once
Are there any errors or warnings in the Console window?
In my previous reply, notice the second line in the Sequence. It's an example of how to change the speaker's animator back to the "Idle" animation. Your actual command may be different, depending on how you've set up your animator controller.
In my previous reply, notice the second line in the Sequence. It's an example of how to change the speaker's animator back to the "Idle" animation. Your actual command may be different, depending on how you've set up your animator controller.
Re: Scene Event works only once
Another note:
If you're not using the typewriter effect, you can modify the sequence. Example:
I included the {{default}} keyword to tell the sequence to include the Dialogue Manager's Default Sequence.
If you're not using the typewriter effect, you can modify the sequence. Example:
Code: Select all
AnimatorTrigger(Idle, listener);
AnimatorTrigger(Talk, speaker);
{{default}}
Re: Scene Event works only once
Hi,
There was an error "Animator not found" at start, then I drag character game objects to Dialogue System Trigger's Conversation Actor and Conversant, the error has gone. There is no error right now.
Here's the animator setup: Trigger names are same as in your code.
I tested triggers manually while game is running on editor, they works fine.
I don't understand why triggers don't work on conversation.
There was an error "Animator not found" at start, then I drag character game objects to Dialogue System Trigger's Conversation Actor and Conversant, the error has gone. There is no error right now.
Here's the animator setup: Trigger names are same as in your code.
I tested triggers manually while game is running on editor, they works fine.
I don't understand why triggers don't work on conversation.
Re: Scene Event works only once
I'm using typewriter effect but I give it a try.Tony Li wrote: ↑Sun Sep 19, 2021 11:48 am Another note:
If you're not using the typewriter effect, you can modify the sequence. Example:
I included the {{default}} keyword to tell the sequence to include the Dialogue Manager's Default Sequence.Code: Select all
AnimatorTrigger(Idle, listener); AnimatorTrigger(Talk, speaker); {{default}}
I pasted same code to Character A.
And this code to Character B:
Code: Select all
AnimatorTrigger(Talk, listener);
AnimatorTrigger(Idle, speaker);
{{default}}
Result:
Character A is playing Talk animation (never stops), Character B does nothing
Re: Scene Event works only once
The speaker should always talk. The listener should always stop talking. Use this in all sequences:
(One way to use it in all sequences is to add it to the Dialogue Manager's Default Sequence, and leave the nodes' Sequence fields blank.)
The speaker is the dialogue entry node's Actor, which is not necessarily the conversation's Actor. The conversation's Actor stays the same throughout the conversation, but the dialogue entry node's Actor may change with each node.
Also, please see: Character GameObject Assignments.
Code: Select all
AnimatorTrigger(Idle, listener);
AnimatorTrigger(Talk, speaker);
The speaker is the dialogue entry node's Actor, which is not necessarily the conversation's Actor. The conversation's Actor stays the same throughout the conversation, but the dialogue entry node's Actor may change with each node.
Also, please see: Character GameObject Assignments.
Re: Scene Event works only once
Hi, I solved the problem, thank you!