[SOLVED][VXACE]Changing a map sprite's bitmap makes it disappear?

● ARCHIVED · READ-ONLY
Started by Zalerinian 3 posts View original ↗
  1. When trying to set an event's sprite through a custom script call, I have a bitmap loaded and prepared based on what the arguments for the method are. However, even though I know the bitmap is good, setting it as a pre-existing Sprite's bitmap causes it to disappear. The bitmap works perfectly fine, however in a new sprite. I do not understand why it does not work with an existing event's sprite. The code I'm using is

    Spoiler
    class Spriteset_Map attr_accessor :character_spritesendclass Scene_Map attr_accessor :spritesetendclass Game_Interpreter def get_shop_pedistal_bitmap(name, id) bitmap = Cache.character(name) id -= 1 row = id / 12 col = id % 12 puts "Bitmap Name: #{name}" sign = name[/^[\!\$]./] sign = sign.nil? ? false : sign.include?("$") sprite_width = bitmap.width / (sign ? 3 : 12) sprite_height = bitmap.height / (sign ? 4 : 8 ) btm = Bitmap.new(sprite_width, sprite_height) rect = Rect.new(row * sprite_width, col * sprite_height, sprite_width, sprite_height) btm.blt(0, 0, bitmap, rect) return btm end def swop_event_graphic(eid, gname, gid) SceneManager.scene.spriteset.character_sprites.each{|spr| if spr.character.class == Game_Event if spr.character.id == eid spr.bitmap = get_shop_pedistal_bitmap(gname, gid) end end } endend (method names have been altered for simplicity)
    Any help on this bizarre issue is appreciated.
  2. I'm on mobile.. But your rows and cols are both set to 12...I'm assuming your doing character sheets from the rest of the code.. So shouldn't both be Dependant on the bitmaps type so your rect doesn't go out of range?
  3. It gets the bitmap fine, as it shows up perfectly in a new sprite. I'm only getting the area of the one sprite, and returning a new bitmap that size with the sprite I want blt'd onto it. It isn't like the normal event sprites where it is a whole charactersheet, I'm giving it just one little area.

    EDIT

    I've changed my method to not replace the bitmap, but rather update the character_name, character_index, pattern, original_pattern, step_anime, walk_anime, and direction_fix flags to do what I wanted them to. This method works fine for what I need it to, so I will be marking this as solved.