Script Call for changing event graphic.

Started by RoseSkye, February 18, 2018, 07:43:15 pm

Previous topic - Next topic

RoseSkye

I tried searching the database and all I could find was @tile_id and set_graphic. Set graphic seems to give me errors while tile_id feels like it's for terrain. Can anyone give me an example call snippet for changing the in game graphic for events or player?

What I've tried -

$game_player.set_graphic('1139', 0, 2, 0)
$game_map.events[2].set_graphic('1139', 0, 2, 0)


KK20

set_graphic is defined for Game_Actor objects. $game_player is a subclass of Game_Character, so it does not have access to that method. You could get around this by accessing $game_party.actors or $game_actors[ID] instead, but that gets pretty messy. Not to mention events (Game_Event objects) aren't even Game_Actors, so you'd be screwed there.

There really is no easy script call to do this. So you will need to add this somewhere

class Game_Character
  def set_graphic(character_name, character_hue)
    @character_name = character_name
    @character_hue = character_hue
  end
end

which allows you to do the following script calls:
$game_player.set_graphic('001-Fighter01', 0)

$game_map.events[1].set_graphic('002-Fighter02', 180)

Granted with some line breaks in between since RMXP likes tiny textareas.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

RoseSkye