revealing objects during dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

revealing objects during dialogue

Post by annathehank »

Hello!

I'm trying to figure out how I can have an object be revealed during a piece of dialogue. Essentially, the NPC asks the player what they see, and when they pick a response, I want the object to appear in the scene.

I tried setting an animation that would change the Z position of the object from 1 to 0 so it's popping into view (it's a 2-D game). However, this just flashes the object on the screen and then removes it again.

I know there's some kind of code to put in a script that would permanently change the Z position, but can you call forth a script action with the sequencer?
User avatar
Tony Li
Posts: 22165
Joined: Thu Jul 18, 2013 1:27 pm

Re: revealing objects during dialogue

Post by Tony Li »

Hi,

You can use the MoveTo() sequencer command. Create an empty GameObject in the position where you want the object to appear. For example, say the object is a Grimoire, the location where you want it to appear is a Tabletop, and you want it to move there over 2 seconds. Then use:

Code: Select all

MoveTo(Tabletop, Grimoire, 2)
If you want the Grimoire to teleport immediately to the position of Tabletop, omit the last parameter:

Code: Select all

MoveTo(Tabletop, Grimoire)
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: revealing objects during dialogue

Post by annathehank »

Oh my gosh that is such a simple way to do it wow! Thank you so much! It's been a little tricky getting the hang of the sequences and cutscene stuff but I love them they are so useful!!!
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: revealing objects during dialogue

Post by annathehank »

As a follow up, will that command work with the dialogue UI?

I'd like to hide the NPC portrait during these kinds of moments, but still have the conversation and dialogue run. Or should that be done through some kind of variable such as switching the profile portraits? Like, should I give each NPC a transparent image for a sprite and swap it to that?
User avatar
Tony Li
Posts: 22165
Joined: Thu Jul 18, 2013 1:27 pm

Re: revealing objects during dialogue

Post by Tony Li »

Hi,

Use the SetDialoguePanel() command for that.
Post Reply