Page 1 of 1

Send Event to Enable/Disable NPC

Posted: Mon May 21, 2018 1:41 pm
by Alatriste
Another day, another question... :P

I'm trying to enable/disable an NPC in my background and I wonder if there is an easy way to do it with events instead of using Playmaker, which can make the process much more tedious.

Basically what I try to achieve is that the player can see the NPC in the background, but during a moment of the conversation I will send an event to disable it, as now I'll be using a big portrait and I don't want to have both assets visible at the same time in the screen.

If the NPC was disabled from the start of the conversation there wouldn't be a problem, but what I need is to enable/disable it during some stages of the conversation. I was thinking that attaching some script to the NPC would make the trick, but not sure if this is even possible.

Thanks!

Re: Send Event to Enable/Disable NPC

Posted: Mon May 21, 2018 3:12 pm
by Tony Li
You can use the SetActive() sequencer command:
  • Dialogue Text: "Hello, I'm Fred."
  • Sequence: {{default}}; SetActive(Fred,false)
(The {{default}} means the node should also do its regular sequence in addition to deactivating the GameObject named "Fred".)

Re: Send Event to Enable/Disable NPC

Posted: Tue May 22, 2018 3:56 am
by Alatriste
Thanks Tony! I knew that there had to be a simple way to do it. I'll try it as soon as I get home. :)