Quests in SugarCube

Twine Version: 2.3.16
Story Format: 2.36.1

I simply do not understand how to add quests. I have seen a few ‘answers’ from general browser searches on other sites, but I do not understand a word that they say. It is always phrased in a far too complicated manner for me to grasp. I suspect they might be forums for those all know more than I do.

However, every question I have asked here so far has been clear, concise and simple, so this is it…

My story is a mystery/adventure with adult themes. Initially the player must discover where their parents have gone, so this would be the first quest. Other quests will be added later as discoveries are made, new people are met etc, and added to a quest log.

I have created a passage called Quests to which I added this, (simply so it had some content):

<div id="questdiv" style="padding-left: 10px; color: black; background-image: url('img/bg/old paper.jpg');">''You currently have no quests''

In StoryCaption, I added this, thanks to @pbparjeter

<<link "Quests">>

I can access this from the sidebar, as well as other tabs, and I believe this is good for the questlog passage, to store the quests, but that’s as far as my inexperience takes me.

From another game, I copied this to StoryInit, but as you can see, I turned it off, because it wasn’t part of the original code, and I didn’t fully understand it. But it looked like it might be useful (I try to collect useful code and adapt it where possible):

/*<<set $questdone to 'false'>>*/

I haven’t added anything yet like:

<<set $missingparents is true>>

although I believe bits like that will be needed as the story progresses, and as quests get ticked off.

So simply put, how do I make something into a quest, and how do I keep track of whether it is active, completed or failed? Also, there is no doubt I have missed some element to all this that will be necessary in this project, so please feel free to point out anything that I have missed.

There isn’t any built in way to make quests. The most straightforward way is just to hide links behind variables

For example, in the last page of your first quest

<<set $quest1 to "complete">>
<<set $missingparents to true>>

Then on your start page (or wherever)

<<link "Start Quest 1>><<goto "quest1">><<set $active_quest to "1">><</link>>
<<if $quest1 eq complete>><<link "Start Quest 2">><<goto "quest2">><<set $active_quest to 2>><<endif>>

This assumes that quests are linear chapters, though. If you have a different approach, things could get complicated fast, to say the least.

Edit: To elaborate a bit more, the goal is just to set different variables for different contexts. There are no hard and fast rules here, but

<<if $quest1 eq “complete”>> is used to open access to the next quest
<<if $active_quest eq “1”>> can be used in passages to display certain relevant text, hints, etc.
<<if $missingparents eq true>> can be used for anything else

Though it is not working code, you should be aware of this rule

<<set $questdone to 'false'>>
should be
<<set $questdone to false>>.

Logical values such as true, false, numbers, etc. should not be in quotation marks…a full list of values is here.

Other values should go in quotation marks though.

1 Like

I think quests as story variables. I would set any quest in my StoryInit passage

<<set $Quest1 to 0>>
<<set $Quest2 to 0>>

Under circumstances quests will progress.

<<set $Quest1 to 2>>

This will change future passages.

<<if $Quest2 == 0>>something happens
<<elseif $Quest == 1>>something else happens<</if>>

At some point the quest will reach its conclusions, success, or failure, you may want to give a different value if further needed, or even <<unset>> the variable altogether.

If in StoryInit, I add

<<set $Quest1 to false>>
<<set $Quest2 to false>>
<<set $Quest3 to false>>
<<set $Quest4 to false>>
<<set $Quest5 to false>>

and in my Quests passage I add:

<<if $Quest1 is true>> "name of quest"<</if>>
<<if $Quest2 is true>> "name of quest"<</if>>
<<if $Quest3 is true>> "name of quest"<</if>>
<<if $Quest4 is true>> "name of quest"<</if>>
<<if $Quest5 is true>> "name of quest"<</if>>

This would give me a list of quests, even if it is simply a list, which would update as each quest gets activated by:

<<set $Quest1 to true>>

and if a quest is completed, could be removed from the list with another:

<<set $Quest1 to false>>

once more. This would give the player an active list that they could check.

Not perfect, not particularly eloquent, but it should work. Shouldn’t it? Can anyone see any potential issues with this?

1 Like

It looks good and solid, McFluff.

Just one thing:

<<if $Quest1>>

is a shortcut for

<<if $Quest1 is true>>

The less characters, the fewer the chances of a silly mistake!


For the Quest list you can use else so that there is unclickable text when false. For example

<<if $Quest1 is true>> [[Name of Quest]] <<else>> Name of Quest  <</if>>