Quests with multiple variable conditions

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
allisonrose
Posts: 32
Joined: Wed Nov 14, 2018 8:27 pm

Quests with multiple variable conditions

Post by allisonrose »

Hi!

I have a handful of quests (about 15) that are active at the start of the game.
Each of these quests requires the player to reach a certain level in various player stats. (Each of these stats are currently stored in variables such as Knowledge, Strength, etc...)
For example: When the player reaches 3 Knowledge and 5 strength, they will "complete" the quest and receive a bonus (such as +10 Knowledge added), send an alert message to the player, and mark the quest complete in the journal.

What I am struggling with, is how to consistently check for these variable conditions so that the game knows when the quest is complete. I looked over the Condition Observer, but that seems to be pretty inefficient if I am constantly checking the conditions of 15+ items.

If there a better way to handle this situation? Maybe using quests for this type of thing is the wrong approach completely?

Hope this made sense. Thanks in advance!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quests with multiple variable conditions

Post by Tony Li »

Hi,

Using quests is the right thing to do because you can save the quest states, check the quest states, and show the quests in the quest log window and quest tracker HUD.

The trick is efficiently checking the conditions.

One way to do this with little to no scripting is to add a Dialogue System Trigger set to OnUse, typically to an empty GameObject. You can put it on a child of the player or Dialogue Manager if you need it to survive scene changes.

Set the Dialogue System Trigger's Condition > Lua Conditions to require that the variables are high enough for the quest to succeed. Set Quest Conditions to require that the quest is active.

Then select Add Action > Set Quest State, and configure it to set the quest to success. Select Add Action > Show Alert, and set the alert message.

Whenever you change a player stat, call this Dialogue System Trigger's OnUse() method.

To see a similar example, open DemoScene2. It has a quest to shoot 5 enemies. Each enemy has a trigger that fires when the enemy is destroyed. This trigger calls a Dialogue System Trigger that's set up similarly to what I described above.
allisonrose
Posts: 32
Joined: Wed Nov 14, 2018 8:27 pm

Re: Quests with multiple variable conditions

Post by allisonrose »

Okay that makes sense!

I assume I would need a different game object with trigger for each quest?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quests with multiple variable conditions

Post by Tony Li »

Yup!
Post Reply