RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[XP] character hp percentages

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 83
I am new to ruby, but I am working on a cbs. I have read through tutorials and posts and maybe I've missed something obvious, but I can't seem to find my answer.

I want to display percentage bars for the characters' hp, mp, and ammo stats. Ammo will be my own thing, but i figure hp and mp should already be in the default system. I have replaced the default battle system script with my own, but otherwise I haven't changed anything. Is there a simple way that is already in the scripts to figure a characters hp percentage? How can I access the current and max hp of a character?

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
try something like $game_actors. That's the global variable that contains all of the actor stats. =) As for percentages...I never was any good at remembering how to do them but I believe it's something like Integer(current hp / max hp") to avoid getting a floating(decimal) number.

**
Rep: +0/-0Level 83
I will look into $game_actors, thank you.
I understand the math of the percentages. I was just hoping the hp and mp values were already in a variable from the default scripts. If they are in $game_actors I will try to find them, but I don't know all the tricks with ruby.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
In $game_actors, you'll find the hp/sp variables. It's up to you to make the percentage formula using the functions from the $game_actors variables.

**
Rep: +0/-0Level 83
Awesome! Thanks for the hint. I am making progress, but I am still figuring out how to access all the information I need from the different variables and such.
I can now calculate the hp percentage for each character in my party and I will be able to put that info into graphics form.