Menu Estilo Pokemón No RPG Maker XP

29 de novembro de 2012

Pokémon-Style Menu é um script desenvolvido para o RPG Maker XP por Xk8, que possibilita um menu parecido com algum game do Pokémon (não lembro qual).

Veja como fica na screenshot de um projeto teste:

Screenshot

Menu Estilo Pokemón No RPG Maker XP

Menu Estilo Pokemón No RPG Maker XP

Instalação

A instalação do script é muito simples, porém, tem duas observações:

  1. A primeira é que você vai ter que baixar, copiar e colar as imagens deste pacote e salvar na pasta:Graphics/Icons do seu projeto.
  2. Você vai copiar e salvar o código do Pokémon-Style Menu em cima do Scene_Menu original, portanto, faça um backup do seu projeto antes de instalar, caso queira voltar para o menu antigo.

Código Do Script

#=====================REPLACE SCENE_MENU WITH ALL THIS CODE===================== 
#===================================# 
#Pokémon-Style Menu by Xk8          # 
#===================================# 
#The Menustatus are made using Zieg's system. 
#make sure you have the icons called menu00.png, menu01.png, menu02.png, 
#menu03.png, menu04.png,menu05, menu06, menu07 and menu08.png 
#and add windowskins with the names: skin00.png, skin01.png and 
#skin02.png. 
#also make sure that in the database, skin00.png is the windowskin. 
#If used, don't steal, please give credit. 
# -Xk8 

#IMPORTANT: the icons: [color00 and color08] are fully transparant. 
#IMPORTANT2: the icons [color01-07] are NOT transparant 

class Window_Command_Menu < Window_Selectable 
def initialize(width, commands) 
super(0, 0, width, commands.size * 32 + 32) 
@item_max = commands.size 
@commands = commands 
self.contents = Bitmap.new(width - 32, @item_max * 32) 
self.contents.font.name = $fontface 
self.contents.font.size = $fontsize 
refresh 
self.index = 0 
end 
  
def refresh 
self.contents.clear 
for i in 0...@item_max 
draw_item(i, normal_color) 
end 
end 
  
def draw_item(index, color) 
self.contents.font.color = color 
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32) 
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) 
bitmap = RPG::Cache.icon("menu0" + index.to_s) 
self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity) 
self.contents.draw_text(rect, @commands[index]) 
end 
  
def disable_item(index) 
draw_item(index, disabled_color) 
end 
end 

class Window_HelpItemSkill < Window_Base 
  
def initialize 
super(0, 0, 320, 64) 
self.contents = Bitmap.new(width - 32, height - 32) 
self.contents.font.name = $fontface 
self.contents.font.size = $fontsize 
end 
  
def set_text(text, align = 0) 
    
if text != @text or align != @align 
      
self.contents.clear 
self.contents.font.color = normal_color 
self.contents.font.size = 18 
self.contents.draw_text(4, 0, self.width - 40, 32, text, align) 
@text = text 
@align = align 
@actor = nil 
end 
self.visible = true 
end 
  
def set_actor(actor) 
if actor != @actor 
self.contents.clear 
draw_actor_name(actor, 4, 0) 
draw_actor_state(actor, 140, 0) 
draw_actor_hp(actor, 284, 0) 
draw_actor_sp(actor, 460, 0) 
@actor = actor 
@text = nil 
self.visible = true 
end 
end 
  
def set_enemy(enemy) 
text = enemy.name 
state_text = make_battler_state_text(enemy, 112, false) 
if state_text != "" 
text += "  " + state_text 
end 
set_text(text, 1) 
end 
end 

class Window_SkillStatus2 < Window_Base 
  
def initialize(actor) 
super(0, 64, 320, 64) 
self.contents = Bitmap.new(width - 32, height - 32) 
self.contents.font.name = $fontface 
self.contents.font.size = 18 
@actor = actor 
refresh 
end 
  
def refresh 
self.contents.clear 
draw_actor_name(@actor, 4, 0) 
draw_actor_state(@actor, 60, 0) 
draw_actor_sp(@actor, 130, 0) 
end 
end 

class Window_Item2 < Window_Selectable 
  
def initialize 
super(0, 64, 320, 416) 
@column_max = 1 
refresh 
self.index = 0 
    
if $game_temp.in_battle 
self.y = 64 
self.height = 256 
self.back_opacity = 160 
end 
end 
  
