onExecute() through dialogue nodes

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

onExecute() through dialogue nodes

Post by pegassy »

I have been using the onExecute() events in DS Trigger components, and they are extremely convenient for manipulating in-game objects.

However, I noticed that the onExecute() component on dialogue nodes do not accept game objects but only prefabs. I assume that is because the tree can be used in any scene. I was wondering if there is a way around to use these specific event triggers for scene objects somehow for conversations that I know I will not be using in more than one scene. It would be a great shortcut for many things.
User avatar
Tony Li
Posts: 20990
Joined: Thu Jul 18, 2013 1:27 pm

Re: onExecute() through dialogue nodes

Post by Tony Li »

I'm considering that. Non-scene assets (such as dialogue databases) generally can't reference scene objects.

It's possible to sort-of-indirectly reference a scene object using an ExposedReference. I don't want to add more weight to each dialogue entry node for those devs who wouldn't use it, so I may add this as an option that you can enable by adding a scripting define symbol.

In the meantime, you can use the Sequence field. Sequences work with GameObject names. If you drag a GameObject into the Sequence field, by default it will add this command: SetActive(yourGameObject,true). You can change the default commands that are added for drag and Alt+drag.

You can also use other commands such as SendMessage(methodName,,yourGameObject) to invoke the method methodName on yourGameObject.

And of course you can write your own sequencer commands to do other custom activity.
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: onExecute() through dialogue nodes

Post by pegassy »

I appreciate the explanation.

I think I was mainly being lazy about using the SetEnabled() command for turning certain components on and off. The events seemed to make that easy (I'd much rather be dragging things around than typing).

I did not know that you could directly drag an object into the sequencer field. This is huge :) You mentioned you can use alt + drag, say, to turn a component on or off? Where do you customize that?

Thank you.
User avatar
Tony Li
Posts: 20990
Joined: Thu Jul 18, 2013 1:27 pm

Re: onExecute() through dialogue nodes

Post by Tony Li »

You can use drag-and-drop to turn a GameObject on and off, and a few other options. To choose different options, click "+" > GameObject Drag-n-Drop:

Image

(Side note: A bug in version 2.1.6 prevents you from changing the action assigned to Alt+drag. This is fixed for 2.1.7.)

Drag-and-drop does have limits. You can't drag components onto the Sequence field yet. But you can avoid a little typing by selecting "+" > All Sequencer Commands > SetEnabled. This will type the "SetEnabled(" part. Then you just need to type the rest, such as "SetEnabled(Light,true,Foyer Lightbulb)".
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: onExecute() through dialogue nodes

Post by pegassy »

Thank you so much. I noticed that you made these changes in the new release. DSU continues to amaze me with the depth of features it keeps revlealing for me.
User avatar
Tony Li
Posts: 20990
Joined: Thu Jul 18, 2013 1:27 pm

Re: onExecute() through dialogue nodes

Post by Tony Li »

Thanks!
Post Reply