Restoring Health?


#1

What command would you use to restore health to the MC’s stat at the start of each chapter?


#2

Wouldn’t a *set health “100” suffice?


#3

@ChoiceofManning Something like

*set health 100


#4

Ninja’d by @babisko


#5

Oh okay, I was thinking of that but I thought that would just add a 100 health points


#6

@ChoicofManning For adding it, you use “+”

*set health + 100


#7

Oh okay gotcha @fantom


#8

You need two variables for health. Your current health and your max health. That way you can set your current health to your max health and the start of each chapter.


*create health 100
*create maxhealth 100

You took an arrow to the knee.
*set health -50
Your health is now ${health} out of ${maxhealth}.
*page_break

You healed!
*set health maxhealth
Your health is now ${health} out of ${maxhealth}.


Or you could do a health potion like this:


*set health +30
*if health > maxhealth
     *set health maxhealth

^^that way it never goes over max health.

You can even do a previous health to keep track of what your health was before you were hit.


*create health 100
*create maxhealth 100
*create prevhealth 0

You took an arrow to the knee.
*set prevhealth health
*set health -50
Your health was ${prevhealth}, but now it's ${health}/${maxhealth}.
*page_break

You healed!
*set health maxhealth
Your health is now ${health} out of ${maxhealth}.



#9

@CitizenShawn
I know you’re only trying to help, but if a thread’s not had a post in a good while and the issue seems stagnant or resolved, please try to refrain from posting in it, as it just ends up clogging the front page with old content.