def item 
return @data[self.index] 
end 
  
def refresh 
if self.contents != nil 
self.contents.dispose 
self.contents = nil 
end 
@data = [] 
    
for i in 1...$data_items.size 
if $game_party.item_number(i) > 0 
@data.push($data_items[i]) 
end 
end 
    
unless $game_temp.in_battle 
for i in 1...$data_weapons.size 
if $game_party.weapon_number(i) > 0 
@data.push($data_weapons[i]) 
end 
end 

for i in 1...$data_armors.size 
if $game_party.armor_number(i) > 0 
@data.push($data_armors[i]) 
end 
end 
end 
    
@item_max = @data.size 
if @item_max > 0 
self.contents = Bitmap.new(width - 32, row_max * 32) 
self.contents.font.name = $fontface 
self.contents.font.size = $fontsize 
for i in 0...@item_max 
draw_item(i) 
end 
end 
end 
  
def draw_item(index) 
item = @data[index] 
case item 
when RPG::Item 
number = $game_party.item_number(item.id) 
when RPG::Weapon 
number = $game_party.weapon_number(item.id) 
when RPG::Armor 
number = $game_party.armor_number(item.id) 
end 
    
if item.is_a?(RPG::Item) and 
$game_party.item_can_use?(item.id) 
self.contents.font.color = normal_color 
else 
self.contents.font.color = disabled_color 
end 
x = 4 + index % 1 * (288 + 32) 
y = index / 1 * 32 
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(item.icon_name) 
opacity = self.contents.font.color == normal_color ? 255 : 128 
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) 
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) 
self.contents.draw_text(x + 240, y, 16, 32, ":", 1) 
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) 
end 
  
def update_help 
@help_window.set_text(self.item == nil ? "" : self.item.description) 
end 
end 

class Window_Skill2 < Window_Selectable 
  
def initialize(actor) 
super(0, 128, 320, 352) 
@actor = actor 
@column_max = 1 
refresh 
self.index = 0 
    
if $game_temp.in_battle 
self.y = 64 
self.height = 256 
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 0...@actor.skills.size 
skill = $data_skills[@actor.skills[i]] 
if skill != nil 
@data.push(skill) 
end 
end 
    
@item_max = @data.size 
if @item_max > 0 
self.contents = Bitmap.new(width - 32, row_max * 32) 
self.contents.font.name = $fontface 
self.contents.font.size = $fontsize 
for i in 0...@item_max 
draw_item(i) 
end 
end 
end 
  
def draw_item(index) 
skill = @data[index] 
if @actor.skill_can_use?(skill.id) 
self.contents.font.color = normal_color 
else 
self.contents.font.color = disabled_color 
end 
x = 4 + index % 1 * (288 + 32) 
y = index / 1 * 32 
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, 24, 24), opacity) 
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0) 
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2) 
end 
  
def update_help 
@help_window.set_text(self.skill == nil ? "" : self.skill.description) 
end 
end 

class Window_Target2 < Window_Selectable 
  
def initialize 
super(0, 0, 320, 400) 
self.contents = Bitmap.new(width - 32, height - 32) 
self.contents.font.name = $fontface 
self.contents.font.size = 18 
self.z += 10 
@item_max = $game_party.actors.size 
refresh 
end 
  
def refresh 
self.contents.clear 
for i in 0...$game_party.actors.size 
x = 4 
y = i *  90 
actor = $game_party.actors[i] 
draw_actor_face(actor, x, y + 70) 
draw_actor_name(actor, x + 40, y) 
draw_actor_class(actor, x + 200, y + 32) 
draw_actor_level(actor, x + 200, y + 64) 
draw_actor_state(actor, x + 100, y) 
draw_actor_hp(actor, x + 40, y + 32) 
draw_actor_sp(actor, x + 40, y + 64) 
end 
end 

def draw_actor_face(actor, x, y) 
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) 
cw = bitmap.rect.width / 4 
ch = bitmap.rect.height / 4 
src_rect = Rect.new(0, 0, cw, ch) 
self.contents.blt(x - cw / 23, y - ch, bitmap, src_rect) 
end 


def update_cursor_rect 
    
if @index <= -2 
self.cursor_rect.set(0, (@index + 10) * 90, self.width - 32, 96) 
elsif @index == -1 
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 90 - 20) 
else 
self.cursor_rect.set(0, @index * 90, self.width - 32, 96) 
end 
end 
end 

