if statement for script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pizzadelivery3
Posts: 11
Joined: Thu Jun 06, 2024 9:37 pm

if statement for script

Post by pizzadelivery3 »

I'm working on conditions and scripts for a quest. I want one of the dialogue nodes to set a quest active ONLY IF the quest is currently inactive. The use case of this is if a player picks up a key item to complete a quest before the quest has even started I don't want the dialogue node of the previous conversation to start the quet since it's already been completed. Let me know thanks!
User avatar
Tony Li
Posts: 23254
Joined: Thu Jul 18, 2013 1:27 pm

Re: if statement for script

Post by Tony Li »

Hi,

While you could use two nearly-identical dialogue entry nodes -- one with Conditions that check if the quest is active and one with Conditions that check if the quest is inactive -- this isn't necessary. You can use a single dialogue entry node and set the Script field to something like:

Code: Select all

if (CurrentQuestState("Your Quest") == unassigned) then 
  SetQuestState("Your Quest", active) 
end
pizzadelivery3
Posts: 11
Joined: Thu Jun 06, 2024 9:37 pm

Re: if statement for script

Post by pizzadelivery3 »

yupp this worked great. Thank you!
User avatar
Tony Li
Posts: 23254
Joined: Thu Jul 18, 2013 1:27 pm

Re: if statement for script

Post by Tony Li »

Glad to help!
Post Reply