Store damage into a variable

● ARCHIVED · READ-ONLY
Started by Fernyfer775 4 posts View original ↗
  1. Hello, so I'm trying to figure out how I could store all the damage from an attack done into a variable.

    This is what I'm trying to do:

    Character X has an attack that deals damage to all enemies, and then heals the whole party for a portion of that damage done.

    I know of a few workarounds with calling common events and storing character stats to decide on damage/healing, but that only really works for me if there is just one enemy.

    Any ideas or solutions to this?

    Thank you for your help!

    EDIT: While I'm at it, anyone know how to give a damage formula an "if/else statement" for...

    Heal: Restores X amount of HP, but if Heal crits, it adds Y state to target?
  2. Yanfly's Damage Core and Critical Control plugins give you the ability to add code directly into a skill's notebox. However, I don't know anything about JavaScript so I can't tell you how to do the actual coding. In theory though that plugin should do what you need it to.
  3.  Thinking about it (and spending alot of time fighting with Variables in Damage Formulas) I think there might be a way to do it.

    For simplicity, let's say the damage formula to all enemies is a.atk - b.def, and the Variable you want to store the total damage in is 7.

    x = a.atk - b.def; y = v[7]; y += x; v[7] = y; x
     In theory, since the damage formula is run for each enemy, variable 7 should get increased each time by the damage result of each hit.

    After which you'd have to call a common event that force actions the same actor to use a skill with

    x = v[7] * 0.5; x
    To do 50% of the damage dealt or whatever ratio you want.
  4. @Mirai: I'm going to try that out and let you know if it works :)