Page 1 of 1

Configurable conditions-checking in component inspector?

Posted: Thu Jan 14, 2021 10:18 pm
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!

Re: Configurable conditions-checking in component inspector?

Posted: Fri Jan 15, 2021 8:36 am
by Tony Li
Hi,

Use Dialogue System Triggers set to OnStart. For example:

dstOnStart.png
dstOnStart.png (38.16 KiB) Viewed 235 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.

Re: Configurable conditions-checking in component inspector?

Posted: Fri Jan 15, 2021 5:16 pm
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!

Re: Configurable conditions-checking in component inspector?

Posted: Fri Jan 15, 2021 5:55 pm
by Tony Li
Happy to help!