class Scene_Item2 
  
def main 
@spriteset = Spriteset_Map.new 
@help_window = Window_HelpItemSkill.new 
@help_window.back_opacity = 160 
@help_window.x = -320 
@item_window = Window_Item2.new 
@item_window.back_opacity = 160 
@item_window.help_window = @help_window 
@item_window.x = -320 
@target_window = Window_Target2.new 
@target_window.visible = false 
@target_window.active = false 
@target_window.back_opacity = 160 
@target_window.y = 480 

Graphics.transition 
loop do 
Graphics.update 
Input.update 
update 
if $scene != self 
break 
end 
end 
    
Graphics.freeze 
@help_window.dispose 
@item_window.dispose 
@target_window.dispose 
@spriteset.dispose 
end 
  
def update 
@help_window.update 
if @help_window.x < 0 
@help_window.x +=10 
end 
@item_window.update 
if @item_window.x < 0 
@item_window.x +=10 
end 
@target_window.update 
if @target_window.y > 0 
@target_window.y -= 15 
end  
if @item_window.active 
update_item 
return 
end 
    
if @target_window.active 
update_target 
return 
end 
end 
  
def update_item 
    
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Menu.new(0) 
return 
end 
    
if Input.trigger?(Input::C) 
@item = @item_window.item 
unless @item.is_a?(RPG::Item) 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
      
unless $game_party.item_can_use?(@item.id) 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
$game_system.se_play($data_system.decision_se) 
if @item.scope >= 3 
@item_window.active = false 
@target_window.x = 320 
@target_window.y = 480 
@target_window.visible = true 
@target_window.active = true 
        
if @item.scope == 4 || @item.scope == 6 
@target_window.index = -1 
else 
@target_window.index = 0 
end 
else 
  
if @item.common_event_id > 0 
$game_temp.common_event_id = @item.common_event_id 
$game_system.se_play(@item.menu_se) 
          
if @item.consumable 
$game_party.lose_item(@item.id, 1) 
@item_window.draw_item(@item_window.index) 
end 
          
$scene = Scene_Map.new 
return 
end 
end 
return 
end 
end 
  
def update_target 
    
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
unless $game_party.item_can_use?(@item.id) 
@item_window.refresh 
end 

@item_window.active = true 
@target_window.visible = false 
@target_window.active = false 
@target_window.y = 480 
return 
end 
    
if Input.trigger?(Input::C) 
if $game_party.item_number(@item.id) == 0 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
if @target_window.index == -1 
used = false 
for i in $game_party.actors 
          used |= i.item_effect(@item) 
end 
end 
      
if @target_window.index >= 0 
target = $game_party.actors[@target_window.index] 
used = target.item_effect(@item) 
end 
      
if used 
$game_system.se_play(@item.menu_se) 
if @item.consumable 
$game_party.lose_item(@item.id, 1) 
@item_window.draw_item(@item_window.index) 
end 
        
@target_window.refresh 
if $game_party.all_dead? 
$scene = Scene_Gameover.new 
return 
end 
if @item.common_event_id > 0 
$game_temp.common_event_id = @item.common_event_id 
$scene = Scene_Map.new 
return 
end 
end 
    
unless used 
$game_system.se_play($data_system.buzzer_se) 
end 
return 
end 
end 
end 

class Scene_Skill2 
  
def initialize(actor_index = 0, equip_index = 0) 
@actor_index = actor_index 
end 
  
def main 
@spriteset = Spriteset_Map.new 

@actor = $game_party.actors[@actor_index] 
@help_window = Window_HelpItemSkill.new 
@help_window.back_opacity = 160 
@help_window.x = -320 
@status_window = Window_SkillStatus2.new(@actor) 
@status_window.back_opacity = 160 
@status_window.x = -320 
@skill_window = Window_Skill2.new(@actor) 
@skill_window.back_opacity = 160 
@skill_window.help_window = @help_window 
@skill_window.x = -320 
@target_window = Window_Target2.new 
@target_window.visible = false 
@target_window.active = false 
@target_window.back_opacity = 160 
@target_window.y = 480 
    
Graphics.transition 
    
loop do 
Graphics.update 
Input.update 
update 
if $scene != self 
break 
end 
end 
    
Graphics.freeze 
@help_window.dispose 
@status_window.dispose 
@skill_window.dispose 
@target_window.dispose 
@spriteset.dispose 
end 
  
