Howdy, Stranger!

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

In a fight, how do I replace the fight text with the win/loss text?

(if: (either: 0, 1) is 0)[The snake bites you. Yowch! (set: $currenthp to $currenthp + $armordefense - $snakedamage)
The snake's current hp is $snakehp.
Your current hp is $currenthp.
Fight the Snake
The Forest](else:)[You hit the snake. Take that! (set: $snakehp to $snakehp - $weapondamage)
The snake's current hp is $snakehp.
Your current hp is $currenthp.
Fight the Snake
The Forest]

(if: $snakehp < 1)[The snake is dead!](replace: "Fight the Snake" and "The Forest")Snake Win]

This is my code so far. The fight itself works. I just can't figure out how to replace, upon win or loss, the first passage's text with the text at the bottom. Any help would be greatly appreciated. I'm using Harlowe on Twine 2.0.10.

Comments

  • Harlowe has a feature called a Named Hook which can be used to mark a section of a passage so that it can be changed later on.

    note: you had two instances of the two markup links (Fight and Flee) when you only needed one, also the final (if:) macro did not include the (replace:) macro so it would of been run every time.
    (if: (either: 0, 1) is 0)[The snake bites you. Yowch! (set: $currenthp to $currenthp + $armordefense - $snakedamage)
    The snake's current hp is $snakehp.
    Your current hp is $currenthp.
    ](else:)[You hit the snake. Take that! (set: $snakehp to $snakehp - $weapondamage)
    The snake's current hp is $snakehp.
    Your current hp is $currenthp.
    ]
    |options>[ [[Fight again?|Fight the Snake]]
    [[Flee?|The Forest]]]
    
    (if: $snakehp < 1)[The snake is dead!(replace: ?options)[[[Victory!|Snake Win]]]]
    
  • This is how to make it randomized right?

    Say you have your health at 5000, and boss health at 50000, the fight goes on for 5 rounds, each dealing 20% damage. You have 3 options, and they give you a random chance of striking the boss or you dying in one hit. Say the options are Lunge, Roll and Block.
Sign In or Register to comment.