Adding End-of-Game Bonus Content

Twine Version: Harlowe 3.3.5
Hi, I’m new to Twine. My previous experience is with choicescript, and I’ve only been using Harlowe for about two weeks now.

Is it possible to add end-of-game bonus content? My vision was that when a player finishes the game I’m working on, a variable for the LI they romanced, MC they played, and the ending they got is triggered and a corresponding short story/LI POV becomes available from the sidebar. I believe I could code it like this (with example variables):

(if: quinn_lover is true)+(if: goodending is true)[
(set: quinn_firstmeeting to true)]

Then in the Bonus Content passage:

(if: quinn_firstmeeting is true)[
Short story about first meeting with Quinn from Quinn's POV would go hear.]

I would also like for this to remain between sessions and not reset between playthroughs so that the player could “collect” the stories and refer back to them at any time. And if it’s not possible in a browser playthrough, would it at least be possible in a downloaded file?

1 Like

The first thing you want to do is possible and indeed pretty easy, although your code is a little off; you’re missing the $ symbols in front of your permanent variable names, and I don’t think you can use + with the if macro like that, so it would be:

(if: $quinn_lover is true and $goodending is true)[
(set: $quinn_firstmeeting to true)]

However, Harlowe doesn’t have the ability to create variables that will persist across replays. You’d have to avoid running the engine restart at all and instead make a sort of “fake restart” by linking back to the first passage and manually resetting all the other variables (the ones you don’t want to persist) to their start-of-game state.

Sugarcube does have this functionality built in, and the last time someone asked this question here I believe they ended up switching to Sugarcube.

2 Likes

Thanks for the advice. I think I might try the fake restart for now, and experiment a bit with Sugarcube to see how hard it is to learn. I’m not super confident with Harlowe yet and Sugarcube is a little intimidating.

3 Likes

If you’re diligent about initializing your variables from the beginning (of writing your game) it shouldn’t be too bad. It can be worse to retrofit onto an existing game.

I’d make a passage that sets all your variables to their initial values, and give it the startup tag so it runs when a player starts your game. And then to “fake restart” you should be able to (display:) that passage and link back to the beginning of your game.

I think that should be all you need: the tricky bit is remembering that every time you need a new variable, you have to open up your reset passage and add it there so it gets reset properly.

4 Likes

OK! That sounds good. I already keep all the variables in a passage that plays at the beginning, so that shouldn’t be hard – I’m used to Choicescript, where all the variables need to be in the startup file anyway. Thanks so much!

2 Likes

As a followup question, I’m sure the fake restart would probably work in Sugarcube too, but is there a sort of New Game + functionality already built in? I’m already using Sugarcube and am eyeing this possibility with interest.

1 Like

It doesn’t do that high-level of a thing: you can do <<run memorize("name", $value)>> to save a value and <<set $value to recall("name")>>.

That’s it. So for a restart in SugarCube, you can memorize the important stuff, then actually restart the game (forgetting everything) and then when the game starts you check to see if you can recall any of the stored achievements or whatever, or if you’re on a first run through the game.

You could certainly use this for a New Game+ feature: when you win, do <<run memorize("NewGame+", true)>>, and then your menu can have something like <<if recall("NewGame+")>>[[New Game+|NewGamePlus]]<</if>>

4 Likes