def update 
@help_window.update 
if @help_window.x < 0 
@help_window.x += 10 
end 
@status_window.update 
if @status_window.x < 0 
@status_window.x += 10 
end 
@skill_window.update 
if @skill_window.x < 0 
@skill_window.x += 10 
end 
@target_window.update 
if @target_window.y > 0 
@target_window.y -= 15 
end 
if @skill_window.active 
update_skill 
return 
end 
    
if @target_window.active 
update_target 
return 
end 
end 
  
def update_skill 
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Menu.new(1) 
return 
end 
    
if Input.trigger?(Input::C) 
@skill = @skill_window.skill 
if @skill == nil or not @actor.skill_can_use?(@skill.id) 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
  
$game_system.se_play($data_system.decision_se) 
if @skill.scope >= 3 
@skill_window.active = false 
@target_window.x = 320 
@target_window.y = 480 
@target_window.visible = true 
@target_window.active = true 
      
if @skill.scope == 4 || @skill.scope == 6 
@target_window.index = -1 
elsif @skill.scope == 7 
@target_window.index = @actor_index - 10 
else 
@target_window.index = 0 
end 
else 
if @skill.common_event_id > 0 
$game_temp.common_event_id = @skill.common_event_id 
$game_system.se_play(@skill.menu_se) 
@actor.sp -= @skill.sp_cost 
@status_window.refresh 
@skill_window.refresh 
@target_window.refresh 
$scene = Scene_Map.new 
return 
end 
end 
return 
end 
    
if Input.trigger?(Input::R) 
$game_system.se_play($data_system.cursor_se) 
@actor_index += 1 
@actor_index %= $game_party.actors.size 
$scene = Scene_Skill.new(@actor_index) 
return 
end 
    
if Input.trigger?(Input::L) 
$game_system.se_play($data_system.cursor_se) 
@actor_index += $game_party.actors.size - 1 
@actor_index %= $game_party.actors.size 
$scene = Scene_Skill.new(@actor_index) 
return 
end 
end 
  
def update_target 
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
@skill_window.active = true 
@target_window.visible = false 
@target_window.active = false 
if @skill_window.active = true 
@target_window.y = 480 
end 
return 
end 
  
if Input.trigger?(Input::C) 
unless @actor.skill_can_use?(@skill.id) 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
      
if @target_window.index == -1 
used = false 
for i in $game_party.actors 
used |= i.skill_effect(@actor, @skill) 
end 
end 
      
if @target_window.index <= -2 
target = $game_party.actors[@target_window.index + 10] 
used = target.skill_effect(@actor, @skill) 
end 
      
if @target_window.index >= 0 
target = $game_party.actors[@target_window.index] 
used = target.skill_effect(@actor, @skill) 
end 
      
if used 
$game_system.se_play(@skill.menu_se) 
@actor.sp -= @skill.sp_cost 
@status_window.refresh 
@skill_window.refresh 
@target_window.refresh 
        
if $game_party.all_dead? 
$scene = Scene_Gameover.new 
return 
end 
        
if @skill.common_event_id > 0 
$game_temp.common_event_id = @skill.common_event_id 
$scene = Scene_Map.new 
return 
end 
end 
    
unless used 
$game_system.se_play($data_system.buzzer_se) 
end 
return 
end 
end 
end 

class Scene_Equip2 
  
def initialize(actor_index = 0, equip_index = 0) 
@actor_index = actor_index 
@equip_index = equip_index 
end 
  
def main 
@spriteset = Spriteset_Map.new 
@actor = $game_party.actors[@actor_index] 
@help_window = Window_Help.new 
@help_window.back_opacity = 160 
@left_window = Window_EquipLeft.new(@actor) 
@left_window.back_opacity = 160 
@right_window = Window_EquipRight.new(@actor) 
@right_window.back_opacity = 160 
@item_window1 = Window_EquipItem.new(@actor, 0) 
@item_window1.back_opacity = 160 
@item_window2 = Window_EquipItem.new(@actor, 1) 
@item_window2.back_opacity = 160 
@item_window3 = Window_EquipItem.new(@actor, 2) 
@item_window3.back_opacity = 160 
@item_window4 = Window_EquipItem.new(@actor, 3) 
@item_window4.back_opacity = 160 
@item_window5 = Window_EquipItem.new(@actor, 4) 
@item_window5.back_opacity = 160 
@right_window.help_window = @help_window 
@item_window1.help_window = @help_window 
@item_window2.help_window = @help_window 
@item_window3.help_window = @help_window 
@item_window4.help_window = @help_window 
@item_window5.help_window = @help_window 
@right_window.index = @equip_index 
    
