Normally in RMVX, although the center of the width of a sprite is drawn in the center of a tile, the height is done differently - it is drawn from the bottommost part of a tile up. For RTP graphics this doesn't make any difference, since the bottommost part of the RTP chars is actually what should appear in the bottommost part of a tile.
But for some non-RTP sprites, that is an issue. For instance, if you wanted to make the tip of your char's sword spill over to the tile below or on top of him, normally that wouldn't be possible. Or you could want a large character graphic (say, an Ogre) to spill over equally to both the tiles below and on top of him, instead of spilling his extra size all over just the tile on top.
This script fixes that (and it is compatible with the RTP graphics as well to boot):
CODE
#Sprite Y Centering Script
#by Anakin_Starkiller
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Update Transfer Origin Bitmap
#--------------------------------------------------------------------------
def update_bitmap
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_index != @character.character_index
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = @character.character_index
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch - ((@ch - 32) / 2) #for making character graphics appear correctly in the y center of the tile
end
end
end
end