Hello, I’m new here, so sorry if I make mistakes.
My question is stated in the title, but here’s a better explanation of it, I want a fraction Health system(for lack of a better name)like the one in the game “The War for Magincia” that changes based on certain situations.
Here’s an example of what I want: 0/100.
How do I achieve this?
I know this was kind of horribly explained so if I need to explain more please tell me.
Assuming I understood it right (never played that particular game)
you first need to create a variable in your startup file
*create health 100
or any other value you want to display
Now you can add it to the stats like this (or however you prefer)
Health: ${health}/100
It should show 100/100
I would recommend writing a *gosub at the bottom of each scene file so the value doesn’t go over 100 or below 0, something like this:
*label health_score
*if health > 100
*set health 100
*if health < 0
*set health 0
*return
So a choice could look like this:
*choice
#OPTION1
*set health -20
*gosub health_score
OUCH
*goto ouch
#OPTION2
*set health +20
*gosub health_score
BLAH BLAH
*goto blah
Remember to always use *gosub after the health value was changed so it won’t display something like 120/100 unless that’s something you want ^^
@tiranka is right. War for Magincia uses a variable for maximum health (that can increase throughout the game iirc) and another one for current health.
In the stats page, it just prints as simple text. It does not use the *stat_chart statement.
Sure. sorry. In your example, you have *gotos under what would seem to be the *label. I’m confused why they’re in that order, since I would expect the *label to gennerally be under the *goto, unless you’re just using placeholder text.
Actually forget about my previous question, I managed to get it working, but now it displays it like this 10/10: 10. How do I fix it so that it just shows the 10/10 part?
When I use it like that I get this error: this line should start with "percent", "text" or opposed pair and when I use it with “text”(like this:text Health: ${health}/10) I get this error: couldn't extract another token: :
[b]Skills and Health[/b]
*stat_chart
Health: ${health}/10
If that is the case (which I assume, because otherwise the error you mentioned wouldn’t occure)
You don’t use the *stat_chart here. You only have to delete that part and it should work. You really only have to write it exactly like @Szaal wrote it