Determining an Actor

Hi all, maybe someone here can help me. I am trying to make a plugin and it is almost nearly working. The last thing I am trying to do with it is make something specific happen when Actor 4 is doing it. This is all during combat if that makes a difference. I am trying to achieve this with an IF ELSE statement. What I need to know is what to put for the IF statement. What I was trying was this:

if($gameActors.actor(4) === true) {
THING A HAPPENS;}
else {
THING B HAPPENS;}

But it will only do thing B. It will only do what is in Thing B's place in the IF ELSE statement. So I would imagine "$gameActors.actor(4) === true" isn't the right thing to look for. Any help would be greatly appreciated.

Thanks!
i think maybe if you try:
if($gameActors.actor(4) == true) {
THING A HAPPENS;
}
else {
THING B HAPPENS;
}

only with two ==
?
Presuming that 4 refers to actor id and not to the 4º actor(member) in the group.
No luck. Still the same results. Thank you for the suggestion though.

Oh this is during battle if that makes a difference. I edited the original post to reflect that.
Don't know about battles =/ I almost not use the batte things on mv.
You can check here a great script call list. Maybe that helps
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-script-call-list.46456/
Good luck!
You don't want to compare if Thing1 is true, you want to compare whether Thing1 is the same as Thing2.
The correct idea is more like:
Code:
if (thing === $gameActors.actor(4)) {
   // something happens
}


The key though, is the value of "thing".

Are you looking for the user of a skill? The user of an item? The target of a skill?
Basically what is the context of this condition?
This is if Actor 4 is attacking.
If Actor 4 is attacking it should display a certain way, if any of the other characters are attacking it should display another way.

So I guess it would be using a skill, The skill being basic attack.
I hope that makes sense.
Is this in the damage formula? Is this in an event? Is this in a plugin (if so, what class is the function in)?

How are you getting the value of the user of the skill?
It's in a plugin. the full function is this:
Code:
TimedAttackSystem.prototype.showResults = function() {
       var resultId = 0;
       for(var i = 0; i < _.condition.length; i++) {
           if(eval(_.condition)) {
               resultId = i;
               break;
           }
       }
       if(_.parent === 'actor') {
           this._resultActor.removeChild(this._results);
       } else {
           this.removeChild(this._results);
       }
       this._results = new Sprite_TimedAttackResults(resultId);
       this._resultActor = BattleManager._spriteset._actorSprites[BattleManager._subject.index()];
       if(_.parent === 'actor') {
           if($gameActors.actor(4) == true) {
           this._results.y += (this._resultActor._mainSprite.height/3);}
           else {
           this._results.y += (this._resultActor._mainSprite.height/2);}
           this._results.setup('bla');
           this._resultActor.addChild(this._results);
       } else {
           this._results.x = this._resultActor.x;
           if($gameActors.actor(4) == true) {          
               this._results.y = this._resultActor.y + (this._resultActor._mainSprite.height/3);}
           else {
               this._results.y = this._resultActor.y + (this._resultActor._mainSprite.height/2);}
           this._results.setup('bla');
           this.addChild(this._results);
       }
    };

Its a results display that I need to move for one character due to their size.
Just above the line where you have
Code:
if($gameActors.actor(4) == true) {

Please add a line
Code:
console.log(this._resultActor)

Then playtest and open the Console by pressing F8 during playtest. Use the arrow next to what gets logged to expand it a bit. We need to find out whether you even have access to the Game_Actor object or not inside this function. I suspect that's a sprite and not the Game_Actor object.
So I did that, and it does list the Game_Actor bit in the log, with the Id number. But you are right, it is a sprite.

Is this something way more complicated than I think it is?
If it's the Sprite_Actor, you should be able to get the Game_Actor from it. Theoretically this would work:

Code:
if (this._resultActor._actor === $gameActors.actor(4)) {

or less likely:
Code:
if (this._resultActor === $gameActors.actor(4)) {
That worked perfectly! Thank you so much!!!!

Original thread: https://forums.rpgmakerweb.com/threads/determining-an-actor.109013/