Only change character graphic if button is pressed

Hi guys I'm trying to set up and event where if I press dash my character changes from walking animation to running one.


This is easy with a common event and the change actor image.


I'm also trying to set up a common event where my character battler graphic changes depending on weapon equipped.


Again this is easy with a common event to do on its own.


My problem is the change actor images event makes me change all 3.


So for example I don't want to have to create a common event with the following permutations.


Actor is running, sword equipped - Change Actor Graphic -- Normal Face, running char, sword battler


Actor is running, axe equipped    - Change Actor Graphic -- Normal Face, running char, axe battler


Actor is running, bow equipped   - Cnage Actor Graphic ---- Normal Face, running char, bow battler.


etc... (there are 12 weapon types.)         ------------  etc...


Actor is not running, sword equipped - Change Actor Graphic -- Norm Face, walking char, sword battler


Actor is not running, axe equipped. --- Change Actor Graphic -- Norm Face, walking char, axe battler 


This would be 24 if, else if conditions and I plan on using half size sprites on my world map, and have second hand weapons so an actor will have


Is there a way to run two common event.


One that will only change char image for the running, non running common event 


One that will only change battler depending on the equipped weapon.


For example is there a little script I could put in instead of change actor images, that would just change the char sprite and not touch the battler and face.


Same goes for changing the battler image and not changing the char sprite.
I don't have the link ready, but there is a topic about the script equivalents of event commands.


Search for that and check for that equivalent of the change actor graphics command - that should give you the option to place each of the three actor pictures by filename and index, and if you store this data inside game variables (and redirect the script to load the names from there), you can handle this completely without any conditional branches or so.


However, you'll need to redirect the names from the variables and change the variables at need, because even that script command will require all three pictures as input - you just don't have to give them directly, and that will solve your problem.
I'll try to make a simple little snippet for this.


EDIT - Okay done, @padr81  🙂


That was nice and easy.


To use it, simply call a plugin command before using the change actor image function in the normal event editor.


change_face_only, change_sprite_only, change_battler_only


Continuum Change Actor Graphic
Thanks guys, much appreciated.


@continuumg - That script is clashing with some other but every time I press dash the game crashes.  Cannot read property tolowercase of undefined.
Weird.


This is just an alias of one rarely used function. I can't think of any plugin that might clash with this in that way.


Just to be clear, @padr81, Your setup should be like this:


Event (parrallel)


If Shift is pressed


     Plugin Command: change_sprite_only


     Change Actor Images: img, img, img


Else


     Plugin Command: change_sprite_only


     Change Actor Images: img, img, img


Is that what you have?
@continuumg Yup.  I took an SS of the event and the errors.

Spoiler
Capture2.PNG


Capture3.PNG


Capture.PNG
Ah. My plugin command alias broke it. oops. Easy fix. Sorry.


EDIT - Actually, I didn't make the mistake I thought I did. I think there might be an error in one of those other scripts.


Just try moving My script up in the script manager for now, and I'll see if I can figure out what went wrong.
Still crashes regardless of where I put the plugin.  Thanks a million for looking in to it.
I evented this. Problem is that you have to do it for every map and always make sure that you have the correct settinys. I'll look it up tomorrow morning and see if I can make a common event for the page that has the sprite changes and post it here since my laptop is off right now.


There is one more issue with my version. The first time the alternate movement's sprite sheet is loaded, the character's sprite disappears for a bit.


Update! 


Page 1 (All of these are parallel events)


wcE94nI.png



This can work as a common event (which I'd recommend in case you make any changes with a sprite or add more characters than intended)


Page 2 (Running On Switch and Self Switch A must be on in the conditions)


yd2VpDQ.png



Page 2 (Running Off Switch and Self Switch B must be on in the conditions)


hYBPmMl.png



Really the only issue that should be seen is the lag where your player character turns invisible. There might be a better way to do this, but for me I found it the most convenient.


I tried @continuumg's method and the movement animations for walking and running are weird. I still get that lag with the sprite disappearing in either case.
@BloodletterQ  I can event it easy and make it a common event which is fine, my problem is that using that method means having to change face, sprite and battler.  I can't have that as I need the change actor graphics to be independent.  Using that method every time the player starts running it will change the battler graphic too.


That would mean I would have to set up over 100 events per player as each player can equip each weapon, otherwise when the player runs his battler sheet will changed to the one assigned when he runs.


I can't get Continuumg's to work at all without an error probably due to some other scripts.


For example for one of my characters I'd need something like: 


if: player is dashing +


             if actor has sword equipped


                          Set graphic - Face, Running, Sword Battler


              else if actor has axe equipped


                          Set graphic - Face, running, Axe Battler


               (So on times 12 if I use one image per weapon type)


else


       if: player is walking


                  if actor has sword equipped


                          Set graphic - Face, Walking, Sword Battler


                  else if actor has axe equipped


                          Set graphic - Face, running, Axe Battler


                 (So on times 12 if I use one image per weapon type)


Than I would need to do it for every character and there will be at least 6 not including temporary characters.


Hence why I need to be just able to change battler sheet only or run only.


This would allow me to run 2 common events, one for walking/running and one for equipped battler weapon.
Well if you don't mind doing that daunting task (remember, making it as a common event will be your very best friend for this mission) your best option for would be on-touch encounters that have a common event before combat starts that will check for the equipped weapon. Otherwise, I see that the plugin is going to be a time saver.
Found the culprit, the plugin works fine unless its with the Upp mini map which incidentally also breaks the Yanfly Item Synthesis PlugIn in my game.  Thanks @continuumg.


@BloodletterQ


I managed to figure out idle pose too.  Dunno if it'll be any use to you, but it stops the PV guys sticking there leg out.


Dashing--Walking--Idle


Movement Common Event.PNG
Found the culprit, the plugin works fine unless its with the Upp mini map which incidentally also breaks the Yanfly Item Synthesis PlugIn in my game.  Thanks @continuumg.


@BloodletterQ


I managed to figure out idle pose too.  Dunno if it'll be any use to you, but it stops the PV guys sticking there leg out.


Dashing--Walking--Idle


View attachment 54561

You actually don't need to have that evented if you use the plugin I linked to you.
You actually don't need to have that evented if you use the plugin I linked to you.



Ah cool, I didn't spend enough time playing around with the plugin.  Think I'll stick to the ones I have now as they are working smooth.  Thanks for the help.
There's also this one I just discovered by Moghunter which will allow you to have an idle animation. Here are some things you should know (assuming you're using the multi-frame plugin I provided for you)

  • Make sure that your character's sprite is the walking animation.
  • Make a separate character sheet for idle and add _idle to the end. Likewise do the same for dash and include add_run.


My one issue is that it doesn't seem friendly if your character's appearance changes.

Original thread: https://forums.rpgmakerweb.com/threads/only-change-character-graphic-if-button-is-pressed.72199/