Page 1 of 1
How to turn trigger off after conversation
Posted: Thu Feb 21, 2019 6:09 am
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.
Re: How to turn trigger off after conversation
Posted: Thu Feb 21, 2019 9:43 am
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.
Re: How to turn trigger off after conversation
Posted: Thu Feb 21, 2019 10:55 pm
by tezza73
Worked perfectly....thank you.....