refresh 
Graphics.transition 
loop do 
Graphics.update 
Input.update 
      
update 
if $scene != self 
break 
end 
end 
    
Graphics.freeze 
@help_window.dispose 
@left_window.dispose 
@right_window.dispose 
@item_window1.dispose 
@item_window2.dispose 
@item_window3.dispose 
@item_window4.dispose 
@item_window5.dispose 
@spriteset.dispose 
end 
  
def refresh 
@item_window1.visible = (@right_window.index == 0) 
@item_window2.visible = (@right_window.index == 1) 
@item_window3.visible = (@right_window.index == 2) 
@item_window4.visible = (@right_window.index == 3) 
@item_window5.visible = (@right_window.index == 4) 
    
item1 = @right_window.item 
    
case @right_window.index 
when 0 
@item_window = @item_window1 
when 1 
@item_window = @item_window2 
when 2 
@item_window = @item_window3 
when 3 
@item_window = @item_window4 
when 4 
@item_window = @item_window5 
end 
    
if @right_window.active 
      
@left_window.set_new_parameters(nil, nil, nil) 
end 
    
if @item_window.active 
item2 = @item_window.item 
last_hp = @actor.hp 
last_sp = @actor.sp 
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id) 
new_atk = @actor.atk 
new_pdef = @actor.pdef 
new_mdef = @actor.mdef 
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id) 
@actor.hp = last_hp 
@actor.sp = last_sp 
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef) 
end 
end 
  
def update 
@left_window.update 
@right_window.update 
@item_window.update 
refresh 
    
if @right_window.active 
update_right 
return 
end 
    
if @item_window.active 
update_item 
return 
end 
end 
  
def update_right 
    
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Menu.new(2) 
return 
end 

if Input.trigger?(Input::C) 
if @actor.equip_fix?(@right_window.index) 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
      
$game_system.se_play($data_system.decision_se) 
@right_window.active = false 
@item_window.active = true 
@item_window.index = 0 
return 
end 
    
if Input.trigger?(Input::R) 
$game_system.se_play($data_system.cursor_se) 
@actor_index += 1 
@actor_index %= $game_party.actors.size 
$scene = Scene_Equip.new(@actor_index, @right_window.index) 
return 
end 

if Input.trigger?(Input::L) 
$game_system.se_play($data_system.cursor_se) 
@actor_index += $game_party.actors.size - 1 
@actor_index %= $game_party.actors.size 
$scene = Scene_Equip.new(@actor_index, @right_window.index) 
return 
end 
end 
  
def update_item 
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
@right_window.active = true 
@item_window.active = false 
@item_window.index = -1 
return 
end 
    
if Input.trigger?(Input::C) 
$game_system.se_play($data_system.equip_se) 
item = @item_window.item 
@actor.equip(@right_window.index, item == nil ? 0 : item.id) 
@right_window.active = true 
@item_window.active = false 
@item_window.index = -1 
@right_window.refresh 
@item_window.refresh 
return 
end 
end 
end 

class Scene_Status2 
def initialize(actor_index = 0, equip_index = 0) 
@actor_index = actor_index 
end 
  
def main 
@spriteset = Spriteset_Map.new 
@actor = $game_party.actors[@actor_index] 
@status_window = Window_Status.new(@actor) 
@status_window.back_opacity = 160 
Graphics.transition 
loop do 
Graphics.update 
Input.update 
update 
      
if $scene != self 
break 
end 
end 
    
Graphics.freeze 
@status_window.dispose 
@spriteset.dispose 
end 
  
def update 
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Menu.new(3) 
return 
end 
    
if Input.trigger?(Input::R) 
$game_system.se_play($data_system.cursor_se) 
@actor_index += 1 
@actor_index %= $game_party.actors.size 
$scene = Scene_Status.new(@actor_index) 
return 
end 
    
if Input.trigger?(Input::L) 
$game_system.se_play($data_system.cursor_se) 
@actor_index += $game_party.actors.size - 1 
@actor_index %= $game_party.actors.size 
$scene = Scene_Status.new(@actor_index) 
return 
end 
end 
end 

class Scene_End2 
  
