Configurable conditions-checking in component inspector?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Jamez0r
Posts: 59
Joined: Fri Nov 20, 2020 8:18 pm

Configurable conditions-checking in component inspector?

Post by Jamez0r »

Hi Tony and everyone :D

Sorry if this has been asked before, but I looked through the forum for a while and figured I'd just go ahead and ask.

I'm looking for a 'generic' way to check if specific conditions (dialogue variables) are met, to then trigger something happening. Ideally something like adding a List of *DialogueVariableConditions* to a script, and then being able to configure that list of conditions in the inspector.

One example of usage for this is that I have an NPC that will appear at different places depending on conditions. If you haven't completed the tutorial he appears at the Training Grounds. If you beat the tutorial but not the big boss, he appears at the camp. If you beat the tutorial and the big boss, he appears at the castle (silly example but you get what I mean).

The NPC would be placed at all 3 of those locations, and only the one that meets the conditions would have their gameobject activated when the area is loaded (the others would be disabled).

Are there any built-in ways to configure a list of variable conditions in the inspector for a script? Or would I need to implement it myself?

Thanks a lot!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Configurable conditions-checking in component inspector?

Post by Tony Li »

Hi,

Use Dialogue System Triggers set to OnStart. For example:

dstOnStart.png
dstOnStart.png (38.16 KiB) Viewed 233 times

This is for the Training Grounds. When the scene starts, this trigger checks if the variable Finished_Tutorial is true. If so, it deactivates the NPC. Note: You don't have to type that Lua. Use "+" and specify the condition using the dropdowns, then click Apply.
Jamez0r
Posts: 59
Joined: Fri Nov 20, 2020 8:18 pm

Re: Configurable conditions-checking in component inspector?

Post by Jamez0r »

Glorious - I didn't realize how flexible that component was - I was using it to start a conversation, but it can be configured to do a LOT.

For anyone that might stumble upon this post, the Actions section can trigger various dialogue-system related things and also has an option to trigger a UnityEvent, so you can mix that in with your own game systems.

On the scripting side, you can this to check if the conditions are met:

Code: Select all

dialogueSystemTrigger.condition.IsTrue(transform));
Thanks a lot Tony!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Configurable conditions-checking in component inspector?

Post by Tony Li »

Happy to help!
Post Reply