Store damage somewhere to be used by another skill?

Hi 😉


Is there a way to store the damage a certain actor receives?


For example: A skill where a certain actor would deal damage depending on what he has received during the last 3 turns


Any solution for this? Thank you and sorry for my english!
yes, you need javascript code inside the damage formula to store its result into a regular game variable, and you can access that as well.


However, cross-referencing damage between different skills, different targets and different users will require extremely carefull coding if you want to do that by damage formula.


It is probably  be better to have a plugin written for storing those values


I've moved this thread to Plugin Request. Please be sure to post your threads in the correct forum next time. Thank you.
@Andar I think I could do it with just the variable storation, since it can be used for another damage formula.


Do you know how I would store it in a variable?
Bump
Whit yanfly plugins in lunatic mode i think... you can do somthing like this
Whit yanfly plugins in lunatic mode i think... you can do somthing like this

It would be great to know how though...


Anyway thank you for pointing it out, but I don't know how I could do it using his plugins :/
It would be great to know how though...


Anyway thank you for pointing it out, but I don't know how I could do it using his plugins :/

I think this is similar to what do you request:
@takashi1kun Thank you for finding it for me! I think it can be used, however, I don't know the exact commands for it and thus, not knowing what to do with it 😛
Maybe you can store the value into a variable like that. That's from Buff&State Core eval effecs, so you will need a passive state to grab the damage.


<Custom Respond Effect>


if (value > 0) {


var DmgStorage = Math.floor(value * 1);


$gameVariables.setValue(1, $gameVariables.value(1) + DmgStorage);


}


</Custom Respond Effect>


I'm still learning, so maybe theres better ways to do it. :/
@lokirafael It's very possible with what you showed me! However, as you said, it can be really tricky. So if there's no solutions presented after a while, I'll go withthis and play around it to make it work 🙂
bump
Yea that's easy enough for me to do. I have a question though, is the damage from the last 3 turns accumulated or stored separately
Yea that's easy enough for me to do. I have a question though, is the damage from the last 3 turns accumulated or stored separately



It should be calculated separately using variables to allow more flexibility. It can however be accumulated if you wish, but variables can be added from each other to form the final value anyway. 


And you said that it should be easy for 3 turns, is it harder if I ask to be more turns (like an entire battle)? If it's harder, don't do it, it's just a suggestion to allow more flexibility.


Lastly, these variables should be stored separately from actors and/or enemies. An example would be:


-Actor 1 received 250 damage


-Actor 2 received 300 damage


Then Actor 2 uses a skill that inflicts the equal amount of damage received to him during the battle (similar to Bravely Default)


Anyway, do it how you see fit and I won't complain about it, you are awesome regardless just from accepting my request 😉
Bump
Bump
Bump
Requires YEP Battle Statistics

Code:
/*:
 * @plugindesc
 * @author DreamX
 * @help
 * ============================================================================
 * How To Use
 * ============================================================================
 * Use <DamageTakenVariable: x> with x as the variable id to set a variable 
 * that tracks how much damage an actor took during the battle.
 * 
 * Alternatively you can access an actor's damage in the battle using a class 
 * variable (this is not the game variable you can use in the editor).
 * 
 * The variable needed to access the amount of damage taken in the battle is 
 * _damageTakenThisBattle
 * 
 * for example, $gameParty.battleMembers()[0]._damageTakenThisBattle for the 
 * first battle party member
 * 
 * the variable needed to access the array of separate damage taken is 
 * _damageTakenThisBattleArray
 * 
 * Every instance of damage will be stored there separately.
 * ============================================================================
 * Terms Of Use
 * ============================================================================
 * Free to use and modify for commercial and noncommercial games, with credit.
 * ============================================================================
 * Credits
 * ============================================================================
 * DreamX
 */

var Imported = Imported || {};
Imported.DreamX_StoreDamage = true;

var DreamX = DreamX || {};
DreamX.StoreDamage = DreamX.StoreDamage || {};

var parameters = PluginManager.parameters('DreamX_StoreDamage');

DreamX.StoreDamage.Game_Actor_onBattleStart = Game_Actor.prototype.onBattleStart;
Game_Actor.prototype.onBattleStart = function () {
    DreamX.StoreDamage.Game_Actor_onBattleStart.call(this);

    var variable = this.actor().meta.DamageTakenVariable;
    if (variable) {
        variable = parseInt(variable.trim());
        this._damageTakenVariable = variable;
        $gameVariables.setValue(variable, 0);
    }

    this._startingDamageTaken = this.totalDamageTaken();
    this._damageTakenThisBattle = 0;
    this._damageTakenThisBattleArray = [];
};

DreamX.StoreDamage.Game_Actor_increaseTotalDamageTaken = Game_Actor.prototype.increaseTotalDamageTaken;
Game_Actor.prototype.increaseTotalDamageTaken = function (value) {
    DreamX.StoreDamage.Game_Actor_increaseTotalDamageTaken.call(this, value);

    if (this._damageTakenThisBattle !== undefined) {
        this._damageTakenThisBattle += value;
        this._damageTakenThisBattleArray.push(value);
        if (this._damageTakenVariable) {
            $gameVariables.setValue(this._damageTakenVariable,
                    this._damageTakenThisBattle);
        }
    }

};
@DreamX Yes! Thank you! Last question!


<DamageTakenVariable: x>


Where does this go? In the skills notebox?


You're being a life saver, thank you
@DreamX Yes! Thank you! Last question!



<DamageTakenVariable: x>


Where does this go? In the skills notebox?


You're being a life saver, thank you

actor notebox
actor notebox

Thank you! Have a nice day 😉  or night? whatever you know what I mean 😛  

Original thread: https://forums.rpgmakerweb.com/threads/store-damage-somewhere-to-be-used-by-another-skill.60277/