def main 
@spriteset = Spriteset_Map.new 
s1 = "To Title" 
s2 = "Shutdown" 
s3 = "Cancel" 
@command_window2 = Window_Command.new(192, [s1, s2, s3]) 
@command_window2.x = -192 
@command_window2.y = 240 - @command_window2.height / 2 
@command_window2.back_opacity = 160 
Graphics.transition 
loop do 
Graphics.update 
Input.update 
update 
if $scene != self 
break 
end 
end 
Graphics.freeze 
@command_window2.dispose 
@spriteset.dispose 
if $scene.is_a?(Scene_Title) 
Graphics.transition 
Graphics.freeze 
end 
end 
  
def update 
@command_window2.update 

if@command_window2.x < 320 - @command_window2.width / 2 
@command_window2.x += 10 
end 

if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Menu.new(8) 
return 
end 
if Input.trigger?(Input::C) 
case @command_window2.index 
when 0  
$game_system.se_play($data_system.decision_se) 
Audio.bgm_fade(800) 
Audio.bgs_fade(800) 
Audio.me_fade(800) 
$scene = Scene_Title.new 
when 1  
$game_system.se_play($data_system.decision_se) 
Audio.bgm_fade(800) 
Audio.bgs_fade(800) 
Audio.me_fade(800) 
$scene = nil 
when 2  
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Menu.new(8) 
end 
return 
end 
end 
end 

class Window_SelectableOp < Window_Base 
  
attr_reader   :index                    
attr_reader   :help_window              
  
def initialize(x, y, width, height) 
super(x, y, width, height) 
@item_max = 1 
@column_max = 1 
@index = -1 
end 
  
def index=(index) 
@index = index 
if self.active and @help_window != nil 
update_help 
end 
update_cursor_rect 
end 
  
def row_max 
return (@item_max + @column_max - 1) / @column_max 
end 
  
def top_row 
return self.oy / 32 
end 
  
def top_row=(row) 
if row < 0 
row = 0 
end 
    
if row > row_max - 1 
row = row_max - 1 
end 
self.oy = row * 32 
end 
  
def page_row_max 
return (self.height - 32) / 32 
end 
  
def page_item_max 
return page_row_max * @column_max 
end 
  
def help_window=(help_window) 
@help_window = help_window 
if self.active and @help_window != nil 
update_help 
end 
end 
  
def update_cursor_rect 
if @index < 0 
self.cursor_rect.empty 
return 
end 
row = @index / @column_max 
if row < self.top_row 
self.top_row = row 
end 
if row > self.top_row + (self.page_row_max - 1) 
self.top_row = row - (self.page_row_max - 1) 
end 
cursor_width = self.width / @column_max - 32 
x = @index % @column_max * (cursor_width + 32) 
y = @index / @column_max * 32 - self.oy 
self.cursor_rect.set(x, y, cursor_width, 32) 
end 
  
def update 
super 
if self.active and @item_max > 0 and @index >= 0 
      
if Input.repeat?(Input::DOWN) 
if index == 8 
$game_system.se_play($data_system.cursor_se) 
@index -= 8 
end 
if @column_max >= 1 and @index < @item_max - 1 
$game_system.se_play($data_system.cursor_se) 
@index += 1 
elsif @column_max >= 1 and @index >= 0 
$game_system.se_play($data_system.cursor_se) 
@index -= 7 
end 
end 
      
if Input.repeat?(Input::UP) 
if index == 1 
$game_system.se_play($data_system.cursor_se) 
@index += 8 
end 
if @column_max >= 1 and @index > 0 
$game_system.se_play($data_system.cursor_se) 
@index -= 1 
end 
end 
      
if Input.repeat?(Input::RIGHT) 
if @column_max >= 2 and @index < @item_max - 1 
$game_system.se_play($data_system.cursor_se) 
@index += 1 
end 
end 
      
if Input.repeat?(Input::LEFT) 
if @column_max >= 2 and @index > 0 
$game_system.se_play($data_system.cursor_se) 
@index -= 1 
end 
end 
      
if Input.repeat?(Input::R) 
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1) 
$game_system.se_play($data_system.cursor_se) 
@index = [@index + self.page_item_max, @item_max - 1].min 
self.top_row += self.page_row_max 
end 
end 
      
if Input.repeat?(Input::L) 
if self.top_row > 0 
$game_system.se_play($data_system.cursor_se) 
@index = [@index - self.page_item_max, 0].max 
self.top_row -= self.page_row_max 
end 
end 
end 
if self.active and @help_window != nil 
update_help 
end 
update_cursor_rect 
end 
end 

