RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Snippet Request: Coordinate Adjustment?

Started by shintashi, December 29, 2010, 04:00:27 AM

0 Members and 1 Guest are viewing this topic.

shintashi

I would like to be able to adjust the X & Y coordinates of a stationary event graphic, preferably using the event>script option if that's possible. For example, making a small adjustment to where torches or tiny NPCs appear.

Deity

Hay,
I've written something that could help you.
class Game_Character
  attr_accessor :adjust_x
  attr_accessor :adjust_y
  alias initialize_adjust initialize unless $@
  def initialize
    initialize_adjust
    @adjust_x = 0
    @adjust_y = 0
  end
end
class Interpreter
  def adjust_graphic_coordinate(x=0,y=0)
    get_character(0).adjust_x = x
    get_character(0).adjust_y = y
  end
end
class Sprite_Character
  alias update_adjustment update unless $@
  def update
    update_adjustment
    self.x += @character.adjust_x
    self.y += @character.adjust_y
  end
end


Just type adjust_graphic_coordinate(x,y) into the Script command of any event and the graphic will change the position.
x and y can be negative too.

Deity
Greetings
DigiDeity


├Work┤
├Contact┤


shintashi

That's spiffy actually, though the autorun/parallel process is tricky.