Change Sprite after specific conversation
Change Sprite after specific conversation
I am using the Set Component Enabled and Set Animator State on Dialogue to change my character controller's sprite, however I wish to have it restricted to only one conversation, as right now the sprite changes when any conversation is started. Is there a way to do this, or a better way to do this? I attempted using a second dialogue database but that was not working, and also attempted to use the sequencer but could not make it work. I can also post images and code if needed, thank you to anyone who can help!
Re: Change Sprite after specific conversation
Let's see if we can get the sequencer working for that conversation.
As an example, let's say your player GameObject is named "Player". It has a component named Glow that you want to enable. In a dialogue entry node's Sequence field, use the SetEnabled() sequencer command:
Let's also say that the player's animator has a state named Berserk. Use the AnimatorPlay() sequencer command to change the animator to this state:
You'll probably also want to play whatever the default sequence is, which typically delays the line to give the player time to read it. So the final Sequence field might be:
As an example, let's say your player GameObject is named "Player". It has a component named Glow that you want to enable. In a dialogue entry node's Sequence field, use the SetEnabled() sequencer command:
Code: Select all
SetEnabled(Glow, true, Player)
Code: Select all
AnimatorPlay(Berserk, Player)
Code: Select all
SetEnabled(Glow, true, Player);
AnimatorPlay(Berserk, Player);
{{default}}
Re: Change Sprite after specific conversation
Thank you for your reply! I added in the command within the sequence area with the correct names for my project, and it does not change anything. Is there something else I would need to do?
Re: Change Sprite after specific conversation
Let's figure out why it's not working. Please temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. Then play through that dialogue entry node.
Each command -- such as SetEnabled(Glow, true, Player)-- will have two lines in the Console window. The first shows the lines as the Dialogue System understands it. The second shows when the Dialogue System is actually running the command. Please paste both lines into a reply.
Each command -- such as SetEnabled(Glow, true, Player)-- will have two lines in the Console window. The first shows the lines as the Dialogue System understands it. The second shows when the Dialogue System is actually running the command. Please paste both lines into a reply.
Re: Change Sprite after specific conversation
Change this:
AnimatorPlay(Idle, Character)
to this:
AnimatorPlay(Idle, speaker)
The warning means the Dialogue System can't find a GameObject named "Character". The special keyword "speaker" tells the Dialogue System to use the current speaker's GameObject; it doesn't matter what it's named in this case.
BTW, it looks like your GameObject may have a blank space at the end of its name, such as "Character " instead of "Character". This might be why the Dialogue System can't find it.
AnimatorPlay(Idle, Character)
to this:
AnimatorPlay(Idle, speaker)
The warning means the Dialogue System can't find a GameObject named "Character". The special keyword "speaker" tells the Dialogue System to use the current speaker's GameObject; it doesn't matter what it's named in this case.
BTW, it looks like your GameObject may have a blank space at the end of its name, such as "Character " instead of "Character". This might be why the Dialogue System can't find it.
Re: Change Sprite after specific conversation
That was it! Thank you so much!
Re: Change Sprite after specific conversation
Glad to help!