Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

How do I print a variable that changes based on what happens later on in the passage? (Sugarcube)

$
0
0
Confusing question, I know. I was having difficulty phrasing it myself. The example below demonstrates my question clearer:

Example:
//This printed variable is at the top of the passage//
<<print $enemy_HP>>

//Then later on in the lower parts of the passage, there are <<if>> statements. e.g.://
<<set $random_event to random(1,10)>>
<<if $random_event is > 5>><<set $enemy_HP to $enemy_HP - 10>><</if>>

I guess what I'm trying to say is, in my story, a lot of random events may happen during the passage, but they wont dynamically update the "$enemy_HP" variable because the printed value is at the TOP of the passage. I want the $enemy_HP variable to display a value AFTER the rest of the passage has been rendered, but still remain at the top for aesthetic purposes. And I don't want to rerender the passage because that would execute all the $random_events again. Is that possible?

Like, I have player_HP values in the StoryCaption UI sidebar, and those values display POST rendering of a passage. I want that to happen with my enemy_HP values as well.

Hope my question was clear.

Viewing all articles
Browse latest Browse all 1844

Trending Articles