i have a window with the following code:
[spoiler]class Test_Menu_7 < Window_Base
def initialize
super(0, 0, 190, 80)
refresh
end
def refresh
for i in 0...3
x = i*40
y = i
actor = $game_party.actors[i]
draw_actor_graphic(actor, x, y)
end
end
end[/spoiler]
and i keep getting this error:
Script 'Window_Base' line 113: NoMethodError occured.
undefined method 'blt' for nil:NilClass
the error is pointing to:
[spoiler] #--------------------------------------------------------------------------
# * Draw Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end[/spoiler]
any ideas?
Are you sure there are four party members in the party when you run the code?
yes there is, i'm just using the defaults, so i have Aluxes, Basil, Gloria, and Hilda.
You haven't defined self.contents.
Write this in initialize between super and refresh:
self.contents = Bitmap.new (width - 32, height - 32)
duuur...i hate it when i miss the little things! :-\
thanks!