RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 19 of 77 View original ↗
  1. Cristovao said:
    Not the one, but thank you on your answer. Is it possible to do the inverse? Get the "a.WeaponAttack" without the a."base"attack? This is because in my damage formula a.atk defines hit chance and "a.WeaponAttack" gets the damage.
    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)

    Cristovao said:
    On a second question, is it possible to call Miss/Evade on the damage formula? Like ? a.matk : Miss/Evade, so to avoid too many 0s during battle?
    I could be wrong, but I don't think there's any way to do that.
  2. 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
  3. a6p said:
    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.
    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?
  4. 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. kurt91 said:
    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.
    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. 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.
  7. noctiluca said:
    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.
    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. 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. Cristovao said:
    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?
    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
  10. What's the formula to check if a target's stat is buffed? b.isBuffAffected(6) ?
  11. moldy said:
    What's the formula to check if a target's stat is buffed? b.isBuffAffected(6) ?
    Yup!
  12. Riff said:
    Yup!
    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. 
  13. $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. skyshadow235 said:
    $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]?
    Try this:

    (!($gameActors.actor(actorId).skills().contains($dataSkills[n])))
  15. 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. How do I check if ALL states are added? Say...states with ID's 37, 38, 39?
  17. moldy said:
    How do I check if ALL states are added? Say...states with ID's 37, 38, 39?
    ((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. Riff said:
    ((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! :)
    Thanks! Worked like a charm.
  19. Riff said:
    Try this:

    (!($gameActors.actor(actorId).skills().contains($dataSkills[n])))
    Thanks that worked
  20. 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