Unlockable passages via achievements, how?

Hello, I’m new to twine, I understand how twine mainly works however I’m wondering, is there a way to make achievements and then make it so some passages can be unlocked via them? Like, lets say, five endings in a game, you get an achievement for each and when you get them all you unlock a new passage, also how do you return to the starting passage? (like when you get each ending you can return to it).

Sorry if my explanation is bad, I have a hard time explaining things. Thank you!

1 Like

Are you using Harlowe or Sugarcube?

1 Like

hello, I am sorry it has taken me this long to respond, I am using Harlowe.

1 Like

Follow this link…

RABBIT HOLE

…good luck!

1 Like

For the record, I switched to SugarCube, where it is very easy. Harlowe doesn’t seem to have the capacity to record information in permanent storage that persists between runs. However, SugarCube does this very easily out-of-the-box. Unless you have some very good reason to run in Harlowe, I’d recommend switching. Harlowe frankly doesn’t feel ‘finished’. Anyway, in SugarCube you can do it like this:

At the point where the achievement is obtained, put this:
<<run memorize("achievement name", true)>>

Then, wrap the link to your ‘optional’ passages like this:
<<if recall("achievement name", false)>>[[Bonus Scene->Your Passage Name]]<<endif>>

Naturally you should replace “achievement name” with the name of your achievement.

3 Likes

Shouldn’t that be <<if recall("achievement name", true)>>, if the passage is supposed to appear once the achievement is obtained?

Anyway, I agree that if you want to do this, Sugarcube is really what you want to be using. In Harlowe you would have to fake it—instead of an actual reset, you’d have to just link back to the start of your story and manually reset all the variables except the achievement-related ones.

1 Like

@E.Joyce the second parameter in ‘recall’ is the default; it gets used if the key doesn’t exist at all. If I pass ‘true’ to that parameter, it will appear as if you always have the achievement, even if you don’t.

https://www.motoslave.net/sugarcube/2/docs/#functions-function-recall

1 Like

Whoops, sorry, that was stupid of me. I’ve only done this using the State API myself, so I don’t have a lot of familiarity with “memorize” and “recall.”

hello, thank you all for helping me and I apologize for rarely responding, I have changed to sugarcube now. Thank you.