I want to change an event's sprite...

I'm using a script to change an event's sprite, since it could be a few things depending on certain variables.  In the script call thread, I found this:

$game_map.events[161].set_graphic("BattleText", 0)

But that only allows me to select a block of sprites.  What I wanted to do was select a particular stepping frame from that set.  I tried looking through the default scripts to get some inspiration, but it was all very confusing to me.  Can anybody help me out with this?
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


I think you have to change the @pattern variable as well, to make it use a different column. And @direction will make it use a different row.


I don't have my laptop with me so can't check. Galv has a Move Route Extras script that allows you to fine-tune the graphics from an event command in the way you are wanting, if you find it too difficult to figure out.
Sorry for posting to the wrong area.  I didn't notice until I was browsing a thread later on that there was a separate area for scripting questions.

Thanks for the hint.  I was able to find something posted by Lone Wolf a while back that helped me get partway there, but his script only changes the @pattern, and I couldn't figure out how to adapt it to do the @direction as well.  His script went like this:

class Game_Character

  def set_pattern(frame)

    @pattern=frame

    @original_pattern=frame

  end

end

I tried adding this to the class:

  def set_direction(frame)

    @direction=frame

    @original_direction=frame

  end

But it just set the pattern to the value I wanted for the direction.  I got the same result when I tried changing set_pattern to use two values instead of just one, and having the second one handle the direction.  Clearly, this isn't how I'm supposed to do it.  If anyone could point me in the right direction, I would be most appreciative.

Edit:  So, funny story.  At work last night, I was thinking of alternative ways to set event directions.  The thought of using a Move Event crossed my mind, and I was just thinking about why I didn't want to do it that way when suddenly - Full stop.  "Or...  I could look about five lines up from where I got the format for Set Graphic, and find the format for Set Direction there."

So anyhow, thanks for the hints Shaz, and to Lone Wolf for his Set Pattern script, and to Archeia for posting those scripting formats.  I've figured it out now!

Original thread: https://forums.rpgmakerweb.com/threads/i-want-to-change-an-events-sprite.38247/