Determining an Actor

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
48
Reaction score
3
First Language
English
Primarily Uses
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!
 
Last edited:

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
907
Reaction score
361
First Language
Portuguese - Br
Primarily Uses
RMMV
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.
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
48
Reaction score
3
First Language
English
Primarily Uses
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.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,627
Reaction score
1,061
First Language
English
Primarily Uses
RMMV
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?
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
48
Reaction score
3
First Language
English
Primarily Uses
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.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,627
Reaction score
1,061
First Language
English
Primarily Uses
RMMV
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?
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
48
Reaction score
3
First Language
English
Primarily Uses
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.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,627
Reaction score
1,061
First Language
English
Primarily Uses
RMMV
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.
 

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
48
Reaction score
3
First Language
English
Primarily Uses
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?
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,627
Reaction score
1,061
First Language
English
Primarily Uses
RMMV
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)) {
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Kes wrote on Chef's profile.
I have deleted your profile post as our Rules are quite clear that you may not use them to advertise non-RM products, nor may you give a link to anything that solicits payment for you.
140 Thousand words, take one down, toss it around, discover I hate the direction I went and decide to start a complete rewrite.
I like being a butt to people.
Dirtnap wrote on Tyler Warren's profile.
Hi Tyler,

My name is Sean, I am the owner of an indie studio, and I am looking to get some paid art work done. I am working with MV, but our programmer will be heavily modifying it.

If you are interested, or would like to hear more, I can provide my personal e-mail address.

S.G.
The stream will be live shortly with some more Witcher 3! Feel free to drop by~

Forum statistics

Threads
93,601
Messages
913,830
Members
123,149
Latest member
BwadeZ
Top