RMMV Damage Formula - ideas and help

Discussion in 'RPG Maker MV' started by Shaz, Oct 25, 2015.

  1. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    159
    Likes Received:
    41
    First Language:
    English
    @saikais: I'm having the same problem, too. I am doing some balancing and keeping defense stat low for now until I think up of something. Maybe keep a low modifier like 1.5 for the attacker's attack?

    I am also wondering is there a syntax to do the following:

    add states 2 through 5
     
    Last edited by a moderator: Nov 9, 2015
  2. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English
    Hi, I was curious on how you would call that in the Damage Formula box. (also how to set that up as a plug-in so I can call it. I don't know Javascript quite yet and would like some guidance. Thanks!
     
  3. ChaoticShadow24

    ChaoticShadow24 The Most Chaotic Veteran

    Messages:
    186
    Likes Received:
    6
    First Language:
    English
    Can someone please tell me how the 100 + thing works?

    For example: 100 + a.mat * 2 - b.mdf * 2

    From my limited understanding of this, it's saying 2 x User's Magic Attack -minus- Opponents Magic Defence ... x2?

    So...

    If you had 50 Magic Attack, x 2 would equal 100 Magic attack? Then the game would deduct whatever 100 Magic Attack equals in damage to the opponent?

    I'm still not sure about it, and I don't know what the 100 + part means.

    Thanks!

    Please explain it in the easiest way possible.
     
  4. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    159
    Likes Received:
    41
    First Language:
    English
    I think the "100 +" ensures a minimum damage of 100 no matter what (to be affected by variance, elemental rate, and critical rate).

    That's because if the Attacker and Target's stats are exactly the same, they will cancel out to zero.

    e.g. 100 + (50*2) - (50*2) = 100
     
    Last edited by a moderator: Nov 10, 2015
  5. luigiman2201

    luigiman2201 Villager Member

    Messages:
    16
    Likes Received:
    2
    First Language:
    English
    The 100 + just adds 100 damage flat. some examples:

    user has 50 mat (magic attack), opponent has 20 mdf (magic defense)

    100 + a.mat * 2 - b.mdf * 2With the order of operations (multiplying goes before subtracting or adding), this example gives:

    100 + 50 * 2 - 20 * 2
    Code:
    100 + 100 - 40 = 160 Damage
    Another example:

    User's mat = 65, Target's mdf = 77

    100 + a.mat * 2 - b.mdf * 2
    Code:
    100 + 65 * 2 - 77 * 2
    Code:
    100 + 130 - 144 = 87 Damage
    Let me know if there's anything you don't understand, and i'll try to explain
     
    Last edited by a moderator: Nov 12, 2015
  6. Zarsla

    Zarsla Veteran Veteran

    Messages:
    680
    Likes Received:
    195
    First Language:
    English
    I'm trying to have my attack skill have different formulas depending on the class. 1 class uses both mat & atk, another uses mat and the other is atk. I've tried doing it by using this:

    a._classID === 1 ? a.atk + a.mat - b.def + b.mdf : a._classID ==== 2 ? a.atk * 4 - b.def * 2 : a._classID === 3 ? a.mat * 4 - b.mdf : 0

    but I keep getting a syntax error it says unexpected syntax token *
     
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,307
    Likes Received:
    11,118
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You have an extra = in there for the second comparison, but I suspect that's just a typo.


    Try this:

    a._classId === 1 ? (a.atk + a.mat - b.def + b.mdf) : a._classId === 2 ? (a.atk * 4 - b.def * 2) : a._classId === 3 ? (a.mat * 4 - b.mdf) : 0The only difference I've made there is to fix the ==== and to put some brackets around things. It seems to work okay for me.
    If that doesn't work, let us know how you're testing, and where it's saying that error message (because by default you don't see a message if you have an error in the damage formula - it just defaults to 0).


    Two other potential issues with this ...


    - if you're modifying the Attack skill (skill #1), be aware that enemies use it too, and enemies don't have classes, so they will always hit for 0


    - I'm not sure if you intend to + b.mdf in that first condition - if you want to start with the actor's atk and mat, and then take away the enemy's def and mdf, you would need to do one of the following:


    a.atk + a.mat - b.def - b.mdf


    a.atk + a.mat - (b.def + b.mdf)


    Otherwise you're taking away their def but adding back their mdf
     
  8. Zarsla

    Zarsla Veteran Veteran

    Messages:
    680
    Likes Received:
    195
    First Language:
    English
    @Shaz Thanx, I relized that there was a syntax error I kept writing classId as classID, where I should have written as classId.

    So it seems syntax error unexpected token * means you've typed/wrote the forumula/scripting incorrectly.
     
  9. Jeffafa

    Jeffafa Multi-colored Mage Veteran

    Messages:
    42
    Likes Received:
    1
    Location:
    New Orleans
    First Language:
    English
    So damage formulas and map designing are my two biggest weaknesses when it comes to this program. And reading through this topic makes me feel even more inept at damage formulas lol.

    I honestly have no idea where to even start. I know I want the game to begin with low damage, and end with high damage; magic casters being able to deal ~20,000 damage (with their stats/equipment pushed to the absolute max). Ideally it would hover around the traditional 9999 near end-game with average stats/gear, though that's not a make-or-break thing for me.

    I haven't even begun to start working on stats for characters/enemies though, so should I seek help working on that first? Or should I figure out a base formula that I can work with and mold everything else around that?

    I started a project a few years ago in which I was just using existing stats and damage formulas from other games, like Final Fantasy. I don't want to do that though. It feels low and I don't want to risk any trouble or anything for using data from something else.

    (Also, I didn't know if I should post this here since a ton of people are working out various formulas already, or create a new topic. So I apologize if I should have done the latter.)
     
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    37,307
    Likes Received:
    11,118
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    This is not about damage formulas. This is about setting your enemy stats and your actor stat progression. Please do create a new topic. This thread is JUST for the damage formula box on skills and items.
     
  11. Jeffafa

    Jeffafa Multi-colored Mage Veteran

    Messages:
    42
    Likes Received:
    1
    Location:
    New Orleans
    First Language:
    English
    Gotcha. I apologize. I do very much need damage formula assistance, but I suppose the stats will have to come first. Thanks.
     
  12. RockEsper

    RockEsper Villager Member

    Messages:
    19
    Likes Received:
    5
    First Language:
    English
    I'm trying to make a damage formula that deals x1 damage if the user's luck is at least 10, x2 damage if 20, x3 damage if 30, and x4 damage if 40+. And it should go no higher than x4, even if luck is 50 or more.

    Would it be something like, damage * floor(a.luk / 10)? Not sure if that's how to use floor, and it doesn't cover the x4 cap.

    Please help? :D
     
    Last edited by a moderator: Nov 12, 2015
  13. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    Lots of edits, here's the best solution, I think.

    Code:
    if (a.luk > 9) {x = Math.min(Math.max(Math.floor(a.luk / 10), 1), 4)} else {x = 0}; a.atk * x - b.def
     
    Last edited by a moderator: Nov 12, 2015
  14. RockEsper

    RockEsper Villager Member

    Messages:
    19
    Likes Received:
    5
    First Language:
    English
    Oh, well thanks to you now I understand if statements, so I think this would work and be simpler...?

    Code:
    if (a.luk > 40) {x = 4} else {x = Math.floor(a.luk / 10)}; a.atk * x - b.def
     
    Last edited by a moderator: Nov 12, 2015
  15. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English
    Still curious on the set up for a plugin call for custom damage formula. Much appreciated.
     
  16. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    In your original post you said you wanted them to do 1x damage only if they had at least 10 luck, so mine accommodates for that, but otherwise yes yours is better.

    Ifs are super cool! Here's a quick mock-up else/if statement, just for reference, because they are also really useful.

    if (argument) {do this} else if (different argument) {do this} else {do this}You can keep chaining the "else ifs" as many times as you need, as long as you end it with a plain "else" eventually.
     
  17. Chaos Avian

    Chaos Avian Abyssal Wing Restaff

    Messages:
    3,231
    Likes Received:
    780
    Location:
    Currently fighting demon hoards for fun.
    First Language:
    English
    I have a skill that does damage based on the difference between the max HP and current HP of the party, what damage formula would I use to achieve this?
     
  18. Vanguard

    Vanguard Villager Member

    Messages:
    25
    Likes Received:
    5
    First Language:
    English
    I have a small numbers damage that i use from ace and it seems to work in mv just as well. 0 + a.atk * 0.5 - b.def * 0.3, if you have guys starting at 30 to 50 hp this works well enough for me. the magic damage I really haven't played with yet.
     
  19. Merancapeman

    Merancapeman Veteran Veteran

    Messages:
    39
    Likes Received:
    17
    First Language:
    English
    I can't wait for there to be a better explanation of the formulaic system, such as what is and isn't allowed, or what terms do what. For instance, I sat here and tried to figure out a Huskar-esque (DOTA2 character) attack would look like in terms of a.atk * 4 + (a.hp {divided? no idea what sign you use}/2) - .... Ok, so basically what I'm trying to say is user's attack times four (like a normal attack) plus the user's current hp divided by two, subracted by the regular physical attack defense.

    Not so sure how to achieve that... Or what all the terms are.
     
    Zarsla and VHStapes like this.
  20. Bob423

    Bob423 Warper Member

    Messages:
    2
    Likes Received:
    0
    Location:
    Earth
    First Language:
    English
    How is the critical hit rate percentage (and other percentage based parameters) handled in code? I'm assuming 25% = 0.25, but I'd like to make sure and I'm not sure where to find out.
     

Share This Page