class Window_CommandOp < Window_SelectableOp 
  
def initialize(width, commands) 
super(0, 0, width, commands.size * 32 + 32) 
@item_max = commands.size 
@commands = commands 
self.contents = Bitmap.new(width - 32, @item_max * 32) 
self.contents.font.name = $fontface 
self.contents.font.size = $fontsize 
refresh 
self.index = 0 
end 
  
def refresh 
self.contents.clear 
for i in 0...@item_max 
draw_item(i, normal_color) 
end 
end 
  
def draw_item(index, color) 
self.contents.font.color = color 
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32) 
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) 
bitmap = RPG::Cache.icon("color0" + index.to_s) 
self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity) 
self.contents.draw_text(rect, @commands[index]) 
self.contents.font.name = "Arial" 
self.contents.font.color = system_color 
self.contents.draw_text(0, 0, 120, 32, "Interface") 
self.contents.draw_text(0, 0, 120, 544, "Return") 
end 
  
def disable_item(index) 
draw_item(index, disabled_color) 
end 
end 

class Scene_WindowOp 
  
def main 
@spriteset = Spriteset_Map.new 
s1 = "" 
s2 = "     Green" 
s3 = "     Blue" 
s4 = "     Red" 
s5 = "     Black" 
s6 = "     Yellow" 
s7 = "     Purple" 
s8 = "     Navy" 
s9 = "" 
@command_window2 = Window_CommandOp.new(192, [s1, s2, s3, s4, s5, s6, s7, s8, s9]) 
@command_window2.x = 640 
@command_window2.y = 240 - @command_window2.height / 2 
@command_window2.index = 1 
@command_window2.back_opacity = 160 

Graphics.transition 
loop do 
Graphics.update 
Input.update 
update 
if $scene != self 
break 
end 
end 

Graphics.freeze 
@command_window2.dispose 
@spriteset.dispose 
if $scene.is_a?(Scene_Title) 
Graphics.transition 
Graphics.freeze 
end 
end 
  
def update 
@command_window2.update 
if @command_window2.x > 320 - @command_window2.width / 2 
@command_window2.x -=15 
end 

if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Menu.new(7) 
return 
end 
if Input.trigger?(Input::C) 
case @command_window2.index 
when 0  
when 1  
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin00" 
$scene = Scene_Menu.new(7) 
when 2 
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin01" 
$scene = Scene_Menu.new(7) 
when 3 
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin02" 
$scene = Scene_Menu.new(7) 
when 4 
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin03" 
$scene = Scene_Menu.new(7) 
when 5 
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin04" 
$scene = Scene_Menu.new(7) 
when 6 
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin05" 
$scene = Scene_Menu.new(7) 
when 7 
$game_system.se_play($data_system.decision_se) 
$game_system.windowskin_name = "skin06" 
$scene = Scene_Menu.new(7) 
when 8  
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Menu.new(7)  
end 
return 
end 
end 
end 



class Window_NewMenuStatus < Window_Selectable 

def initialize 
super(204, 64, 160, 240) 
self.contents = Bitmap.new(width - 32, height - 32) 
refresh 
self.active = false 
self.index = -1 
end 

def refresh 
self.contents.clear 
self.contents.font.name = $fontface 
@item_max = $game_party.actors.size 
for i in 0...$game_party.actors.size 
x = 80 
y = 50 * i 
actor = $game_party.actors[i] 
draw_actor_face(actor, x - 72, y + 47) 
draw_actor_name(actor, x - 20, y + 6) 
end 
end 

def update_cursor_rect 
if @index < 0 
self.cursor_rect.empty 
else 
self.cursor_rect.set(0, @index * 50, self.width - 34, 48) 
end 
end 

def draw_actor_face(actor, x, y) 
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) 
cw = bitmap.rect.width / 4 
ch = bitmap.rect.height / 4 
src_rect = Rect.new(0, 0, cw, ch) 
self.contents.blt(x - cw / 23, y - ch, bitmap, src_rect) 
end 
end 

class Scene_Menu 

def initialize(menu_index = 0) 
@menu_index = menu_index 
end 
  
