Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Redirect to new passage? Twine 2.0 Harlowe

I've tried to look find how to fix my problem but I can't seem to find the right answer.

Basically what I'm trying to do is have the player reach a point in my game where they're allowed to restart. But on their 2nd attempt, I want the game to remember this and as they reach the same point where they restarted at in their first attempt, should they decide to attempt to restart again, it'll lead them to a new passage.

To make it clearer: Player wakes up and starts at his house. He decides to go into the forest. After a few passages, he has the option to go back home or to go deeper in the forest. If he goes home, he goes to sleep and wakes up again in his house and starts over from the beginning.

If he decides to go back home, he is in the beginning again which is waking up and starting at the house then going into the forest. After a few passages, he has the option to go back home or to go deeper in the forest. But this time, if he decides to go home again, he dies.
__________________________________________________________________________
What I want to is to have the game remember that he decided to go home once already, and if he decides to do it again -- it'll take him to a new passage that pretty much says he's dead.

Is there a way to do this without set codes or creating way more passages? I just want a way to re-direct to a new passage. I want the game to remember that he came back home once and if he decides to choose to go back home yet again, it'll take him to a new passage than one he would of gotten if he chose to go deeper into the forest.

Comments

  • edited April 2017
    You need to state the name and full version number of the story format you are using, as answers can be different for each one.

    You could possible use a combination of the (history: ) macro with the (count: ) macro to determine how many times the reader has visited the Home passage.
    (set: $count to (count: (history:), "Home"))\
    (if: $count is 0)[You are home]\
    (else-if: $count is 1)[You have returned home]\
    (else:)[(go-to: "Death")]
    
  • edited April 2017
    greyelf wrote: »
    You need to state the name and full version number of the story format you are using, as answers can be different for each one.

    You could possible use a combination of the (history: ) macro with the (count: ) macro to determine how many times the reader has visited the Home passage.
    (set: $count to (count: (history:), "Home"))\
    (if: $count is 0)[You are home]\
    (else-if: $count is 1)[You have returned home]\
    (else:)[(go-to: "Death")]
    


    I'm new to Harlowe so Im sorry but would doing (set: $life to "yes") and (if $life is "yes")PassageName --- would that work?

    Regarding your code -- so i would put the set macro at the start of my game, the if macro at the point where my character chooses to go home or go deeper into the forest, where do I put the other two else and else if macros?
  • azntyrone wrote: »
    I'm new to Harlowe so Im sorry but would doing (set: $life to "yes") and (if $life is "yes")PassageName --- would that work?
    Yes, once you fix the (if:) macro to have a colon after the if keyword and wrap the markup based link within the (if:) macro's associated hook [] although I would suggest using a Boolean (true/false) value instead of a String.
    <!-- Either like this using a String value. -->
    (set: $life to "yes")
    
    (if: $life is "yes")[ [[PassageName]]]
    
    
    <!-- or like this using a Boolean value. -->
    (set: $life to true)
    
    (if: $life)[ [[PassageName]]]
    
    ... although neither of those will automatically send the reader to another passage as they just cause a markup based link to be shown.

    The reason I did not suggest using a variable to track if the reader lives or dies is because you asked for a solution that did not use one.
    azntyrone wrote: »
    is there a way to do this without set codes...

    azntyrone wrote: »
    Regarding your code...
    As indicated (highlighted) in my previous comment, both the (set:) macro and the (if:) related macros go in your Home passage. (or whatever you have named the passage that represents being inside the house.)
Sign In or Register to comment.