Twine Version: 2.3.14
Story Format: Harlowe 3.2.2
I’m working on a game that includes a combat system. Because combat shows up in multiple parts of the game, I’m displaying a separate entry that contains the actual combat statistics, then using the variable $victory to determine whether or not the player won the battle. The problem I’m running in to is that I want the game to display information after the player wins a battle, but because of the way that I’m displaying the page, the information’s if/else statement gets checked once and then ignored due to $victory not having the value it requires. Is there a way for me to reload the if/else bit once the player wins combat so that they can see new “unlocked” options thanks to winning said combat?
The code in question:
(set: $enemy_stam to 8)
(set: $enemy_skill to 7)(if: $victory is true) [
[[Continue|29]].
]
(if: $round >= 2) [
You may (link: “Escape.”) [
(set: $stamina to $stamina-2)
You end up back at [[the junction|375]].
]
]
(display: “Combat”)
And the Combat code (in case I can change something there to make this work):
(unless: $enemy_stam <= 0 or $stamina <= 0) [
(link: “Fight”) [
(set: $round to $round + 1)
(set: _playerroll to (random: 2,12)+$skill)
(set: _enemyroll to (random: 2,12)+$enemy_skill)
(if: _playerroll > _enemyroll) [
(set: $enemy_stam to $enemy_stam-2)
You hit the enemy, inflicting 2 points of damage on them! They are now on $enemy_stam Stamina points!
(display: “Combat”)
] (else_if: _enemyroll > _playerroll) [
(set: $stamina to $stamina-2)
The enemy hits you, inflicting 2 points of damage on you! You are now on $stamina Stamina points!
(display: “Combat”)
] (else:) [
Your attacks clash against each other. No damage is inflicted.
(display: “Combat”)
]
]
]
(if: $enemy_stam <= 0) [
(set: $victory to true) You have defeated the enemy!
] (else_if: $stamina <= 0) [
[[You have perished.|Game Over]]
]