Store damage somewhere to be used by another skill?

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
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!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
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.
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
@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?
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV

takashi1kun

spaghetti god code
Veteran
Joined
Jul 27, 2014
Messages
104
Reaction score
39
First Language
Spain Spanish
Primarily Uses
Whit yanfly plugins in lunatic mode i think... you can do somthing like this
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
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 :/
 

takashi1kun

spaghetti god code
Veteran
Joined
Jul 27, 2014
Messages
104
Reaction score
39
First Language
Spain Spanish
Primarily Uses
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:
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
@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 :p
 
Last edited by a moderator:

lokirafael

Veteran
Veteran
Joined
Jun 25, 2012
Messages
153
Reaction score
80
First Language
Portuguese
Primarily Uses
RMMV
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. :/
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
@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 :)
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
826
First Language
English
Primarily Uses
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
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
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 ;)
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
826
First Language
English
Primarily Uses
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);
        }
    }

};
 
Last edited by a moderator:

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
@DreamX Yes! Thank you! Last question!


<DamageTakenVariable: x>


Where does this go? In the skills notebox?


You're being a life saver, thank you
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,545
Members
137,834
Latest member
EverNoir
Top