Page 1 of 1

Sequences Question with TopDownEngine

Posted: Tue Jun 25, 2019 10:05 am
by MilziPPG
Hi Tony,

I'm back with another question about the TopDownEngine! So, I've got a piece of dialogue and I want the camera to pan over to the speaker.

The Zoom2D command doesn't seem to work for some reason. I put it in the first dialogue box so that when the player talks to the NPC, the camera should pan over to the NPC. The code currently reads

Code: Select all

Zoom2D(speaker,8,2)
In the start node, I've put NPC as the Actor and the Player as the Conversant (I read that somewhere in the forum that I should do that).

The only thing I can think is that it is the TopDownEngine's cameras that are the problem? Would I be correct in assuming that?

Thanks!

Re: Sequences Question with TopDownEngine

Posted: Tue Jun 25, 2019 10:44 am
by Tony Li
Hi,

You're correct. TDE uses Cinemachine, which keeps a tight grip on camera control. Instead of using Zoom2D, control Cinemachine. First import the Dialogue System's Third Party Support / Cinemachine Support unitypackage.

Cinemachine uses components called Cinemachine Virtual Cameras (vcams for short) that define how the camera should work (e.g., follow targets, zoom in on a location, etc.). Each vcam has a Priority value. Cinemachine uses the vcam that has the highest Priority. TDE's Koala Dungeon scene has a vcam named "CM vcam1" with a Priority of 10.

You can add another vcam to the scene that focuses on the NPC. Give it a Priority of 0 so Cinemachine doesn't use it during regular play. When the conversation starts, increase its Priority to something higher than 10.

There are two ways you can control a vcam's Priority in a conversation:

1. Add a Cinemachine Priority On Dialogue Event component to the NPC. Set the dropdown to OnConversation. Assign the vcam.

2. Or use the CinemachinePriority() sequencer command.

You can use both. For example, use Cinemachine Priority On Dialogue Event to prioritize a vcam that focuses on the NPC at the start of the conversation. Say the NPC points to a mysterious object that she wants the player to investigate. Use CinemachinePriority() to prioritize a different vcam that focuses on the mysterious object. Later, use another CinemachinePriority() to drop the priority of the mysterious object vcam. This will cause the NPC's vcam to take effect again.

Re: Sequences Question with TopDownEngine

Posted: Tue Jun 25, 2019 4:54 pm
by MilziPPG
Managed to get it half working! So, what happens is the dialogue starts, it then finishes, and then the camera moves over to the NPC and it stays like that. I have added the Cinemachine Camera Priority On Dialogue Event script to the NPC and set the On Start to 99 and On End to 0.

What I'd like to happen is have the camera move to the NPC, then play the dialogue, then the player has to press continue, and then the camera priority returns to normal.

I know I'm close, I can smell it!

Re: Sequences Question with TopDownEngine

Posted: Tue Jun 25, 2019 5:27 pm
by Tony Li
You're super close. Just one checkbox will do it. Take your pick:

1. Tick the MainCamera's Cinemachine Brain > Ignore Time Scale. This will allow Cinemachine to keep working even if a conversation pauses the game.

2. Or UNtick the Dialogue Manager's Pause Top Down During Conversations > Pause During Conversations. In this case, you may want to tick Disable Input During Conversations. This will keep the game active (e.g., enemies can still attack) during conversations.

Re: Sequences Question with TopDownEngine

Posted: Thu Jun 27, 2019 3:41 pm
by MilziPPG
Sorry Tony, haven't had much time to look at the project but once again, you are a legend! Works perfectly now

Thank you so much for all your help (again!)

Re: Sequences Question with TopDownEngine

Posted: Thu Jun 27, 2019 4:07 pm
by Tony Li
My pleasure!