Percentage possbile with out scripting?

Hello all,


   I have two var that I need to compare, which is pretty simple, but the issue i am having is the result from the 2 var I need to check if it is certain percent or not. Can MV do this with out custom scripting?


I was thinking that using MOD in the self variables but I do not know if that would return a hole number or a percentage 
You'll need a third var a bit of math:


pUnjURi.png
Thanks for that I was thinking doing like that just did not know if MV had a built in percent feature I was going to scritp it out as well cause I can just use float value
Hello all,


   I have two var that I need to compare, which is pretty simple, but the issue i am having is the result from the 2 var I need to check if it is certain percent or not. Can MV do this with out custom scripting?


I was thinking that using MOD in the self variables but I do not know if that would return a hole number or a percentage 



I do this all the time to make percentage bars. (And it does not require any harsh scripting, or any external editing)


The values you need and the math is like: 


X/100 = currentValue/maxValue


So if it was 


X/100 = 60/120


The math is like 


60 / 120 * 100 = percentage


To get game variables in rpg maker mv, you do $gameVariables._data[1], where the "1" is the number of the variable you want to get. 


So say I wanted to do HP and MaxHP.


If HP is [0024]:HP


and MaxHP is [0025]: MaxHP


and you also need CurrentPercentage, so let's say CurrentPercentage: [0026]: CurrentPercentage within your game variables...


What you ultimately want to do is: 


$gameVariables._data[26] = ($gameVariables._data[24] / $gameVariables._data[25]) * 100


This is extremely simple to do without any knowing of real scripting, and you can use RPG Maker MVs eventing to do it (no external scripting software required)


1) Find the variables numbers.


2) Do Control Variables...


3) Select Single: Select your currentPercentage variable. In this example it's 0026.


4) Click on Script...


Paste in the following in the field: 


($gameVariables._data[24] / $gameVariables._data[25]) * 100


(The following code only works if currentHP is variable 24, and variable 0025 is MaxHP.)


If you then wanted to create a display bar or something, you can create about 10 pictures or more if you're really ambitious, and then using a parallel process event display graphics based on what the currentPercentage is. This is how people in the rpg maker 2000 days made their own battle systems and were able to make HP, MP bars etc...
I was thinking that using MOD in the self variables but I do not know if that would return a hole number or a percentage 

MOD always returns a whole number - that is how the modulo operation is mathematically defined, it is the rest after a division.

Original thread: https://forums.rpgmakerweb.com/threads/percentage-possbile-with-out-scripting.62646/