RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 39 of 77 View original ↗
  1. is it the only command in the damage box? try with only it, maybe it is another part of the skill that gives the error?
  2. Waterguy said:
    is it the only command in the damage box? try with only it, maybe it is another part of the skill that gives the error?



    Yes, is the only thing, i don't add  states or elements, I have the problem with version 1.3 of rpgmaker mv.

    There is a manual to know the variables updates in source code of the maker???
     
  3. So my current damage formula is  Math.randomInt(a.atk) - Math.randomInt(b.def)


    However, if my attack is say 15. I will only be able to hit 0-14 and I'd like it to be able to hit anywhere from 0-15 damage.


    Same with defence. If my defence is 20 I will only be able to block 0-20 damage and I'd like it to be able to block anywhere from 0-20 damage.


    Also, how to check if an attack is a critical hit in the formula box?


    Like if.critical do this formula instead?
  4. Well maybe add a +1?

    Code:
    (Math.randomInt(a.atk) + 1) - (Math.randomInt(b.def) + 1)
  5. emelian65 said:
    Well maybe add a +1?



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






     






     



    That's what I've been using for the time being until I can find a way to include the full range from 0-a.atk because adding the +1 makes it from 1-a.atk


    So if the enemy has 0 defence and I have 5 attack I still won't ever be able to hit a 5. Since the +1 will always block at least 1 damage.
  6. So what about, instead of Math.randomInt(a.atk) + 1, you use Math.randomInt(a.atk + 1)?
  7. Waterguy said:
    So what about, instead of Math.randomInt(a.atk) + 1, you use Math.randomInt(a.atk + 1)?



    Hmm.


    I've got this now: Math.randomInt(a.atk+1) - Math.randomInt(b.def)


    Which seems to be working quite nicely so far. Thanks!
  8. I see that "Math.randomInt(5)" produces a random number between 0-4, but what if I want to exclude 0, and produce a random number between 1-20. It's important that always at least 1 is added from the random factor.
  9. then, get the result and add 1.


    "Math.randomInt(20) + 1", the Math.randomInt(20) will give a number from 0-19 and the +1 will turn it into 1-20.
  10. Shaz said:
    Guess if the button isn't there, the function isn't there.


    You could probably use Ace to generate the formula, and then modify it for use in MV, according to the language requirements.



    I don't know how to edit for "Ignore defense buffs" and editing it in general.
  11. @Silenity @Zaen @Waterguy


    randomInt will give you anything from 0 to 1 less than the number you pass in.


    So:


    Whether you +1 depends on whether you want a.atk to be included in the possibilities


    Where you put the +1 (inside or outside the brackets) depends on whether you want 0 to be included in the possibilities


    Math.randomInt(a.atk) will give you 0 to 1 less than a.atk - a.atk will never be a possibility


    Math.randomInt(a.atk) + 1 will give you 1 to a.atk


    Math.randomInt(a.atk + 1) will give you 0 to a.atk
  12. Waterguy said:
    then, get the result and add 1.


    "Math.randomInt(20) + 1", the Math.randomInt(20) will give a number from 0-19 and the +1 will turn it into 1-20.



    Thanks, I feel silly that I didn't think of that.


    EDIT: It's fun to put console.log into the DMG formula and see what's going on.
  13. Lyseth said:
    I don't know how to edit for "Ignore defense buffs" and editing it in general.

    "ignore defense buffs" I don't know if it is possible with standard damage formulas...
    but the "quick formula" was kinda simple, "(Base Value) + a.atk * (Physical * 0.04) + a.mat * (Magical * 0.02) - (if not "ignore target's defense") b.def * (Physical * 0.02) + b.mdf * (Magical * 0.02)"
  14. How much shame is there to be had in a.atk * 4 - b.def * 2?
  15. Shaz said:
    @Silenity @Zaen @Waterguy


    randomInt will give you anything from 0 to 1 less than the number you pass in.


    So:


    Whether you +1 depends on whether you want a.atk to be included in the possibilities


    Where you put the +1 (inside or outside the brackets) depends on whether you want 0 to be included in the possibilities


    Math.randomInt(a.atk) will give you 0 to 1 less than a.atk - a.atk will never be a possibility


    Math.randomInt(a.atk) + 1 will give you 1 to a.atk


    Math.randomInt(a.atk + 1) will give you 0 to a.atk





     






     



    Thanks for the clarity between the three!


    (a.atk+1) is what I've been using now.


    Thanks @Waterguy for the solution earlier! Cheers!
  16. Please, somebody can helpme? before the update, I had a skill that left the Tp of the actor at 0;


    After the program update, the formula "b.setTp(0);" gives an error, does anyone know what I can do?





    or maybe somebody has a skill with Tp damage?
  17. I'm looking for a skill that :


    Checks if a state is present on the target (if (target.isStateAffected(74))


    Deals the damage twice (and not double, because of the Math.randomInt formula that i don't want to simply double)


    Removes the state (target.removeState(74))


    Else : Deals normal damage and applies state 74 (target.addState(74))


    I'm starting to get the hang of how the language is used, but i don't know how to put it together, or what note tags to use ;


    Roaming through Yf's tips and tricks helped a bit, but still as confused in the end.


    If you had the time to explain the whys and hows, i'd appreciate ir greatly


    One week edit : Still hoping !


    EDIT :


    And is it possible to check is the target has recieved physical damage during the turn ?


    Still interested in the first question ^^
  18. 15 days later, still hoping  ^^
  19. From what I understand you want a attack that 'Hits' twice, but the first attack checks for the state and the second if that state is there


    To do that you would need to call a separate skill for the second attack (their Tips and Tricks that do this so you should be able to work that out)


    You may want to try writing up the code for both and posting them up if you need more help (easier to break down code then to guess how it should function) but hope this is some help as far as a starting point
  20. Sadly no, i want a skill that inflicts 10 damage and applies a state.


    BUT : if said state is already present, it removes the state and deals 20 damage


    I feel like that could tottaly be doable with only a simple skill and a if/when argument


    Did that make it clearer ?


    As for writing it, i'm at that stage when you see how things function, but you don't speak the language enough to form your own sentences.


    All i have are the bits and pieces written two posts above.


    Edit : The tips and tricks taught me the bits and pieces, but i often get lost in them.


    This is my first skill, hence the "help?" post.


    If no one can help, I'll probably do it on my own... but it'll take me weeks (has)