Twine Version: 2.3.9
Story Format: Sugarcube 2.31.1
I’m making my first Twine game which will have different missions/quests. Inside the StoryCaption I want to print out which Quests are active right now so the player can easily keep track of what to do next.
The game moves between 4 time passages(morning, day, evening and Night. The night passage only has code and sends the players insantly to the morning passage using the <> function. Inside the Night passage I include all the coding that needs to happen before the next day(i.e. <<Set $Days to $Days + 1>>)
Since the Active Quests can change during the day (by completing questst) I set up a Quest updater inside the night passage that the player will pass through. All coding I’m currently using are mentioned below.
For the Quests I set up Objects Example below. All the Quests objects I create are labelled as followed: $Quest"Inside Number".
<<set $Quest1 = {
"active": 1,
"Completion": 0,
"Progression": 0,
"TimeRestriction": "True",
"TimeLeft": 14,
"Short": "Gather supplies by the side of the main road outside the forest.",
"Long": "Drive towards the road to see if there are any supplies left. Maybe you can find some more food, or a tool that can help you along your way.",
"Title": "Gather Supplies",
"QuestTiming": 1,
"Passage": "C1Q1P1"
}>>
I set the following Array:
<<set $Quests to []>>
<<if $Quest2["active"] is 1>>
<<set $Quests.push($Quest2["Short"])>>
<</if>>
Which makes it possible for me to print out the information “ShortName” from the object $Quest1 mentioned above inside the StoryCaption using:
<<print $Quests[0]>>
<<print $Quests[1]>>
During the night cycle passage I have the following Quest Updater Code:
<<set $Quests.deleteAt(0,1,2,3,4,5,6,7,8,9,10)>>
<<if $Quest1["active"] is 1>>
<<set $Quests.push($Quest1["Short"])>>
<</if>>
<<if $Quest2["active"] is 1>>
<<set $Quests.push($Quest2["Short"])>>
<</if>>
The problem I run into is that I have to manually add code for every single $Quest"Number" I create. I am looking for a way to do this last part (setting the $Quest.push if Quest"Number" is 1) for every object I create (however many there will be). I am pretty much a beginner, please help me out by making the ansers not too complicated, thanks in advance!