Help with making 'current health'/'max health' to display


#1

Hi, I’m having trouble trying to make a health stat display in a certain way.

My goal is this:

Health: 50/100

Where ‘50’ would be the character’s ‘current health’ (variable: CurrHealth) and the ‘100’ is his ‘maximum health’ (variable: MaxHealth)

In my startup.txt, I have created these variables (using placeholder values).

*create MaxHealth 100
*create CurrHealth 50

The problem is that under *stat_chart, it cannot read the display how I want it.

I try the following:

*stat_chart
text CurrHealth/MaxHealth

It throws back an error as it reads ‘CurrHealth/MaxHealth’ as a single variable.

Any suggestions how I could proceed? I’m thinking of making a variable that displays as ‘CurrHealth/MaxHealth’ (doing something like {CurrHealth}/{MaxHealth} maybe?) and have it be calculated and then displayed on the stat screen, but I have no idea how to go about doing that.


#2

All you need to do is

*set health 50

then in the stat chart display it as

percent health

Or is there a reason you can’t do that


#3

I don’t want it as a percentage if at all possible, instead showing absolute values of CurrHealth/MaxHealth.

I’m trying to use

text

and have it display like a string ‘50/100’ but the ‘/’ throws off the stat_chat command.


#4

Maybe try

text ${curr_health} / ${max_health}

#5

You have to make them into one stat. I think it would be something like:

*temp current_health 50
*temp max_health 100
*temp health_display ""

*set health_display ((current_health & "/") & max_health)
*stat_chart
    text health_display Health

#6

Yeah I suspected that I had to do that.

So do I create the ‘health_display’ stat in startup.txt, and then on the choicestats.txt I put the *set health_display command at the top as well?

Edit: Okay tested this. Definitely working with moving the format of CurrHealth/MaxHealth into health_display. I just have to set-up the calculation to run every time the player looks at the stat screen. Thanks!