IncrementOnDestroy

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
variantpolygon
Posts: 5
Joined: Fri Mar 20, 2020 4:19 pm

IncrementOnDestroy

Post by variantpolygon »

I'm using IncrementOnDestroy for a kill quest in my game, however, whenever I try to use QuestConditions to check something, it references the demo scene quests (such as 'Get the Launch Codes'). I'm not sure why it's referencing that database and not my own quests. Also the variables from the demo scene appears (like 'hasLaunchCodes') as well as my own variables ('Kills'). I have the IncrementOnDestroy script attached to my enemies, which does increment the kill count, however I'm trying to trigger an event whenever the enemy is killed or if all the enemies are killed.

I was also wondering if there is a way to check the current quest conditions apparat from using the Dialogue System Trigger. For example: I would like to constantly check this lua condition:

Variable["Kills"] >= 5

And if true, run this method (or my own method via a unity event, such as disabling a UI element, etc):

SetQuestState("Clear the Farm area", "success")

I tried using the Dialogue System Trigger to check this condition, but it only has triggers for OnStart or OnTriggerEnter. I'm trying to use something like OnUpdate to always check if the condition is true. Thanks!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: IncrementOnDestroy

Post by Tony Li »

Hi,

It's possible to check Variable["Kills"] continuously (e.g., using a Condition Observer component), but it's very inefficient. Instead, configure the Increment On Destroy component's OnIncrement() UnityEvent to check it. This post has a detailed explanation.

The dropdowns on your Increment On Destroy component may be including the demo database if the database is assigned to one of your Dialogue System Triggers or Dialogue Actors, or to the Dialogue Manager. Make your own database, and not the demo database, is assigned to the components' Reference Database fields.
Post Reply