Increase kill count and place it on a Variable?

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
240
Reaction score
41
First Language
English Spanish
Primarily Uses
Hi! Im using ths plugin: http://yanfly.moe/2015/12/06/yep-39-battle-statistics/

This plug in stores the kill count for every actor. What I need is to place the kill count on a variable when a SPECIFIC actor makes the kill.

Sounds easy but I cant get it to work with this code (the code is storing every kill count, not only the ones Actor 11 kills.)

Code:
 Game_Actor.prototype.increaseKillCount = function(value) {
        user = $gameActors.actor(11);
        value = value || 1;
        if (this._killCount === undefined) this.initBattleStatistics();
        this._killCount += value;
        if (user.actorId() === 11) {
        $gameVariables.setValue(105, $gameVariables.value(105) + 1) };
};
Thanks!!
 

Llareian

Jack of All Trades, Master of None
Veteran
Joined
Jan 26, 2017
Messages
604
Reaction score
1,421
First Language
English
Primarily Uses
RMMV
Your first line
Code:
user = $gameActors.actor(11);
changes the user to actor 11, so it always thinks actor 11 performed the kill.
 

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
240
Reaction score
41
First Language
English Spanish
Primarily Uses
I placed that first line because without it, i get the error "user is not defined" , what would you suggest?
 

Llareian

Jack of All Trades, Master of None
Veteran
Joined
Jan 26, 2017
Messages
604
Reaction score
1,421
First Language
English
Primarily Uses
RMMV
I believe that "this" will refer to the actor in question, so try the following:
Code:
 Game_Actor.prototype.increaseKillCount = function(value) {
        value = value || 1;
        if (this._killCount === undefined) this.initBattleStatistics();
        this._killCount += value;
        if (this.actorId() === 11) {
            $gameVariables.setValue(105, $gameVariables.value(105) + 1);
        }
};
EDIT: Also, you can call actor 11's kill count through a script call:
Code:
$gameActors.actor(11)._killCount
 

Magusalfador

Veteran
Veteran
Joined
Jun 15, 2014
Messages
240
Reaction score
41
First Language
English Spanish
Primarily Uses
As always, I appreciate it!! Perfect!!!
 

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,854
Messages
1,016,998
Members
137,562
Latest member
tamedeathman
Top