shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
Hi,

I am using Yami Sideview battler and I would like to be able to change actor and enemy sprites in mid-battle (e.g. an actor transforms, or an enemy changes color to prepare for a skill, etc). Please note that I do NOT want to change the actor, just the sprite. It can be done in a snippet of code in an event, or in an action sequence, etc. I just need some way to change it during battle.

Script: https://github.com/suppayami/yami-e.../build/SideviewBattler/YED_SideviewBattler.js

Thanks.
 
Last edited:

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
I FINALLY got this to work in a clunky way. Here's how you do it (I used a state to determine when the sprite should change). This is a temporary change.

1. add new notetag <Sideview Battler2: FILENAME>
2. edit YED_sideviewBattler.js:

a. add new line to regexp under existing filename:
Code:
FILENAME2: /<Sideview Battler2:[ ]*(.*)>/i,

b. add filename2 to Utils._processProperties under filename:
Code:
filename2: "",

c. add new lines to utils._processnotetag, under sideviewbattler.filename:
Code:
match = notetag.match(Regexp.FILENAME2);
        if (match) {
            sideviewBattler.filename2 = String(match[1]);
        }

d. add getsideviewfilename2 function after getsideviewfilename function:
Code:
Game_Battler.prototype.getSideviewFilename2 = function() {
        var sideviewBattler = this.getSideviewBattler();

        if (!this.isSideviewBattler()) {
            return null;
        }

        return sideviewBattler.filename2;
    };

e. change .battlername function:
Code:
Game_Actor.prototype.battlerName = function() {
        if (this.isSideviewBattler()) {
            
            
            if (this.isStateAffected(YOURSTATEID)) {
            return this.getSideviewFilename2();
            } else {
            return this.getSideviewFilename();
            };
        }

        return _Game_Actor_battlerName.call(this);
    };

If someone has an easier way to do this, I am all for it.
 

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
Also, this assumes that the second spritesheet has the same dimensions, frames, and motions. If you want to change those, you'll have to add your own edits to the js file.
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
First Language
English
Primarily Uses
RMMV
I have a question... I'm not sure if you'd be able to answer or not but, could this be tweaked to read other actor's notetags? I ask as a way to easily get around the fact that you need everything to be the same.

I learned that it's all in the notetags with this plugin. it usually won't change sheets (tho I found 1 Japanese plugin that does what you've figured out here actually.) But I spent days trying to get it to read another actor's notetags instead of just another file, but I couldn't figure it out. The only drawback with this option is you'd have to have an actor for the notetags to be read.
 

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
Can you link to the other plugin you found? Maybe I can take a look at what that does and get it to work. Thanks.
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
First Language
English
Primarily Uses
RMMV
sure, https://github.com/futokoro/RPGMaker/blob/master/FTKR_TransformationState.js

I scoured the net trying to find a way to get some kind of transformation to work while still using YED and I found this. but this is also how I realized that YED is mostly about reading notetags, which is why I tried to see if I could get it to read another actor's notetag's entirely, to bypass needing all the motions and frames be the same. otherwise this and what you have work just fine.
 

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
Wow, yeah this one does exactly what I was looking for earlier. However, I think it's only checking for a new sprite name and therefore it's not touching the other notetags like sprite size or frames...

In the YED code, I wonder if you could somehow switch the actor here to a different actor's notetags if a state is applied? I don't really know how "this.actor()" works? if it was just an ID there, it would be easier.

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

        if (this.isActor()) {
           if (this.isStateAffected(YOURSTATEID)) {
              battler = WHAT GOES HERE?!
         } else {
            battler = this.actor();
         }

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

        return !!battler ? battler : null;
    };
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
First Language
English
Primarily Uses
RMMV
that's what I've been trying to figure out actually. hmm, if I can figure out anything, I'll definitely let you know. One thing I thought of, but couldn't get to work... was getting YED to look for notetags in a different space. like look for them in states, thus having the ability to put them in a state and seeing if you could change actors or something like that. But either way, I'll see what I can figure out. I feel we're in the right area here.
 
Last edited:

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
YES! I think I got it! :)
Code:
Game_Battler.prototype.getBattler = function() {
        var battler;

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

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

        return !!battler ? battler : null;
    };

This uses another actor's full notetags! Size, frames, poses! Thanks for giving me the idea!
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
First Language
English
Primarily Uses
RMMV
this definitely looks right, unfortunately it's bugging out my YED for some reason... it's making everyone's sheet's be read in weird manner. what's it doing when you use this?
 

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
Oh, sorry, I think there's a missing end bracket there:

Code:
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;
    };

See if this works.
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
First Language
English
Primarily Uses
RMMV
Ok, it doesn't mess up anything. but nothing seems to change either. but... I'm wondering... I feel it's because once it's got the other actor's notetags, it doesn't actually know what to do with them? so it doesn't do anything with them maybe? i'm not sure what is or isn't happening

EDIT: I think I figured it out... $dataActors[ID] isn't being called to do anything by YED itself I think? battler = this.actor clearly states an actor. but $dataActors just brings up actual data. I think... I could be way off on that. basically YED sees $dataActors[ID] and just shrugs. so just trying something, I put

battler = this.actor() === $dataActors[ID];

this does change things, but YED doesn't know what to look for meaning nothing show's in it's play. BUT, it does trigger a change. I think the filename needs to be tied to this somehow too. I've been trying to figure that out which is what took me a sec to respond.
 
Last edited:

shukiri

Villager
Member
Joined
Nov 6, 2018
Messages
21
Reaction score
8
First Language
english
Primarily Uses
RMMV
Hmm.. I'll try it in a new game later. Maybe one of my other plugins is affecting it or you have a different version or something, but it's actively working in my game.
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
First Language
English
Primarily Uses
RMMV
hmm... interesting. I'll turn everything off then except exactly what I need and see if that works.

EDIT: Ha, yeah it works actually... weird. it definitely must be one of the other plugins I'm using. I'll narrow it down and see which one. But otherwise, awesome you totally figured it out! thanks a lot! I've been going over this for a solid few months with no answer lol. so yeah, thanks!
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

You look like you had a rough day...Here, have a Baby Panda!

A certain person better sell his stock while he still can, because it looks like it's going to take an unrecoverable nose dive.
7 years of trying to plan this project... and it got an official plotline today. 7 years. I really just have no concept of order huh GHJGSJHGVGHASFH.
Doing RPG Maker News for 24th October 2021

I'm not sure how to do this so I'll just ask here, Wheres a good place to post your game (for free) once its done?

Forum statistics

Threads
116,065
Messages
1,095,465
Members
151,430
Latest member
gredrick333
Top