Page 1 of 1
How to change animation when audio ends?
Posted: Mon Oct 19, 2020 5:24 pm
by ludm
Hello,
Here is my setting:
I have a dialogue in which the NPC has audio recorded voice assigned with code in each node:
I have both conversation and idle animation for the NPC
I use the following default sequence:
Code: Select all
AnimatorPlay(Conversation,npc_body);
required AnimatorPlay(Idle,npc_body)@{{end}}
I know that end is based on the subtitle Chars Per Second setting.
Is there a solution to play the idle animaition when the audio file is ended ?
Re: How to change animation when audio ends?
Posted: Mon Oct 19, 2020 7:46 pm
by Tony Li
Hi,
Yes. Change your Sequence to:
Code: Select all
AnimatorPlay(Conversation,npc_body);
AudioWait(Audio/my-text)->Message(DoneTalking);
required AnimatorPlay(Idle,npc_body)@Message(DoneTalking)
BTW, if you have a lot of dialogue entries, you might want to look into
entrytags. (
Tutorial) Then you can set the Dialogue Manager's Default Sequence to:
Code: Select all
AnimatorPlay(Conversation,npc_body);
AudioWait(entrytag)->Message(DoneTalking);
required AnimatorPlay(Idle,npc_body)@Message(DoneTalking)
and leave your dialogue entries' Sequence fields blank.
Re: How to change animation when audio ends?
Posted: Tue Oct 20, 2020 9:39 pm
by ludm
Thank you that works great.
I have another question:
I have a toggle button for subtitle in the scene. Would it be possible to skip continue button when subtitle are hidden (go to the next audio automatically)?
Here is the code now:
Code: Select all
SetContinueMode(true);
AnimatorPlay(Conversation,girlbody);
AudioWait(Audio/e0)->Message(DoneTalking);
required AnimatorPlay(Idle,girlbody)@Message(DoneTalking)
Code: Select all
AnimatorPlay(Conversation,girlbody);
AudioWait(Audio/e1)->Message(DoneTalking);
required AnimatorPlay(Idle,girlbody)@Message(DoneTalking)
Re: How to change animation when audio ends?
Posted: Tue Oct 20, 2020 11:11 pm
by Tony Li
If you're talking about a toggle button that toggles whether subtitles are shown or not, configure this button to set the values of DialogueManager.displaySettings.subtitleSettings.showNPCSubtitlesDuringLine and showPCSubtitlesDuringLine.
If the corresponding value is false, then it won't show the subtitle or continue button, and it should skip right ahead, playing the node's Sequence without a subtitle.
Re: How to change animation when audio ends?
Posted: Wed Oct 21, 2020 11:40 am
by ludm
Thank you, it is nearly ok. The dialog continues, but at step #3 the animation plays Idle and not Conversation. The animation is Conversation again at step #4.
#1
Code: Select all
AnimatorPlay(Conversation,girlbody);
SALSA(Audio/e1);
#2
Code: Select all
SetContinueMode(true);
SALSA(Audio/e2)->Message(DoneTalking2);
required AnimatorPlay(Idle,girlbody)@Message(DoneTalking2)
;
#3
Code: Select all
AnimatorPlay(Conversation,girlbody);
SALSA(Audio/e3)->Message(DoneTalking3);
required AnimatorPlay(Idle,girlbody)@Message(DoneTalking3)
#4
Code: Select all
SetContinueMode(false);
AnimatorPlay(Conversation,girlbody);
SALSA(Audio/e4)->Message(DoneTalking4);
required AnimatorPlay(Idle,girlbody)@Message(DoneTalking4)
If I set 7 dialogues with a SetContinueMode(true) on the 1 st one, it will play Idlle on step #2 #4 and #7.
Re: How to change animation when audio ends?
Posted: Wed Oct 21, 2020 1:50 pm
by Tony Li
Hi,
Based on the sequences above, I don't see anything wrong. Would it be possible for you to send me a
reproduction project?