Damage formula help.

Discussion in 'RPG Maker MV' started by RHachicho, May 28, 2017.

  1. RHachicho

    RHachicho Veteran Veteran

    Messages:
    264
    Likes Received:
    125
    Location:
    Basildon, United Kingdom
    First Language:
    English
    Hi there I'm trying to set a skill up so that it does significantly more damage if a target is effected by a certain state. However the skill just seems to do zero damage. I can only think I must be making some kind of syntax error but for the life of me the syntax appears correct. This is a cut and paste from my damage formula box .. I would appreciate any help.

    if b.isStateAffected(20) {a.atk * 8} else {a.atk * 1}
     
    #1
  2. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    590
    Likes Received:
    186
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    If you only want it to be like that, just change to this:
    b.isStateAffected(20) ? a.atk * 8 : a.atk * 1
     
    #2
    RHachicho likes this.
  3. RHachicho

    RHachicho Veteran Veteran

    Messages:
    264
    Likes Received:
    125
    Location:
    Basildon, United Kingdom
    First Language:
    English
    Thank you .. that worked. I'm guessing the arguments are condition ? yes:no?
     
    #3
  4. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    590
    Likes Received:
    186
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    That's right. For a complex one, you might need to use if-then. You can take a look HERE for some more examples about Damage Formula.
     
    #4
    RHachicho likes this.
  5. RHachicho

    RHachicho Veteran Veteran

    Messages:
    264
    Likes Received:
    125
    Location:
    Basildon, United Kingdom
    First Language:
    English
    Another question if you don't mind. I'm trying to create an assassination skill that does X damage for every negative state on the enemy. Can I include multiple formula in one box? I tried using common events. But since you can't designate an in combat target with a common event conditional it won't work.

    I basically just need some way to make the game count the number of states on the target. Either within the damage formula. Or just output it to a variable. I tried this

    (b.isStateAffected(4) ? r = a.atk 5: r = a.atk * 1) + (b.isStateAffected(8) ? r = a.atk 5: r = a.atk * 1) + (b.isStateAffected(9) ? r = a.atk 5: r = a.atk * 1)

    Just for 3 states and it doesn't work.
     
    Last edited: Jun 14, 2017
    #5
  6. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    590
    Likes Received:
    186
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    I guess you cannot do that. I think i have another method for you, but this is a bit complicated.
    If you are using Yanfly's Buffs & States Core plugin, you can also use this State Categories plugin: http://yanfly.moe/2016/04/03/yep-89-state-categories/

    The State Categories Plugin provides you a way to group many states into one using this note tag <Category: text>. For example, i group all negative states into 1 called "Ailment", so i put this note tag in every single negative state: <Category: Ailment>

    This plugin also provides you a function to return the number of categorized states: battler.getStateCategoryAffectedCount('text');

    So if you want to return the number of negative states that is categorized in "Ailment" group and is currently affecting your target, put this in your damage formula:
    b.getStateCategoryAffectedCount('Ailment')

    For example, the damage is equal to your ATK * number of negative states on target, the damage formula should be: a.atk * b.getStateCategoryAffectedCount('Ailment')

    I haven't tested this yet so i can't guarantee that it will work.
     
    #6
  7. Andar

    Andar Veteran Veteran

    Messages:
    28,613
    Likes Received:
    6,568
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @JamesRyan

    Please do not use red or blue text in your posts as those colors are reserved for mod use

     
    #7
  8. RHachicho

    RHachicho Veteran Veteran

    Messages:
    264
    Likes Received:
    125
    Location:
    Basildon, United Kingdom
    First Language:
    English
    Scratch that post .. I think you just might have found my solution! .. I'm going to do some more testing .. But I think this is it!!

    Testing complete .. the principle is sound. This completely works! Thank you ever so much!
     
    Last edited: Jun 14, 2017
    #8
  9. JamesRyan

    JamesRyan Game Designer Veteran

    Messages:
    590
    Likes Received:
    186
    Location:
    Vietnam
    First Language:
    Vietnamese
    Primarily Uses:
    RMMV
    Sorry i just wanted to highlight texts. Gonna use other colors next time.
     
    #9

Share This Page