Spawn/display an object during a conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Spawn/display an object during a conversation

Post by hrohibil »

Hello


During a conversation, when a player for instead gets handed something over from NPC, I want to trigger either image or particlefx. The camera is at default closeup, so i need to have whatever i spawn particles or or objects to be in front of camera.

More specifically when a word is being typed in the conversation I would like something to appear..
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawn/display an object during a conversation

Post by Tony Li »

Hi,

You could set up a particle effect in front of the NPC and set its GameObject inactive. On the dialogue entry node where the NPCs gives the item to the player, use the SetActive() sequencer command to activate the GameObject. Example:

Code: Select all

{{default}}; SetActive(MyParticleFX)
It's complicated to make it appear at a certain word in the text. But it's easier to make it appear at a certain time -- for example, 1.5 seconds into the subtitle:

Code: Select all

{{default}}; SetActive(MyParticleFX)@1.5
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Re: Spawn/display an object during a conversation

Post by hrohibil »

Thanks Tony.

It works awesome...

SIDENOTE:

I have this camera view on my NPC conversations

Code: Select all

Camera(Closeup, speaker,1);
Its a bit to close as the NPC animation moves his head toward camera and then it clips the view. I would like it to go slightly bit back.. Is that possible with the closeup command?
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawn/display an object during a conversation

Post by Tony Li »

If you only want to adjust it for this one NPC, add a uniquely-named GameObject as a child of the NPC, such as "Wizzard Camera Angle". Position and rotate it exactly where you want the camera to be. Then use its GameObject name:

Code: Select all

Camera(Wizzard Camera Angle, , 1)
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Re: Spawn/display an object during a conversation

Post by hrohibil »

Thank you that helped.

BTW When i using a static object in this code

Code: Select all

{{default}}; SetActive(MyParticleFX)@1.5
it works but when i use a particle fx it freezes due to i have checked of Pause game during conversation. And it does not have an animator i can set the unscale time to.

Aby suggestions?
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawn/display an object during a conversation

Post by Tony Li »

Set the Particle System's Delta Time > Unscaled.
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Re: Spawn/display an object during a conversation

Post by hrohibil »

Wow did not see that one.
Thank you Tony 👍
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawn/display an object during a conversation

Post by Tony Li »

Glad to help!
Post Reply