Hi there, I never bottered much about this because I was planing make game only have 5 skills for each kind of spellbook, but now I re-organized it better so need to show several types of skills.
My idea is, make the window like a normal window of one single columm
, showing the the skill picture/name/sp cost, and when I move down the cursor moves aswell showing the actual skill i'm "selecting"
Now heres comes problem, with this current code i'm using, I only can see the skill picture/name/sp cost, on the first 5 skills (wich are the ones "inside" the window box, and when I move down I can't see the actual cursor, but I can stil choose them, I mean is, I keep moving down as if I were using a HUGE window box that doesn't fit on screen and the screen isn't updated with the current cursor location for show the info.
I hope I have explained this clear enought, since was kinda hard for me explain it :P
Anyways heres the actual code i'm using:
Thank you
My idea is, make the window like a normal window of one single columm
, showing the the skill picture/name/sp cost, and when I move down the cursor moves aswell showing the actual skill i'm "selecting"
Now heres comes problem, with this current code i'm using, I only can see the skill picture/name/sp cost, on the first 5 skills (wich are the ones "inside" the window box, and when I move down I can't see the actual cursor, but I can stil choose them, I mean is, I keep moving down as if I were using a HUGE window box that doesn't fit on screen and the screen isn't updated with the current cursor location for show the info.
I hope I have explained this clear enought, since was kinda hard for me explain it :P
Anyways heres the actual code i'm using:
Code:
#==============================================================================
# Window_SpellBook_Light
#==============================================================================
class Window_SpellBook_Light < Window_Selectable
def initialize(actor)
super(0, 45, 456, 545)
@actor = actor
@column_max = 1
self.z = 9999
refresh
self.index = 0
if $game_temp.in_battle
self.x =135
self.y = 100
self.height = 330
self.width = 530
self.back_opacity = 160
end
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_skills.size
for x in 0...$light_skills_ids.size
if i == $light_skills_ids[x]
@data.push($data_skills[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 70)#32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
x = 4
y = index / @column_max * 60
self.contents = Bitmap.new(width - 32, row_max * 60)
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 48, 48), opacity)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = shadow_color
self.contents.draw_text(x + 50, y + 2, 214, 48, skill.name, 0)
self.contents.font.color = normal_color
self.contents.draw_text(x + 48, y, 214, 48, skill.name, 0)
self.contents.font.color = shadow_color
self.contents.draw_text(x + 374, y + 2, 48, 48, skill.sp_cost.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 372, y, 48, 48, skill.sp_cost.to_s, 2)
else
self.contents.font.color = shadow_color
self.contents.draw_text(x + 50, y + 2, 214, 48, skill.name, 0)
self.contents.font.color = disabled_color
self.contents.draw_text(x + 48, y, 214, 48, skill.name, 0)
self.contents.font.color = shadow_color
self.contents.draw_text(x + 374, y + 2, 48, 48, skill.sp_cost.to_s, 2)
self.contents.font.color = disabled_color
self.contents.draw_text(x + 372, y, 48, 48, skill.sp_cost.to_s, 2)
end
end
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
if $game_temp.in_battle
@help_window.x = 0
@help_window.y = 0
@help_window.height = 64
@help_window.width = 800
@help_window.opacity = 160
end
end
def update_cursor_rect
self.cursor_rect.set(-1, (index * 60) + 1, 500, 54)
end
end
Thank you