Set Active on Dialogue Event

Announcements, support questions, and discussion for the Dialogue System.
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

I did briefly have this working and was feeling all proud...







So I needed to have stuff activated during a conversation so I split the conversation up so that I could make the gameobject I want active at the right time and also just activate the next half of the conversation, And now it's not working.



I have something happening at conversation start and something happening at conversation end and neither is occuring any more.



The conversation starts as it should be the object I want to appear at the same time doesn't appear and the conversation I want to make active at the end doesn't start.



What have I messed up?



As an aside is there a way to send a set active message from the script box within the database rather than from an explicit component?
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

Could it be anything to do with a problem with the NPC wizard?



When I run it now, when I click on "NPC has interactive conversation" the component is added to the gameobject, but the tickbox stays empty. If I click it again, another component is added.
User avatar
Tony Li
Posts: 21048
Joined: Thu Jul 18, 2013 1:27 pm

Set Active on Dialogue Event

Post by Tony Li »

3216 wrote: The conversation starts as it should be the object I want to appear at the same time doesn’t appear and the conversation I want to make active at the end doesn’t start.


If you set the Dialogue Manager's Debug Level to Info, it will log a line "Starting Conversation..." including the participants. Make sure the Set Active On Dialogue Event component is on one of the participants or the Dialogue Manager GameObject. (Or see below.)



3216 wrote: When I run it now, when I click on “NPC has interactive conversation” the component is added to the gameobject, but the tickbox stays empty. If I click it again, another component is added.


Sounds like the wizard isn't finding the Conversation Trigger on the NPC. Is it maybe pointing to the wrong GameObject? Feel free to post a screenshot of the editor. You might just manually make sure that the NPC has Conversation Trigger and Set Enabled On Dialogue Event components.



3216 wrote: As an aside is there a way to send a set active message from the script box within the database rather than from an explicit component?


Use the Sequence field and the SetActive() sequencer command. If you always want to activate/deactivate a GameObject when a specific conversation starts, put the sequencer command in the START node's Sequence field. This command and SetEnabled() are useful because you can control GameObjects and components at any point in a conversation, not just the start and end, and you also don't have to fiddle with hooking up Set Active/Enabled On Dialogue Event components.



The only thing you can't do with the sequence command is start another conversation, since the restriction is that only one conversation can be active at a time.
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

I think I cocked it up by accidentally having two different conversations called the same thing. Only one was showing in node view, but when I turned to the other view I could see the other conversation. I think there was legacy problems so I've just deleted the relevant objects and am just in the process of putting them back in to see if the NPC wizard works on them this time.
User avatar
Tony Li
Posts: 21048
Joined: Thu Jul 18, 2013 1:27 pm

Set Active on Dialogue Event

Post by Tony Li »

Sounds like a plan. BTW, you can have multiple Conversation Triggers on an NPC. You might want to do this, for example, if each Conversation Trigger has a different set of Conditions. But you'll have to add additional ones manually. The wizard tries to keep things simple by only working with one Conversation Trigger.
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

Right I've stuck the setactive command in the sequencer box in the database which is much easier than the messing about I was doing trying to time it with the end of a conversation, but now the associated text doesn't come up at all. The thing I want activated is supposed to flick on during one dialogue box then flick off with another a bit later, but it's just coming on and off immediately and no text is coming up.



(To make it harder on myself earlier the object I was trying to activate had a name with a space in it and that was another reason why it wasn't working too)
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

Blank dialogue boxes are my friends :)
User avatar
Tony Li
Posts: 21048
Joined: Thu Jul 18, 2013 1:27 pm

Set Active on Dialogue Event

Post by Tony Li »

To add to that in case this info is helpful: If you don't want the blank dialogue box to delay (or control the camera, or whatever your Dialogue Manager's Default Sequence is), you can set its Sequence to None().



Also, you can specifying timing for sequence commands, such as:



SetActive(Lightbulb); Animation(Blink,Prisoner)@0.5; SetActive(Lightbulb,false)@2.0



This would turn on the light bulb immediately, play the prisoner's blink animation at the 0.5-second mark, and then turn off the light bulb at the 2-second mark.
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

Ooh that is helpful. Thanks Tony. I need one re-fix from my coder (so that the DS tag system works again) and then this could help with my timing issues, then I'm nearly there on our tutorial level.



The rest of the levels require a different layout from the Dialogue System, so it's going to be a different set of solutions I need, but it's progress. W00t!
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Set Active on Dialogue Event

Post by wattoo »

I'm having problems with this SetActive Command. I'm just starting to edge towards investigating the camera control and at the start of conversation I deactivate our custom game cam and activate a simple cam position in game (I tried using SwitchCamera and I couldn't get it to work). This step worked, but at the end of the conversation I tried to do the reverse and it switched off the simple cam, but wouldn't reactivate the game cam. I added a blank dialogue box to the end of the conversation and put the commands there instead. It worked as expected...briefly, then deactivates the game cam again.



There are a couple of error messages in the console...



Object ref not set to an instance of an object - Sequencer.TakeCameraControl()



and



Object ref not set to an instance of an object - Sequencer.ReleaseCameraControl()



What am I doing wrong this time?
Post Reply