MV Issue with "Game_Actor" & "this._equips[]"

Ok, well i am trying to add something to "Game_Actor"'s "this._equips[]", but the default "rpg_object" actionChain,seems to overwrite my "EDIT"..

here is the stuff which i wanna add:
JavaScript:
Game_Actor.prototype.srpgEquipSlotsUpgrade = function() {
    this._battleUnit = 'actor';
    if (this._equips) {
        if (this._equips[0]) {this._equips[0].equipIsGone = false};
        if (this._equips[1]) {this._equips[1].equipIsGone = false};
        if (this._equips[2]) {this._equips[2].equipIsGone = false};
        if (this._equips[3]) {this._equips[3].equipIsGone = false};
        if (this._equips[4]) {this._equips[4].equipIsGone = false};
    }
};

Thats just an simple example, for what i wanna do..
in this case the script to trigger this small function would be:

Game_Actor.prototype.srpgEquipSlotsUpgrade.call(this);
or
this.srpgEquipSlotsUpgrade();

(depending on where i use it)


However, i think i need to overwrite another ,
(default "rpg_object"-)
"Game_Actor"- function, and add it there to make my Edit permament.
( i dont want this edit to be triggered more than once. this would set the switch to false with every update )

My Question is:
What is the best Approch do make that happen?
if anybody has some ideas, that would be very welcome.thx



edit
and just to be clear ,i need these switches and cant use:
"if (this._equips[0]. _ItemId === 0)" instead

these switches are supposed to store the info, if an Equip was "Stolen" or "Broken
" no matter if the slot is empty or not
well i solved it, with a slightly different approach..

instead of adding something to "this._equips"..
i replicated a similar ,more simple thing like "this._equips"..
Called "this._equipIsGone", which by default is connected to nothing and cant get any actionChane Conflict..

example code for Game_Actor:
JavaScript:
    Game_Actor.prototype.initialize = function(actorId) {
        Game_Battler.prototype.initialize.call(this);
        this.setup(actorId);
        //stuff above is default stuff below is added
        this._equipIsGone = [];
        this._equipIsGone.push(0, 1, 2, 3, 4);
        this._equipIsGone[0] = false;
        this._equipIsGone[1] = false;
        this._equipIsGone[2] = false;
        this._equipIsGone[3] = false;
        this._equipIsGone[4] = false;        
        this._battleUnit = 'actor';      
    };

i will report this as solved.thx
@dopan The way you've solved this is still by overwriting the original function. That means anyone who's added something to Game_Actor.prototype.intialize will have those changes ignored if they're also using your plugin.

Or if this isn't a plugin, and it's just a change you want specifically for your project, you will run into problems if you try to use any plugins that modified that function, and load them before your changes.

What you want to do is make an alias, or a monkeypatch.

JavaScript:
var newName = Game_Actor.prototype.initialize
Game_Actor.prototype.initialize = function(actorId) {
        newName.call(this, actorId)
        //stuff above is default stuff below is added
        this._equipIsGone = [false, false, false, false, false];
        this._battleUnit = 'actor';     
};

By making a new function equal to the original, and then calling it, you do what the original function did, including any changes any other plugins have made to that function. Then, after calling the original, your changes get added to the end. Any new plugins that also use this function will continue to use your changes to it as well, improving compatibility.
I also cleaned up your code a smidge. There's no need to declare an array as blank, and then immediately make each of the elements equal to something else. You can declare it as having those values directly, and the line where you push a bunch of numbers to it only to erase them on the next line is unnecessary. The element Id you reference is its position in the array, not a value you set beforehand.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/issue-with-game_actor-this-_equips.142445/