Storing All Damages in a variable

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I was thinking if what can I do to store all the damages the enemy has caused the actor in a variable? When I do it on here:


Game_Battler.prototype.performDamage = function() {
};


But it is empty. So I don't know where to exactly look at.


Can someone pin point me to the right direction? Thanks in advance.
 

InBlast

The Mad Hamster
Veteran
Joined
Nov 2, 2015
Messages
288
Reaction score
88
First Language
French
The damages caused by the action or by enemy (all its attacks) ? By a specific enemy, or in total, by all of them ?
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
The damages caused by the action or by enemy (all its attacks) ? By a specific enemy, or in total, by all of them ?
The damages caused by the enemy. For example, the enemy used Attack and some other skills. I would like to store the value of all those damages in a variable. Reason for this is I want to use it later in game.
 

InBlast

The Mad Hamster
Veteran
Joined
Nov 2, 2015
Messages
288
Reaction score
88
First Language
French
By a specific enemy ? something like a boss ?


Are you using some of Yanfly's plugins ?
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
By a specific enemy ? something like a boss ?


Are you using some of Yanfly's plugins ?


Every enemy. :)

No, I want this to work in vanilla.
 

InBlast

The Mad Hamster
Veteran
Joined
Nov 2, 2015
Messages
288
Reaction score
88
First Language
French
I don't know if this works but try adding this after each damage formula used by the enemy :


;$gameVariables.setValue(ID_of_your_varible, $gameVariables.value(ID_of_your_varible) + formula)


I don't remember if you need to use "," or ";" at the start of the formula. Try both.


I know a really easier way but yu will need plugins for that.
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Alright, let's try that. 


But in any workarounds, I would like this to be inside a plugin rather than the custom formula.
 

InBlast

The Mad Hamster
Veteran
Joined
Nov 2, 2015
Messages
288
Reaction score
88
First Language
French
Yanfly's Battle statistics plugin do that without using InGame variable. It calculate the damages taken by every actor (one calculation per actor).
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
449
Reaction score
150
First Language
Not English
Primarily Uses
N/A
Alright, let's try that. 


But in any workarounds, I would like this to be inside a plugin rather than the custom formula.


I am in hurry so you can make it plug in or wait for me when I am free


In rpg_windows.js line 5164


Window_BattleLog.prototype.displayHpDamage = function(target) {
    if (target.result().hpAffected) {
        if (target.result().hpDamage > 0 && !target.result().drain) {
            this.push('performDamage', target);
            var value = $gameVariables.value(X);
            var damage = target.result().hpDamage
            if (target.isActor()){$gameVariables.setValue(X,value+damage);}
        }
        if (target.result().hpDamage < 0) {
            this.push('performRecovery', target);
        }
        this.push('addText', this.makeHpDamageText(target));
    }
};
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
It works properly, mrcopra! Now I can use the variable to do something useful. Thanks!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I decided to rework my main character's portrait and logo at the same time....


Honestly I was going to use a lot more yellow in the game along with red and white to represent characters.... But yellow really is just like.... the ugliest color in the color pie. So er... I'm going to use blues/purples in place of it. :LZSwink:
XwwX OMG! Only 4 more weeks till I can leave my crappy job and never ever go back! I am SO freaking excited!!!
Sometimes, it's so hard to resist
"this boss is too easy, what if I add more gimmicks". Then I remember most of my players might be already dying fighting the boss.
You certainly should show love and recognition to teammates who have achieved great success! Congrats Eli!
Just 2 Days of no Internet and I made more Progress in my Game than last 2 Weeks combined. Now I know, Internet makes me a Lazy person.. :D

Forum statistics

Threads
98,076
Messages
949,098
Members
129,358
Latest member
AbidNaga
Top