RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 35 of 77 View original ↗
  1. TheRiotInside said:
    @Riku_Masamune Hey, see if this works:



    a.gainHp(-(Math.randomInt(500) + 500)) ; a.mat * 5


    My syntax might be off somewhere, but the Math.randomInt(500) function should give you something in the 0 to 499 range, so adding 500 after should give you the 500 to 999 you're looking for. :)


    Works, but then for every enemy the spell hits, it stacks up damage (570 and 980 were the numbers I saw). But then I guess that's the point of a taxing spell. Thanks a ton!
  2. Guys, i know i can use a.addState(); to apply a state to actors but i wanna know how can i add more than 1 state using this method.
  3. kovak said:
    Guys, i know i can use a.addState(); to apply a state to actors but i wanna know how can i add more than 1 state using this method.



    You can repeat, i believe. Like a.addState(x); a.addState(y); a.addState(z);
  4. And to the original question of adding a D4 to a formula it would be Math.randomInt(4) + 1, meaning the complete formula is:


    a.atk + Math.randomInt(4) + 1 - b.def


    Oh, sorry. I seem to have missed the intervening posts that answered already.
  5. How should I do this?


    I have a skill for a vampire that is obviously Bite, to feed on Foe and Allies, however I would like that when the skill is used in the actor with Id 2 then a state is applied to both the user and the target


    if (b.isActor(2)) {
    a.addState(12)
    b.addState(12)
    } else {
    a.addState(11)
    }


    in the above case the state 12 is applied to any ally and the user not only when the skill is used on actor 2 but on any other actor.


    So how should I do it?
  6. Is there a way to include a variable in the battle formula based on the specific actor or class being targeted?


    Example:  enemy uses a skill that does X+Y dmg, where Y is different variable depending on what class the targeted actor is.  
  7. I am currently researching these things, since I am new to all this thing, and it's all rather complex to a newbie, I know, I should probably learn how to place shop events down, lol. Just kidding, I know how to event.


    Still, I am looking for a way to make these two skills work at the moment: one of them is a skill that has a chance to land multiple hits (2 to 6 hits) and the other one, the less HP the enemy has, the more damage the skill does. I figure it has something to do with Math, but I'm not sure how exactly I can check what Math values the system understands.
  8. @Drone of Ether the damage formula is a full eval of javascript. So it understands any mathematical formula that you can program in javascript (within its length, no formula that would require a thousand commands to calculate)
  9. I'm having trouble with this formula...


    i = Math.randomInt(2); a.addBuff(2, 1); c = (a.atk * 4 - b.def * 2) * 2; d = c * (Math.randomInt(41) / 100 + 0.8); (i === 1) ? {a.gainHp(-d) ; 0} : c


    it was supposed to:

    • choose either 1 or 0 randomly (saving it on 1),
    • add an attack buff to the character,
    • calculate the damage (saving it on c)
    • calculate a "variance" (saving it on d)
    • if i is 1, gives the user d of damage and 0 to enemy, else give the enemy 0 damage.

    Basically Invigorate from bravely default.


    But it is giving neither the enemy or the user any damage...


    Help, please?
  10. if I remember correctly, new variables need to have the 'var' keyword in-front of them


    so


    var i = Math.randomInt(1); a.addBuff(2, 1); var c = (a.atk * 4 - b.def * 2) * 2; var d = c * (Math.randomInt(41) / 100 + 0.8); (i === 1) ? {a.gainHp(-d) ; 0} : c


    Also, Math.randomInt(integer) returns a number from zero to the specified integer, so you want 1 not 2


    Try this and see if it work
  11. Didn't work...


    I know it works like that on scripts plugins but every time I did so for damage formulas they worked without the var.


    And I heard it goes from 0 to (number - 1), so 2 should give either 0 or 1...
  12. no, I went and checked, its between 0 and number inclusive, you might be confusing it with arrays were the length 2 has 0 & 1 cause all arrays start at zero


    If it isn't throwing a runtime error and just giving 0 damage then there is an error in the formula and it will default to zero


    I can only suggest testing each part as an individual formula to find what part isn't working
  13. Tested like you said.


    Putting 1 in randonInt did not want to get me a 1 no matter how much I tried... where I saw the command said that if you put 100 it gives a number from 0 to 99, are you sure yours is right?


    Found the error, though.


    i = Math.randomInt(2); a.addBuff(2, 1); c = (a.atk * 4 - b.def * 2) * 2; d = c * (Math.randomInt(41) / 100 + 0.8); (i === 1) ? {a.gainHp(-d); 0} : c


    also, just the a.gainHp(-d) seemed to work without the 0, (also, need to put a Math.floor on d) so I'm doing like this, but I'd like to know if anyone knows if it is possible to use a block there and how...


    Either way, thanks for the help! ^_^
  14. I'm coming back to a project I worked on last year, but I'm stuck on a damage formulae after doubling the max HP value of my character.


    What I currently have in MV and worked with my character sitting at 21 max HP, but now that I have him at 42 max HP, it's all messed up. What do I change to make this work? Bonus points if the change is able to roughly take into account some level scaling (it's a small game, so the max HP won't go up by a lot).


    c=b.hp;d=b.mp;b.gainHp(-b.hp+1);b.gainMp(-b.mp); b.gainMp(Math.round(c*0.5-b.level));b.gainHp(Math.round(d*1.33+b.level-1));0




    (What it's meant to do (very roughly) is swap the user's HP and MP around.)
  15. c=b.hp;d=b.mp;b.setHp(Math.round(d*1.33+b.level-1));b.setMp(Math.round(c*0.5-b.level));0


    ... if you are doing the user's, I don't know if using b works, but anyways if you already got h.p and m.p as c and d why aren't you using them right away?


    Anyways, I think setHp/No should work better for you... but better to put a min on h.p if it works so it can't kill the user...
  16. Waterguy said:
    c=b.hp;d=b.mp;b.setHp(Math.round(d*1.33+b.level-1));b.setMp(Math.round(c*0.5-b.level));0


    ... if you are doing the user's, I don't know if using b works, but anyways if you already got h.p and m.p as c and d why aren't you using them right away?


    Anyways, I think setHp/No should work better for you... but better to put a min on h.p if it works so it can't kill the user...

    Well, I got help on the formulae when I made it like last year, because I suck at damage formulaes. I kind of understood how VX Ace's worked, but MV seems to have made things way more complicated (the same formulae in VX Ace is only like half the length of the one I have in MV). Also, from my playtesting, it's not actually possible for the user to kill itself using this skill, as it regenerates 3MP after casting it, on top a passive 1MP regen every turn, making it impossible to fully drain his life, although it does go too low for my liking (or doesn't increase enough in a reverse scenario), due to having increased max HP from when I first made the formulae.


    What do I change to make this work?
  17. What, my version of the formula is not working?


    Then sorry, I have no idea. Without pc right now to test for you...


    Save to change the b. for a. that is. Who knows
  18. Waterguy said:
    What, my version of the formula is not working?


    Then sorry, I have no idea. Without pc right now to test for you...


    Save to change the b. for a. that is. Who knows

    After trying out a bunch of different stuff, I think I got it to work with the hero's new max HP value, using this:


    c=b.hp;d=b.mp;b.gainHp(-b.hp+1);b.gainMp(-b.mp); b.gainMp(Math.round(c*0.25-b.level));b.gainHp(Math.round(d*2.67+b.level-1));0


    It  makes a 0.25 of what first was a 0.5, and doubles the 1.33 into a 2.67. It seems to be working, but I'll report back if I run in more problems.
  19. I have a skill that needs to be able to do 2 things at once. I can make them work individually, but I don't know how to make them work together. The first effect simply deals an amount of damage. The other effect inflicts a condition if the target has a certain condition on them.


    Damage:


    a.mat*1.33-b.mdf*0.33


    Condition:


    b.state?(59)?b.addState(61)


    How does the formulae needs to be written so it uses both effects?
  20. I think this should work...

    Code:
    if b.isStateAffected(59) b.addState(61); a.mat*1.33-b.mdf*0.33