MV YED Sideview change actor sprite via reading other actors notetags

i managed to get this ALMOST working with this script here:

JavaScript:
Game_Battler.prototype.getBattler = function() {
        var battler;


        if (this.isActor()) {
           if (this.isStateAffected(ID)) {
              battler = $dataActors[ID];
           } else {
              battler = this.actor();
           }
        }


        if (this.isEnemy()) {
            battler = this.enemy();
        }


        return !!battler ? battler : null;
    };
(from this thread: https://forums.rpgmakerweb.com/inde...view-battler-change-sprite-mid-battle.111677/ )

it only works with one actor however
ive tried putting it in multiple actors notetags(using unique dummy states and dummy actors for each) but it only seems to read the newest one i add for some reason
i dont know how to write javascript so my attempts at including other actors and states into the same if else branch has been in vain
im not really sure what im missing here so any help is appreciated
What are you trying to accomplish exactly?
ive tried putting it in multiple actors notetags(using unique dummy states and dummy actors for each) but it only seems to read the newest one i add for some reason
thats... not meant to go in a notetag. thats meant to be a plugin. the thread you got it from says it a few times
thats... not meant to go in a notetag. thats meant to be a plugin. the thread you got it from says it a few times
the problem i encountered doing it like that was that i still couldnt get it to work with more than 1 actor and 1 state
What are you trying to accomplish exactly?
i want actors to change their sprites when equipping a weapon but because i cant use change actor image due to yed running in notetags i have to work around it somehow
i want actors to change their sprites when equipping a weapon but because i cant use change actor image due to yed running in notetags i have to work around it somehow
I have something like this my game... Though I use it show when the actor is affected by a state [Zombie] in this case.

This is the notetag for the state:
Code:
<Custom Apply Effect>
  if (target.isActor()) {
    name = target.battlerName();
    newname = name.replace('_Zombie',"");
    var name1 = newname + '_Zombie';
    target.setBattlerImage(name1);
    target.refresh();
 }
</Custom Apply Effect>
<Custom Leave Effect>
if (target.isActor()) {
    name = target.battlerName();
    newname = name.replace('_Zombie',"");
    var name1 = newname - '_Zombie';
    target.setBattlerImage(name1);
    target.refresh();
}
</Custom Leave Effect>
There is another Custom Effect <Custom Remove Effect> but that is only if you want to remove the state with an item or skill... I only showed the effects that are pertinent to your situation.

You can make it so that it can never wear off... Making it a Passive State and adding the passive state to the weapon. You can have a different state for each weapon. It's not perfect but it works.

But I'm sure the geniuses on this forum can come up with a much better solution than I did... They usually do.
oh yeah ill give this a shot, i was originally gonna just make weapon specific states anyways w the original because it worked and thats all i can ask for at this point lol

ok after further testing i cant get this to work at all im probably doing it wrong but if an easier solution is possible im gonna shoot for that
This is the notetag for the state... I only showed the effects that are pertinent to your situation.
Nothing wrong with that approach, but id personally skip the states and use a plugin like Waynee's Equip Eval to make it so that the actor that equips it has their battler changed as a direct result of equipping the weapon.

You can make it so that it can never wear off... Making it a Passive State and adding the passive state to the weapon. You can have a different state for each weapon. It's not perfect but it works.
that one actually requires an edit to the plugin. Turan has instructions on how to do it here. Apply effects dont actually trigger when a passive becomes active.
Nothing wrong with that approach, but id personally skip the states and use a plugin like Waynee's Equip Eval to make it so that the actor that equips it has their battler changed as a direct result of equipping the weapon.


that one actually requires an edit to the plugin. Turan has instructions on how to do it here. Apply effects dont actually trigger when a passive becomes active.
ohhhhh thats probably why i couldnt get it to work

as for the eval ill give that a shot since that sounds promising
ok so after messing with the eval, i still run into the problem of not having it conditionally use different notetags and states for different actors

what im doing is having a check of conditionals as follows
if actor a has weapon equipped
change state actor a + actoraweapon
else change state actor a - actoraweapon

if actor b has weapon equipped
change state actor b + actorbweapon
else change state actor b - actorbweapon

and so on
worth noting that this is the same weapon both times here as all actors can equip any weapon regardless of class
the actor specific states were in an attempt to make it so that itll check who has the state before using notetags from that actors corresponding dummy actor (labeled something along the lines of actor a weapon, empty aside from the notetags which host yed sideview parameters for that actors spritesheet wielding said weapon) but my problem now is that in the script it can only check for one state and switch to one actors notetags meaning i cant check for those unique actor states and switch to their specific dummy actors notetags

sorry if none of this makes sense its 5am and i dont really have experience with this sort of thing
ok so after messing with the eval, i still run into the problem of not having it conditionally use different notetags and states for different actors
showing us what you did would be far more effective than describing what you did. Both I and firestalker proposed different solutions. at some point you said you'd try the equip eval, but point of me mentioning the equip eval was so that you wouldnt need to use states.
Granted, i never looked into that sideview battler plugin, so i cant say as to if you need the states for some other reason, but just changing the battler image shouldnt require them

the actor specific states were in an attempt to make it so that itll check who has the state before using notetags from that actors corresponding dummy actor
if youre using the equip eval plugin, theres no need for that. i forget which, but either "a" or "user" within its notetags refer to the actor equipping the item. within the equip eval plugin youd make branches to identify which the actor the user is, and then change the battler image based on the weapon
i used states because thats how the original script was written, i have no experience with javascript so modifying or making my own script for the eval is out of the question here
bump because i still havent figured this out
last bump i might just give up and do a really stupid workaround if nobody can figure this out
try this...

JavaScript:
    Game_Battler.prototype.getBattler = function() {
        var battler;

        if (this.isActor()) {
           if (this.isStateAffected(57) && this === $gameActors.actor(1)) {
              battler = $dataActors[4];
           } else {
              if (this.isStateAffected(58) && this === $gameActors.actor(2) ) {
                battler = $dataActors[5];
            } else {
                if (this.isStateAffected(59) && this === $gameActors.actor(3) ) {
                  battler = $dataActors[6];
             } else {
                if (this.isStateAffected(999) && this === $gameActors.actor(4) ) {
                    battler = $dataActors[8];
               } else {
             battler = this.actor();
              }
            }
            }
           }
        }

of course you'll need to edit this to fit what you're doing, but specifying which actor with the state should do the trick.
oh this looks perfect ill give it a shot in a bit and let you know how it goes
alright sorry i fell asleep but i gave this a try and for some reason im still having the problem where its only effecting the first actor listed? (edit, its only reading the first line that checks for a state, it doesnt check for state 106 shown in the image)
it seems like this bit here isnt working/being read, i equipped it to actor 5 and edited the plugin to only check for actor 1 and it still changed the sprite regardless
1723055927233.png
Try this, Maybe:
JavaScript:
    Game_Battler.prototype.getBattler = function() {
        var battler;

        if (this.isActor()) {
           if (this.isStateAffected(57) && this === $gameActors.actor(1)) {
              battler = $dataActors[4];
           } else if (this.isStateAffected(58) && this === $gameActors.actor(2) ) {
              battler = $dataActors[5];
            } else if (this.isStateAffected(59) && this === $gameActors.actor(3) ) {
               battler = $dataActors[6];
             } else if (this.isStateAffected(999) && this === $gameActors.actor(4) ) {
                battler = $dataActors[8];
               } else {
                battler = this.actor();
              }
            }
            }
           }
        }
That's kind of a weird way to do it. I'm not 100% sure of what you're going for with this or why you're doing it this way, but instead of
Code:
this === $gameActors.actor(5)
I would simply do
Code:
this.actorId() == 5
no luck with either, seems to be doing the same thing as before

Original thread: https://forums.rpgmakerweb.com/threads/yed-sideview-change-actor-sprite-via-reading-other-actors-notetags.170799/