+1 vote
by (130 points)
i made about three different endings in my twine project, and also made a true ending. I tried using the if statement but it did not work for me. Is there a better way to do this?

1 Answer

+1 vote
by (159k points)

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on that information.

One other key detail you didn't state in your question is if the Reader needs to restart the story to see each of the required non-True Ending endings, or if all three of these endings can be seen during a single play-through.

The above effects how you would implement the solution because by default restarting a story resets all Story Variables back to their initial defaults and clears the History system, which means you can't used either of these things to track if something has occurred during a previous play-through.

by (8.6k points)

For example, SugarCube 2 has the <<remember>> macro, which can be used to implement this.

by (130 points)
Its done through a single play through. No restart required.

In three different instances, you have to click 'black out' towards the end which leads back to the beginning of the whole story.

 

I want it so that when each three places is reached at least one time. It is ' True'

 

Then that new passage is unlocked for the reader to reach.  Is that possible in twine?
by (8.6k points)
You still didn't add the story format tags ...
by (159k points)

There are a number of ways you could implement this but for this particular use-case I would suggest using Harlowe or SugarCube's History system.

note: the following will assume that the three non-true ending related Passages are named:
"Ending 1", "Ending 2", and "Ending 3"

1. For Harlowe 2.x you would use a combination of the (history:) macro and the Array contains operator 

If you visit the each of the following three Endings in any order then a fourth option will appear.

[[Visit Ending 1->Ending 1]]

[[Visit Ending 2->Ending 2]]

[[Visit Ending 3->Ending 3]]

{
(set: _list to (history:))
(if: _list contains "Ending 1" and _list contains "Ending 2" and _list contains "Ending 3")[
[[Visit True Ending->True Ending]]
]
}


2. For SugarCube 2.x you would use the hasVisited() function like so.

If you visit the each of the following three Endings in any order then a fourth option will appear.

[[Visit Ending 1->Ending 1]]

[[Visit Ending 2->Ending 2]]

[[Visit Ending 3->Ending 3]]

<<if hasVisited("Ending 1", "Ending 2", "Ending 3")>>
[[Visit True Ending->True Ending]]
<</if>>

 

...