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

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
934
First Language
English
Primarily Uses
N/A
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

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.
 
Last edited by a moderator:

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
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?
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
934
First Language
English
Primarily Uses
N/A
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.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Officially not a mod anymore. Thanks for the many years!
Thinking if i should post on the classifieds section...
Made another plugin showcase video! :kaojoy:
(Plugins and details inside the description of the YouTube video.) :LZScheeze:
Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Forum statistics

Threads
104,374
Messages
1,005,910
Members
135,894
Latest member
EnriX
Top