Hello guys. I'm a fresh user, although I've always been around as a visitor. My issue is: I tried implementing woratanas' script for Picture Below Character in RMAce (originally for RGSS2). It works, but it is generating a minimal lag.
class Spriteset_Map FIRST_PICBELOW_ID = 5 # First ID of picture that will show below characters LAST_PICBELOW_ID = 10 # Last ID of picture that will show below characters alias wora_picbelow_sprsetmap_crepic create_pictures def create_pictures(*args) wora_picbelow_sprsetmap_crepic(*args) for pic_id in FIRST_PICBELOW_ID..LAST_PICBELOW_ID @picture_sprites[pic_id].dispose if @picture_sprites.include? pic_id @picture_sprites[pic_id] = Sprite_Picture.new(@viewport1,$game_map.screen.pictures[pic_id]) end endend
Developer's Website: http://boxsuke.exteen.com/20090224/vx-picture-below-characters-script-by-woratana
It's not something that would affect gameplay drastically, but I wish it could be avoided. Is there something to be done about it?
Lag in Spriteset_Map
● ARCHIVED · READ-ONLY
-
-
Is that the whole script, and is that the VX version or the Ace version? If that's what you're running in your game, the lag is because you're disposing and recreating the pictures. And I THINK when you are disposing the picture, it's also removing it from cache, so when you go to add it back again, it's actually got to re-read it from disk every time. You'd be better off just adding a set_viewport method to the Sprite_Picture class and passing in @viewport1 to each of them.
However, if you compare the default scripts, you will see that create_pictures is handled differently in Ace to the way it was handled in VX. In Ace, create_pictures actually doesn't create any pictures at all - it just creates the array that holds them..
Try removing the code you've got there, and put this instead (note it overwrites the existing update_pictures method, so you should put it above other custom scripts that might alias it):
Code:class Spriteset_Map FIRST_PICBELOW_ID = 5 # First ID of picture that will show below characters LAST_PICBELOW_ID = 10 # Last ID of picture that will show below characters def update_pictures $game_map.screen.pictures.each do |pic| @picture_sprites[pic.number] ||= Sprite_Picture.new(pic.number.between?(FIRST_PICBELOW_ID, LAST_PICBELOW_ID) ? @viewport1 : @viewport2, pic) @picture_sprites[pic.number].update end endend -
Yeah, it's the whole VX code except for the "if" I had to add later so it would work in Ace. I was kinda aware of that but my poor skills couldn't get around it.
Anyway, code works perfectly, thank you Shaz. Have a nice day! -
Glad it worked :)