YEP_X_ClassBaseParam

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,695
Reaction score
1,113
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi everyone!
I'm trying to make a level up with random growth of stats.
But i cant figure out how to do it.

Here things i tried:
Code:
<Custom Class Parameters>
   maxhp = level * Math.floor(Math.random()*3)+1;
</Custom Class Parameters>

OR

<Custom maxhp Formula>
   maxhp = level * Math.round(Math.random()*3)+1;
</Custom Param Formula>
But none of them worked. Also, the first one, sometimes when level up the maxhp of actor, goes down. And i cant manage to change that.
I would like some like that:
When actor x level up, increase MAXHP by Math.floor(Math.random()*3)+1 Or Math.round(Math.random()*3)+1(whats the difference between mathfloor and math round?) ;
I can figure it out to do with variables, but is a lot of characters and stats to check.
I think in some like that.
A parellel event with a conditional branch:
If actor x level up
Activate switch 1 on
So run a common event with the fórmulas of level up for this character.
 

Edr123

Villager
Member
Joined
Oct 5, 2018
Messages
8
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hi,
Math random takes a number between 0 and 1.
Math floor rounds down the number of the out come so if you get 5.95 it would round it down to 5.
Math round would round the number down normally so if you get 5.49 it would round it down to 5 if you get 5.5 it would round it down to 6.

If you would fill in your current formula with dummy numbers you would get the following.
Taking 0.4 and 0.8 as Math random results and using the Math floor formula.
20(level) * (0.4*3)+1 = 25
19(level) * (0.8*3)+1 = 39

So in the example above your HP would go down from level 19 to level 20.

You would need to revise your formula.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,695
Reaction score
1,113
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi,
Math random takes a number between 0 and 1.
Math floor rounds down the number of the out come so if you get 5.95 it would round it down to 5.
Math round would round the number down normally so if you get 5.49 it would round it down to 5 if you get 5.5 it would round it down to 6.

If you would fill in your current formula with dummy numbers you would get the following.
Taking 0.4 and 0.8 as Math random results and using the Math floor formula.
20(level) * (0.4*3)+1 = 25
19(level) * (0.8*3)+1 = 39

So in the example above your HP would go down from level 19 to level 20.

You would need to revise your formula.
Hi! Thanks for answer!
I understand the explanation aboit math formulas, i guess... Huhauhau
But, i dont understand your example. Wheres the value form math floor? I see that you put 0.4 and 0.8 in the place of the math.random. But i dont see mathfloor.
 

Edr123

Villager
Member
Joined
Oct 5, 2018
Messages
8
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hi!
I noticed I made a mistake in the above calculation aswell.. woops
Example below, you round it down on were you put the brackets.
maxhp = level * Math.floor(Math.random()*3)+1;
maxhp = 20 * Math.floor(0.4()*3)+1;
maxhp = 20 * Math.floor(1.2)+1;
maxhp = 20 * 1 + 1;
maxhp = 21

maxhp = level * Math.floor(Math.random()*3)+1;
maxhp = 19 * Math.floor(0.8()*3)+1;
maxhp = 19 * Math.floor(2.4)+1;
maxhp = 19 * 2 +1;
maxhp = 39

I would suggest you have a base formula per level + a bonus and make sure the bonus is never more than the base formula increase per level.

For example:

Maxhp = level * 10 + Math.floor(math.random()*10);
Maxhp = 20* 10+ Math.floor(0.4()*10);
Maxhp = 200 + math.floor(4);
Maxhp = 200 + 4
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top