Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
This is my Issue:
If my character goes running against the NPC and press the "Talking key" (In my case, F) the character will keep playing the Running animation. I tried using the solution shown in the Triggers and Interactions video, but it didn't work.
Plus, since I'm using shaders for 2D sprites, I have 2 animations for every state: Idle-right, Idle-left, Talking-right, Talking-Left, etc.
How can I get my character to play the idle/talking animations, plus considering the direction they're talking to?
Bonus Question: Everytime I start the game, the Writer Effect Audio plays twice and then stops for reasons unknown to me.... What could it be?
If my character goes running against the NPC and press the "Talking key" (In my case, F) the character will keep playing the Running animation. I tried using the solution shown in the Triggers and Interactions video, but it didn't work.
Plus, since I'm using shaders for 2D sprites, I have 2 animations for every state: Idle-right, Idle-left, Talking-right, Talking-Left, etc.
How can I get my character to play the idle/talking animations, plus considering the direction they're talking to?
Bonus Question: Everytime I start the game, the Writer Effect Audio plays twice and then stops for reasons unknown to me.... What could it be?
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Hi,
(Make sure the spelling and capitalization exactly matches your animator states.)
This will make the characters play Talking-right as soon their line starts. After a duration based on the text length, they will play the Idle-right animation.
If only your player has these animations, you can set Default Player Sequence instead.
If you have questions about sequences, watch at least part 1 of the Cutscene Sequence Tutorials. Parts 2 & 3 are useful, too. You can probably skip the rest for now.
---
Once you have that working, here's a discussion about playing animations with directions:
Personally, I think it might be easier to let the Animator know which animations to play. Let's say you have an animator parameter named "Left". When the character is facing left, the parameter is true. When the character is facing right, the parameter is false. Then you can add trigger parameters named Idle and Talk. If Talk is triggered and Left is true, transition to Idle-Left. If Talk is triggered and Left is false, transition to Idle-Right. This way, as long as you've been setting the Left parameter when the character turns left or right, you can just set the Talk trigger to make the character talk in the appropriate direction. Then set the Default Sequence to:
The Dialogue System doesn't need to know anything about left/right direction in this case.
If you don't want to do that, and if you want to make the Dialogue System handle it, you can define and set a Dialogue System variable to the player's current direction. In C# script, you can do something like this:
In this case, I'll assume that you're keeping the Dialogue System variable "Dir" up to date as the player turns left & right.
Then set the Default Player Sequence to:
The solution is going to be specific to your character. Identify what makes the Running animation play.
- If it's a script, you will need to use Dialogue System Events to disable the script during conversations.
- If it's an animator parameter such as Speed, you may be able to use Dialogue System Events by assigning the Animator to the event.
- If not, you can use a Dialogue System Trigger set to On Conversation Start. Select Add Action > Play Sequence. Then use one of the Animator***() sequencer commands in the Sequence field to set the parameter to a value that makes the Running animation stop.
I recommend tackling it in two steps. In the first step, get the character talking regardless of direction. Try setting the Dialogue Manager's Camera & Cutscene Settings > Default Sequence to:
Code: Select all
AnimatorPlay(Talking-right);
required AnimatorPlay(Idle-right)@{{end}}
This will make the characters play Talking-right as soon their line starts. After a duration based on the text length, they will play the Idle-right animation.
If only your player has these animations, you can set Default Player Sequence instead.
If you have questions about sequences, watch at least part 1 of the Cutscene Sequence Tutorials. Parts 2 & 3 are useful, too. You can probably skip the rest for now.
---
Once you have that working, here's a discussion about playing animations with directions:
Personally, I think it might be easier to let the Animator know which animations to play. Let's say you have an animator parameter named "Left". When the character is facing left, the parameter is true. When the character is facing right, the parameter is false. Then you can add trigger parameters named Idle and Talk. If Talk is triggered and Left is true, transition to Idle-Left. If Talk is triggered and Left is false, transition to Idle-Right. This way, as long as you've been setting the Left parameter when the character turns left or right, you can just set the Talk trigger to make the character talk in the appropriate direction. Then set the Default Sequence to:
Code: Select all
AnimatorTrigger(Talk);
required AnimatorTrigger(Idle)@{{end}}
If you don't want to do that, and if you want to make the Dialogue System handle it, you can define and set a Dialogue System variable to the player's current direction. In C# script, you can do something like this:
Code: Select all
PixelCrushers.DialogueSystem.DialogueLua.SetVariable("Dir", "left"); // Player is facing left.
Then set the Default Player Sequence to:
Code: Select all
AnimatorPlay(Talking-[var=Dir]);
required AnimatorPlay(Idle-[var=Dir])@{{end}}
You're talking about the typewriter effect on your subtitle panels' text elements, right? If so, inspect the Audio Source component on the same GameObject and untick Play On Awake. If the GameObject doesn't have an Audio Source component, add one and untick Play On Awake.
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Toni thank you so much for your time and reply.
One problem I had was that I have an "Animation-States" script in charge of organizing and setting the parameters in the animator for the states, and THAT didnt let me change the parameters. Not even manually.
Using the Dialogue System Events I can disable the "Animation-States" script and enable it back when the conversation is over.
Plus with the Dialogue System Trigger I can set the parameters BUT it doesn't let me differentiate between when the character is speaking a dialogue line (talking animation) and when the character is just in the conversation listening. (idle)
How can I set the parameters using the Dialogue System Events => Conversation Events? I can't seem to find the option to Set the floats, int and bools parameters. If I can do that, I can easily set the animation I want in the correct direction.
One last question: Since I'm going to use bubbles for conversations, Is there a way to make sure a Dialogue Line appears over the head of a specific character? In my case besides giving the player the chance to choose the answer I want it to appear over the head of the character like he's talking (Animation and everything)
This is what I have so far. It's a situation similar to the Robot and Boxes from the Trigger and Interaction tutorial video:
Again, thank you so much for your time and ideas. I'll be checking the Cutscenes Sequence Tutorials. I tried to study them but I got confused to be honest, but I really want to master it since I'm tryign to make a story driven game.
THANKS!!!!!!!
THIS! This would solve everything.If it's an animator parameter such as Speed, you may be able to use Dialogue System Events by assigning the Animator to the event.
One problem I had was that I have an "Animation-States" script in charge of organizing and setting the parameters in the animator for the states, and THAT didnt let me change the parameters. Not even manually.
Using the Dialogue System Events I can disable the "Animation-States" script and enable it back when the conversation is over.
Plus with the Dialogue System Trigger I can set the parameters BUT it doesn't let me differentiate between when the character is speaking a dialogue line (talking animation) and when the character is just in the conversation listening. (idle)
How can I set the parameters using the Dialogue System Events => Conversation Events? I can't seem to find the option to Set the floats, int and bools parameters. If I can do that, I can easily set the animation I want in the correct direction.
One last question: Since I'm going to use bubbles for conversations, Is there a way to make sure a Dialogue Line appears over the head of a specific character? In my case besides giving the player the chance to choose the answer I want it to appear over the head of the character like he's talking (Animation and everything)
This is what I have so far. It's a situation similar to the Robot and Boxes from the Trigger and Interaction tutorial video:
Again, thank you so much for your time and ideas. I'll be checking the Cutscenes Sequence Tutorials. I tried to study them but I got confused to be honest, but I really want to master it since I'm tryign to make a story driven game.
THANKS!!!!!!!
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Hi,
While you can assign an Animator component to a UnityEvent such as the Dialogue System Events component's OnConversationStart(), the Animator component doesn't expose a method to set float parameters. It only lets you control trigger parameters.
Fortunately, you can use sequencer commands to set float parameters, saving you from having to do any scripting. If I can clarify anything with sequencer commands, please let me know.
(p.s. - Nice art style! )
You'll need to use a Dialogue System Trigger with an AnimatorFloat() sequencer command like at the very bottom of the Interaction Tutorial:
While you can assign an Animator component to a UnityEvent such as the Dialogue System Events component's OnConversationStart(), the Animator component doesn't expose a method to set float parameters. It only lets you control trigger parameters.
Fortunately, you can use sequencer commands to set float parameters, saving you from having to do any scripting. If I can clarify anything with sequencer commands, please let me know.
Just like with FatRat, add a Dialogue Actor component to the player. Assign a bubble subtitle panel and bubble menu panel. If you haven't already, take a look at the BubbleSubtitleExample scene (direct download) available on the Dialogue System Extras page. The panels don't actually have to look like bubbles. You can get rid of the bubble image and change the text to a chunky pixel font if you want more of a Monkey Island look. Come to think of it, if you want the Monkey Island look, only assign a bubble subtitle panel to the player; leave the menu panel setting at Default so the menu appears at the bottom of the screen.
(p.s. - Nice art style! )
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Hi Toni! Thanks for your time
This is the result of your last help:
BUT, even though when I add the commands they actually work like I want (for example if I want to set the "talking" parameter to "True" I use AnimatorBool(talking, true) and it DOES change) when I test the dialogue it always skips the lines that have Commands in them.
Even if the command works perfectly, the dialogue line are skipped to the next one that as no Sequence command in them.
This is what I have so far:
This is the result of your last help:
I learnt how to use sequence commands in the conversation by adding them into the sequence areaYou'll need to use a Dialogue System Trigger with an AnimatorFloat() sequencer command like at the very bottom of the Interaction Tutorial:
BUT, even though when I add the commands they actually work like I want (for example if I want to set the "talking" parameter to "True" I use AnimatorBool(talking, true) and it DOES change) when I test the dialogue it always skips the lines that have Commands in them.
Even if the command works perfectly, the dialogue line are skipped to the next one that as no Sequence command in them.
Thanks! I appreciate it C:(p.s. - Nice art style! )
This is what I have so far:
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Continuation...
Heres a video of said issue:
Heres a video of said issue:
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Hi,
Set the Sequence to:
Each line lasts for the duration of its Sequence.
If the Sequence field is blank, it uses the Dialogue Manager's Default Sequence, which is initially:
This makes the sequence delay for a duration based on the length of the text.
The AnimatorBool() sequencer command takes no time to run. When your Sequence is only this:
then it runs and finishes immediately, so it proceeds to the next line immediately.
By adding AnimatorBool(talking, false)@{{end}}, the Sequence waits for a duration based on the text length. Then it sets the talking parameter false.
Set the Sequence to:
Code: Select all
AnimatorBool(talking, true);
AnimatorBool(talking, false)@{{end}}
If the Sequence field is blank, it uses the Dialogue Manager's Default Sequence, which is initially:
Code: Select all
Delay({{end}})
The AnimatorBool() sequencer command takes no time to run. When your Sequence is only this:
Code: Select all
AnimatorBool(talking, true)
By adding AnimatorBool(talking, false)@{{end}}, the Sequence waits for a duration based on the text length. Then it sets the talking parameter false.
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Got it !!! And solved!! I thought the system skipped the wrongly written sequences and I had some syntax error.
Thanks for your time, Toni.
I'll try to keep the posting to the minimum to not abuse your time.
THANKS!
Thanks for your time, Toni.
I'll try to keep the posting to the minimum to not abuse your time.
THANKS!
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
I'm here to help, so feel free to post whenever you have a question!
Re: Can I play the "Idle" and "Talking" animation using Dialogue System Events Component?
Does above code works even with Fast Forward Script? I've noticed that when I skip dialogues the animator parameter continues to play. I don't know if it's something on my end or it's a bug.