RMMV Damage Formula - ideas and help

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

  1. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,451
    Likes Received:
    1,050
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    Thanks. Modified it for smaller numbers.
     
  2. okugi

    okugi Villager Member

    Messages:
    28
    Likes Received:
    6
    First Language:
    English
    Is there an easy way to express 0.5 < a.atk/b.def < 2.5  or would i have to make nested if/else statements?
     
    Last edited by a moderator: Nov 1, 2015
  3. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    Math.min(Math.max((a.atk/b.def),0.5),2.5)
     
  4. GutshotStr8

    GutshotStr8 Veteran Veteran

    Messages:
    51
    Likes Received:
    21
    First Language:
    English
    It's actually "$gameVariables.value(n)" (using parentheses rather than square brackets) to reference the value of a game variable, in case anyone else has been trying to figure this out.
     
    Zarsla likes this.
  5. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    I feel like I'm doing this right but I'm not getting the right results, so maybe you guy can help!

    I'm trying to make a fairly simple skill that deals HP damage, then returns the damage dealt to the user's MP. The problem right now is that it is dealing 0 damage every time no matter the stats.

    Here's my skill:

    var x = (a.mat - b.mdf); a.gainMP(x); x

    So what am I missing? Thanks in advance!
     
  6. YouKnowA

    YouKnowA Villager Member

    Messages:
    10
    Likes Received:
    6
    First Language:
    English
    Sweet! Glad I could help.

    I'm gonna' guess the mdf is cancelling out the mat. But, someone more skilled than me might have a better explanation.

    var x = (2 * a.mat) - b.mdf; a.gainMp(x); xTry this equation. In the dropdown below the damage formula, I had to turn the variance to 0% to make it behave a little more like how I would expect it to work.
     
  7. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    I think you should just not use the "var" at the beginning, and also it's gainMp and not gainMP (note the upper case) so:

    Code:
    x=(a.mat-b.mdf); a.gainMp(x); x
     
  8. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    Thanks for the replies.

    It wasn't the stats, and it works with or without the var... it was actually the capitalization that was killing it. Oops!!! Such a newbie mistake! Haha. Anyway, it works perfectly now!

    Thanks again!

    EDIT: New question!

    How can I target a different character in the party, besides a or b, without it being actor specific? Let's say I want a skill that deals damage and heals every party member except the caster for an amount equal to the damage dealt? So...

    x = (a.tk - b.def); ALL_OTHER_PARTY_MEMBERS.gainHp(x); x

    What should ALL_OTHER_PARTY_MEMBERS be replaced with?
     
    Last edited by a moderator: Nov 2, 2015
  9. Noferatsi

    Noferatsi Level 10 Veteran

    Messages:
    59
    Likes Received:
    11
    Location:
    Firelink Shrine, Lordran
    First Language:
    English
    How would I make the user take more damage with the first formula? 
     
  10. VHStapes

    VHStapes Game Designer Veteran

    Messages:
    57
    Likes Received:
    7
    Location:
    Vashon, Wa
    First Language:
    English
    I believe you would change

    a.gainHp(-Math.floor((a.mhp/10)))to

    a.gainHp(-Math.floor((a.mhp/5)))Or something like that. Essentially, divide by less, and it'll deal more damage.
     
    Last edited by a moderator: Nov 2, 2015
  11. JumbocactuarX27

    JumbocactuarX27 Veteran Veteran

    Messages:
    86
    Likes Received:
    39
    First Language:
    English
    I just got around to testing it out and you actually need to call this:

    $gameVariables.value(n)not this:

    Code:
    $gameVariable[n]
     
    Nuhada and Liak like this.
  12. Mirai Ko

    Mirai Ko Veteran Veteran

    Messages:
    44
    Likes Received:
    9
    First Language:
    English
        So far, it seems that in order to add to a variable in the damage formula you can use

     Which feels like a round about way of doing it, but I can't for the life of me understand

    why v[n] += 10 won't work by itself, while v[n] = 10 does.
     
  13. Professor_Ruffleberg

    Professor_Ruffleberg Villager Member

    Messages:
    15
    Likes Received:
    0
    I'm trying to have a skill with a guaranteed critical. In VX ACE you could use: b.result.critical = true

    This doesn't work in MV and I can't work out why.

     
    Last edited by a moderator: Nov 3, 2015
  14. Daemien

    Daemien Veteran Veteran

    Messages:
    48
    Likes Received:
    10
    First Language:
    English
    I use a.atk * 2 - b.def

    My actors start off at about 60 HP though and gain it at a rate of 10 and below/ per level
     
  15. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    159
    Likes Received:
    41
    First Language:
    English
    From what I had of: b.elementRate(<insert ID of fire element>)>=2?(b.addDebuff(2,1)):0;100+(a.mat*2)-(b.mdf*2)

    Is there a syntax to put multiple conditions in a formula that goes like this:

    if Element Rate of Fire = 100%, add debuff, then do damage

    if Element Rate of Fire > 100%, add state, then do damage
     
    Last edited by a moderator: Nov 2, 2015
  16. Nuhada

    Nuhada Villager Member

    Messages:
    27
    Likes Received:
    14
    First Language:
    French
    Just put things like if/elseif/else, wich is by syntax (condition)?(do):(elseif)?do:doelse; where the (condition) and the (elseif) are the conditions you want.

    By following your exemple that makes:

    r=<formula>;(b.elementRate(1)>1)?(b.addDebuff(x,x)):(b.elementRate(1)==1)?(b.addState(x)):0;rNote: I'm not so sure about the "==1", never used it in a formula so it may be "=1" or even "===1"
     
    MikeMakes likes this.
  17. MikeMakes

    MikeMakes Veteran Veteran

    Messages:
    159
    Likes Received:
    41
    First Language:
    English
    Thank you again, Nuhada!

    I confirmed that it is: "==1"

    Also, there are some unneeded parentheses, so it's:

    r=<formula>;b.elementRate(1)>1?(b.addDebuff(x,x)):b.elementRate(1)==1?(b.addState(x)):0;r
     
    Nuhada likes this.
  18. JumbocactuarX27

    JumbocactuarX27 Veteran Veteran

    Messages:
    86
    Likes Received:
    39
    First Language:
    English
    Just wanted to point out for learning's sake, the == and === are for testing equality (in the formula given, b.elementRate(1) is equal to 1).

    It is not = because that'd be trying to assign the value on the right to the function output on the left and syntactically that doesn't make sense.

     == and === are pretty much identical for the purposes we're using them for here in the damage formula thread, but it's best to be consistent with your use of them.
     
    MikeMakes likes this.
  19. Cassta

    Cassta Villager Member

    Messages:
    15
    Likes Received:
    2
    Location:
    The Internet
    First Language:
    English
    I know I'm a little late to the party, but using the stock health values and whatnot, I use this formula for magic skills that are meant to do a little better than normal attacks. 

    Code:
    a.atk * b.def * 0.2
     
  20. Hoppy

    Hoppy Veteran Veteran

    Messages:
    326
    Likes Received:
    54
    First Language:
    English
    I need a formula that works with an agility focused character that does damage based off the actor's agility * atk, I tried one but it ended in misses.
     

Share This Page