Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Change event graphic?
#1
Hi guys!

Lately im trying to change an event ("This Event") graphic in case the hero touches it through code.
(Why not through events? Well, specific reasons).

This is what ive got working so far:


For the hero

Code:
# After set_graphic (character_name, character_hue, battler_name, battler_hue)
$game_actors[1].set_graphic("basis_run", 0, "undead72", 0)
$game_player.refresh 


But the code below doesn't work:

Code:
$game_map.events[@event_id].set_graphic("basis_run", 0 ,"undead72", 0)


Saying set_graphic is not defined.
How would one define this, or what code would be useful?

Excuse my Ruby noobiness!
Reply }
#2
I'm at work, so I do not have my RPGMAKER XP system handy right now.  However, I do not recall ever seeing a 'set_graphic' method within the Game_Actor class.  So I would suggest looking for 'def set_graphic' within the default Game_Actor code.  Chances are, you will need to do a 'little' bit more with this code.  

The 'Interpreter' class does handle the code for changing Game_Event graphics, which even the Player is looked at as an event.  The reason is that both the Game_Actor and Game_Event methods link to Game_Character which handles character graphics, speed and animation pattern.

Even so, it would likely NOT take effect immediately.  Kid you not.  But you were on the right track with $game_player.refresh.  But you will need to refresh the Game Map with $game_map.need_refresh = true...   or just $game_map.refresh

EDIT:  Yeah, I re-read the request.  You're not complaining about changing the hero or actor, but the EVENT graphic.  Oookay. 

Normally, you would change an event's graphic with the "MOVE ROUTE" event command.  But you want it scripted.  Well, events do not have 'Set Graphic'   That would be too easy, wouldn't it?  Well, the MOVE ROUTE command in the event list goes directly into the Game_Character class.

Ah, the quandry.  You'd think you could edit $game_map.events[1] as an example to change the character graphic.  But the Game_Character class set up the 'character_name' value to be a bit... stubborn.  It can only allow changes within the class itself, and prevents anything like a script call from sending a character name graphic from outside the class.  SO....

Add:
Code:
#==============================================================================
# ** Game_Character (part 1)
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character_name           # character file name
  attr_accessor :character_hue            # character hue
end

... Setting the character_name and character_hue values to the 'attr_accessor' attribute allows you more access.  And since Game_Event is a 'child' class of Game_Character, the change made here will automatically affect Game_Event.

Okay, once that has been edited/added/whatever.....  (I prefer not to directly edit the base original code)....

Code:
$game_map.events[1].character_name = "002-Fighter02"
That should work, even in an event's  "Script Call".  It did for me.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#3
Got it working! Thanks Very cheery
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Atoa Custom Battle System: Popup when status change Noctis 6 9,005 02-01-2016, 12:52 AM
Last Post: Noctis
   Event collision problem with FPLE script ThePrinceofMars 2 5,175 11-11-2014, 06:30 PM
Last Post: ThePrinceofMars
   Actor Graphic/Reflection Refuses to Update/Refresh penguwin 6 8,524 11-06-2014, 09:51 PM
Last Post: penguwin
   Help with Change Party Order script VEE-Chary 12 12,836 05-07-2014, 02:58 PM
Last Post: VEE-Chary
Tongue  Message graphic color MagitekElite 4 6,381 12-14-2010, 10:17 PM
Last Post: MagitekElite
   checking event coordinates? shintashi 4 6,602 05-28-2010, 03:34 PM
Last Post: Jaberwocky
   Tagging a Common Event to an accessory Shiroiyuki 3 5,105 05-07-2010, 02:54 PM
Last Post: Shiroiyuki
   Party Change Script Trouble aveyondstars 2 4,585 04-13-2010, 05:58 PM
Last Post: Boot
    Level Up Event Script daojones 8 10,891 04-09-2010, 06:48 PM
Last Post: daojones
   make event unpassable even by jumping mangamaniacs2064 4 6,580 04-05-2010, 11:57 AM
Last Post: mangamaniacs2064



Users browsing this thread: