YEP_X_ClassBaseParam

● ARCHIVED · READ-ONLY
Started by Eliaquim 4 posts View original ↗
  1. 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.
  2. 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.
  3. Edr123 said:
    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.
  4. 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