def main 
@spriteset = Spriteset_Map.new 
s1 = "     Item"      
s2 = "     Skill"  
s3 = "     Equip" 
s4 = "     Status" 
s5 = "     Save" 
s6 = "     Gold" 
s7 = "     Playtime" 
s8 = "     Window" 
s9 = "     End Game" 
@command_window = Window_Command_Menu.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9]) #this 
@command_window.index = @menu_index 
@command_window.x = -160 
@command_window.back_opacity = 160 
if $game_party.actors.size == 0 
@command_window.disable_item(0) 
@command_window.disable_item(1) 
@command_window.disable_item(2) 
@command_window.disable_item(3) 
end 
if $game_system.save_disabled 
@command_window.disable_item(4) 
end 

@playtime_window = Window_PlayTime.new 
@playtime_window.x = -200 
@playtime_window.y = 208 
@playtime_window.back_opacity = 160 
@playtime_window.visible = false 
    

@gold_window = Window_Gold.new 
@gold_window.x = -200 
@gold_window.y = 176 
@gold_window.back_opacity = 160 
@gold_window.visible = false 

@status_window = Window_NewMenuStatus.new 
@status_window.x = -200 
@status_window.y = 0 
@status_window.back_opacity = 160 
@status_window.visible = false 
    
Graphics.transition 
loop do 
Graphics.update 
Input.update 
update 
if $scene != self 
break 
end 
end 
Graphics.freeze 
@command_window.dispose 
@playtime_window.dispose 
@gold_window.dispose 
@status_window.dispose 
@spriteset.dispose 
end 
  
def update 
@command_window.update 
@playtime_window.update 
@gold_window.update 
@status_window.update 

if @command_window.x < 0 
@command_window.x += 5 
end 

if @playtime_window.visible 
if @playtime_window.x < 160 
@playtime_window.x += 10 
end 
end 

if @command_window.active 
update_command 
return 
end 
    
if @status_window.active 
if @status_window.x < 160 
@status_window.x += 10 
end 
update_status 
return 
end 
if @gold_window.active 
if @gold_window.x < 160 
@gold_window.x += 10 
end 
update_status 
return 
end 
if @playtime_window.active 
update_status 
return 
end 
end 
  
def update_command 
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
$scene = Scene_Map.new 
return 
end 
if Input.trigger?(Input::C) 
if $game_party.actors.size == 0 and @command_window.index < 4 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
      
case @command_window.index 
when 0 
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Item2.new 
when 1 
$game_system.se_play($data_system.decision_se) 
@command_window.active = false 
@status_window.visible = true 
@status_window.active = true 
@status_window.index = 0 
@status_window.x = -200 
@status_window.y = 48 
when 2 
$game_system.se_play($data_system.decision_se) 
@command_window.active = false 
@status_window.visible = true 
@status_window.active = true 
@status_window.index = 0 
@status_window.x = -200 
@status_window.y = 80 
when 3 
$game_system.se_play($data_system.decision_se) 
@command_window.active = false 
@status_window.visible = true 
@status_window.active = true 
@status_window.index = 0 
@status_window.x = -200 
@status_window.y = 112 
when 4  
if $game_system.save_disabled 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Save.new 
when 5 
$game_system.se_play($data_system.decision_se) 
@command_window.active = false 
@gold_window.visible = true 
when 6 
$game_system.se_play($data_system.decision_se) 
@command_window.active = false 
@playtime_window.visible = true 
when 7 
$game_system.se_play($data_system.decision_se) 
$scene = Scene_WindowOp.new 
when 8  
$game_system.se_play($data_system.decision_se) 
$scene = Scene_End2.new 
end 
return 
end 
end 
  
def update_status 
if Input.trigger?(Input::B) 
$game_system.se_play($data_system.cancel_se) 
@command_window.active = true 
@gold_window.visible = false 
@playtime_window.visible = false 
@status_window.active = false 
@status_window.visible = false 
@status_window.index = -1 
@status_window.x = -200 
@gold_window.x = -200 
@playtime_window.x = -200 
return 
end 
if Input.trigger?(Input::C) 

case @command_window.index 
when 1  
if $game_party.actors[@status_window.index].restriction >= 2 
$game_system.se_play($data_system.buzzer_se) 
return 
end 
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Skill2.new(@status_window.index) 
when 2  
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Equip2.new(@status_window.index) 
when 3  
$game_system.se_play($data_system.decision_se) 
$scene = Scene_Status2.new(@status_window.index) 
end 
return 
end 
end 
end

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Clique aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!