In your dialogue database, define a variable:
This example uses a variable named "TalkedToNPC". In practice, you'll probably want to use a variable name that includes the character name, such as "Adam.Talked". The "." will group variables into submenus for tidier organization in dropdown menus. So you could have variables named "Adam.Talked", "Adam.Insulted", "Bob.Talked", etc.
(Alternatively you can define a custom field in the NPC actor.)
In the conversation, set the variable true:
Then configure your Dialogue System Trigger's Conditions > Lua Conditions to require that the variable is not true yet:
[HOWTO] How To: Run a Conversation Only Once
Re: How To: Run a Conversation Only Once
If you want to run a different conversation the second time, here are some suggestions:
1. Add 2 Dialogue System Triggers to the NPC:
For example, in the conversation below the NPC will say "Hi! Nice to meet you." the first time the Dialogue System Trigger runs. The second time the Dialogue System Trigger runs, the NPC will say "Don't talk to me again.". If the Dialogue System Trigger is used after that, it will not start a conversation at all because neither nodes' conditions will be true.
Note: You can use cross-conversation links to link these branches to separate conversations. To create a cross-conversation link, inspect a dialogue entry node. In the "Links To:" section select "(Another Conversation)".
1. Add 2 Dialogue System Triggers to the NPC:
- Set the Conditions on the first to require that Variable["TalkedToNPC"] ~= true. In this case, run the initial conversation.
- Set the Conditions on the second to require that Variable["TalkedToNPC"] == true. In this case, run a different conversation.
For example, in the conversation below the NPC will say "Hi! Nice to meet you." the first time the Dialogue System Trigger runs. The second time the Dialogue System Trigger runs, the NPC will say "Don't talk to me again.". If the Dialogue System Trigger is used after that, it will not start a conversation at all because neither nodes' conditions will be true.
Note: You can use cross-conversation links to link these branches to separate conversations. To create a cross-conversation link, inspect a dialogue entry node. In the "Links To:" section select "(Another Conversation)".