How to turn trigger off after conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
tezza73
Posts: 21
Joined: Thu Feb 21, 2019 5:52 am

How to turn trigger off after conversation

Post by tezza73 »

Hi,

Awesome product!

Just got it but i can't figure out how to turn off the trigger after a conversation so i prevent the player having the same conversation again.

I have a OntriggerEnter on my NPC that triggers the conversation.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to turn trigger off after conversation

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

Here are two ways:

1. Inspect the Dialogue System Trigger. Select Add Action > OnExecute() Event. Configure the event to disable the Dialogue System Trigger component.

You may also want to add an Enabled Saver component, and assign the Dialogue System Trigger. This will save the Dialogue System Trigger's enabled/disabled state in saved games.


2. Define a Boolean (true/false) variable in your dialogue database to remember that the player has spoken to this NPC. (Use the Dialogue Editor window's Variables section.)

In the conversation, set the variable true.

In your Dialogue System Trigger, set the Condition > Lua Conditions to require that this variable is false.

You don't need to set up any Saver components because the variable gets saved with the regular Dialogue System data.

I prefer #2 because it keeps the logic in one place (the database) and you can check the variable elsewhere, such as in another NPC's conversation.
tezza73
Posts: 21
Joined: Thu Feb 21, 2019 5:52 am

Re: How to turn trigger off after conversation

Post by tezza73 »

Worked perfectly....thank you.....
Post Reply