RMMV Damage Formula - ideas and help

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

  1. a6p

    a6p Veteran Veteran

    Messages:
    30
    Likes Received:
    8
    Location:
    Canada
    First Language:
    English
    It's in the formula you quoted. I don't know of any command that takes the equipped weapon's attack alone, so you're stuck using a.atk - a.paramBase(2)

    I could be wrong, but I don't think there's any way to do that.
     
  2. GammaVD

    GammaVD Veteran Veteran

    Messages:
    70
    Likes Received:
    3
    First Language:
    English
    There is a way to get weapon attack (in theory, haven't tried it yet), though if the user is a monster this will cause a fatal error (meaning the game will crash)

    var x[] = a.weapons //this gets a lets of all weapons equipped by 'a'

    for(i == 0; i <= x.length; i++) {

        value += x.params[paramId]; //this would be 3 for Atk

    }

     

    so it would read

    value = 0; var x[] = a.weapons; for(i == 0; i <= x.length; i++) {value += x.params[3]}; value

     

    Note: their may be errors with the symbols used and not sure if you can use 'for loops' but this would be the method
     
    Last edited by a moderator: Dec 27, 2015
  3. Pine Towers

    Pine Towers Knight Hospitaller Veteran

    Messages:
    466
    Likes Received:
    220
    Location:
    Brasil, Rio de Janeiro
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    So easy! All I had to do was thinking outside the box! Thank you, a6p.

    EDIT: New question! And yes, I tried everything mentioned in this thread before >_<''

    I'm trying to make a skill that inflcits a state + damage when hit. But My hit chance is inside the battle formula as follows:

    (Math.randomInt(20)+1+a.atk) > (10+b.def) ? (b.addState(34)); (Math.randomInt(a.atk)+1) : 0As you can see, it rolls a random number between 1 and 20, adds a.atk and check 10+b.def, if lower, deal 0 damage, else the damage.

    The important part is the

    (b.addState(34)); (Math.randomInt(a.atk)+1) : 0That comes after the mechanic resolution. I've tried anything to make it work. Using a plus sign as follows

    (b.addState(34)) + (Math.randomInt(a.atk)+1)Makes the state being applied, but several 0 pop-up after and no real damage is done. A + sign, switching the operators (putting the state last in the "hit" part of the formula), putting everything inside (), all that just gets me a single 0. Other skills that deals only damage work as intended.

    Help?
     
    Last edited by a moderator: Dec 28, 2015
  4. kurt91

    kurt91 Veteran Veteran

    Messages:
    39
    Likes Received:
    18
    First Language:
    English
    I'm trying to do something sort of like Pokemon. You know how in that game, you need to weaken an enemy to a certain point before you try to catch it? I want to do something sort of like that, only instead of getting the enemy on your side, you instantly kill it and drain their remaining HP and MP.

    Basically, I want to figure out how to turn this:

    if (b.hp <= (b.mhp*0.5))

    b.hp + b.mp

    into something that the damage formula box will recognize. I have a more elaborate plan for later on, but for now, I'd like to know how to make a skill dependent on the target's current health as a percentage of their maximum health.
     
  5. Smelipanda

    Smelipanda Veteran Veteran

    Messages:
    40
    Likes Received:
    35
    Location:
    Wisconsin
    First Language:
    English
    You will want to use if ((b.hp/b.mhp) <  .05) {Successful} else {Failure} replacing whats in the brackets with what you want it to do
     
  6. noctiluca

    noctiluca Veteran Veteran

    Messages:
    187
    Likes Received:
    167
    Location:
    California
    First Language:
    English
    Is there a way to count the total number of status effects applied to a target (or the caster), or would that have to be done with a separate script? I thought it would be interesting for some skills to have damage bonuses based on that, a very simple example would be like

    Caster attack + (total status effects on target * 100) - Target Defense

    Would give 100 bonus damage for every status effect. A nice type of offensive skill for debuff-based builds.
     
    Last edited by a moderator: Dec 28, 2015
  7. Riff

    Riff Eorzean Veteran

    Messages:
    261
    Likes Received:
    82
    Location:
    Brunei Darussalam
    First Language:
    English
    Primarily Uses:
    RMMV
    You can try this:

    var bonus = 0; for (var i = 0; i < b.states().length; ++i) { var state = b.states(); if (!state) continue; if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) bonus += 100; } value = a.atk * 4 + bonus - b.def * 2;Or if you're using Yanfly's Damage Core, you can use this. It'll look cleaner.

    <damage formula>var bonus = 0;for (var i = 0; i < b.states().length; ++i) {var state = b.states();if (!state) continue;if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) bonus += 100;}value = a.atk * 4 + bonus - b.def * 2;</damage formula>I'm inserting the default formula and states (with Yanfly's help). Feel free to adjust the bonus added and value formula as needed.

    Hope that helps! :)

    - Riff
     
  8. noctiluca

    noctiluca Veteran Veteran

    Messages:
    187
    Likes Received:
    167
    Location:
    California
    First Language:
    English
    Wow, that's awesome, thank you. I always like to main buff/debuff classes in games so I wanted to find more ways to add them to my own games.
     
  9. a6p

    a6p Veteran Veteran

    Messages:
    30
    Likes Received:
    8
    Location:
    Canada
    First Language:
    English
    Try

    if ((0.5 * b.def) < (Math.random() * a.atk)) {b.addState(34); Math.round(Math.random() * a.atk)} else {0}Otherwise, if you want the check and damage to be the same:

    d = (Math.random() * a.atk); if ((0.5 * b.def) < d) {b.addState(34); d} else {0}The top formula will deal random damage between 0 and a.atk

    The bottom formula will deal random damage between 0.5 * b.def and a.atk
     
    Last edited by a moderator: Dec 28, 2015
  10. moldy

    moldy Veteran Veteran

    Messages:
    190
    Likes Received:
    28
    First Language:
    English
    What's the formula to check if a target's stat is buffed? b.isBuffAffected(6) ?
     
  11. Riff

    Riff Eorzean Veteran

    Messages:
    261
    Likes Received:
    82
    Location:
    Brunei Darussalam
    First Language:
    English
    Primarily Uses:
    RMMV
    Yup!
     
  12. moldy

    moldy Veteran Veteran

    Messages:
    190
    Likes Received:
    28
    First Language:
    English
    Thanks! It worked. How do you remove a buff in the formula? For AGI, for example?

    Here's what I'm trying to do:

    Check if enemy's AGI is buffed? Inflict Stop and remove their AGI buff. If their AGI is not buffed, then just reduce their AGI.

    Here's what I have for the state that accomplishes this:

    a.isBuffAffected(6) ? a.addState(13) && a.removeBuff(6) : a.addDebuff(6,5)

    The problem I'm having is, the a.removeBuff(6) never activates. 
     
    Last edited by a moderator: Dec 31, 2015
  13. skyshadow235

    skyshadow235 Villager Member

    Messages:
    21
    Likes Received:
    1
    First Language:
    English
    $gameActors.actor(actorId).skills().contains($dataSkills[n]) is for checking if the actor has a certain skill. if I wanted to use a skill that checks if the actor does not have a certain skill would I put the "!" before contains, before the $ in $dataSkills, or before the variable in [n]?
     
  14. Riff

    Riff Eorzean Veteran

    Messages:
    261
    Likes Received:
    82
    Location:
    Brunei Darussalam
    First Language:
    English
    Primarily Uses:
    RMMV
    Try this:

    (!($gameActors.actor(actorId).skills().contains($dataSkills[n])))
     
  15. Crazy Rob

    Crazy Rob Villager Member

    Messages:
    15
    Likes Received:
    1
    First Language:
    English
    Okay, on the note of game actors, here's a formula I used in rmvxa for a basic attack-

    (a.atk*(((v[48+4*a.id]+v[50+4*a.id])*2)+2))-b.def

    it took two variables, determined by the actor's id, and used those to multiply the actor's attack. So, with actor id being one, the variables used would be 52 and 54. That way I could use one attack skill and call on multiple "Physical damage growth" and "Physical damage bonus" variables.

    Anyone have an idea on how to do this in MV?
     
  16. moldy

    moldy Veteran Veteran

    Messages:
    190
    Likes Received:
    28
    First Language:
    English
    How do I check if ALL states are added? Say...states with ID's 37, 38, 39?
     
  17. Riff

    Riff Eorzean Veteran

    Messages:
    261
    Likes Received:
    82
    Location:
    Brunei Darussalam
    First Language:
    English
    Primarily Uses:
    RMMV
    ((b.isStateAffected(37)) && (b.isStateAffected(38)) && (b.isStateAffected(39))) ? formula1 : formula2;

    Change b to a if you wanna check for skill user check. Change formula1 to when condition is true, change formula2 to when condition is false.

    Hope that helps! :)
     
  18. moldy

    moldy Veteran Veteran

    Messages:
    190
    Likes Received:
    28
    First Language:
    English
    Thanks! Worked like a charm.
     
  19. skyshadow235

    skyshadow235 Villager Member

    Messages:
    21
    Likes Received:
    1
    First Language:
    English
    Thanks that worked
     
  20. skyshadow235

    skyshadow235 Villager Member

    Messages:
    21
    Likes Received:
    1
    First Language:
    English
    New Question: I want to create a skill that checks if the user has a type of weapon not a specific weapon. I know that I can have it check the weapon ID in question with $gameActors.actor(actorId).equips().contains($dataWeapons[n]) for a specific actor, but even if it is for a specific actor; how do I check the type of weapon he has equipped instead of the weapon itself? like if the user/actor has a sword equipped do stuff or if the user has a bow equipped do stuff
     

Share This Page