26-01-15, 13:48
Witam po długiej przerwie. Mam problem. Korzystam ze skryptu "Menu jednoosobowe" i gdy np. wejdę w ekwipunek i dam ESC to kursor jest na następnej pozycji (w tym wypadku status). Niby nic, ale przy anulowaniu wyjścia robi się takie coś:
Oto skrypt:
Oto skrypt:
Kod:
==============================================================================
# Menu Jednoosobowe [VX]
#==============================================================================
# Autor: Matheus2
# Poprawki by Ayene
# Skrypt zmienia menu na jednoosobowe - wyświetlane są dane tylko
# pierwszej osoby w drużynie.
#==============================================================================
module Ayene
# Wyświetla awatar postaci zamiast characters
AWATAR_ZAMIAST_CHARA = true
end
#------------------------------------------------------------------------------#
# Game_Party
#------------------------------------------------------------------------------#
class Game_Party < Game_Unit
MAX_MEMBERS = 1
end
#------------------------------------------------------------------------------#
# Game_Map
#------------------------------------------------------------------------------#
class Game_Map
attr_reader :map_id
def namemap
@name_map = load_data("Data/MapInfos.rvdata")
@name_map[@map_id].name
end
end
#------------------------------------------------------------------------------#
# Window_Time
#------------------------------------------------------------------------------#
class Window_Time < Window_Base
def initialize(x,y)
super(x, y, 144, 56)
self.x = x
self.y = y
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 24, text)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#------------------------------------------------------------------------------#
# Window_Map
#------------------------------------------------------------------------------#
class Window_Map < Window_Base
def initialize(x,y)
super(x, y, 240, 56)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, 200, 32, $game_map.namemap.to_s)
end
end
#------------------------------------------------------------------------------#
# Window_MenuStatus
#------------------------------------------------------------------------------#
class Window_MenuStatus < Window_Selectable
def initialize(x, y)
super(0, 144, 544, 128)
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
actor = $game_party.members[0]
if Ayene::AWATAR_ZAMIAST_CHARA
draw_actor_face(actor, 2, 2, 92)
else
draw_actor_graphic(actor, 40, 60)
end
x = 104
y = actor.index * 96 + WLH / 2
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x, y + WLH * 2)
draw_actor_hp(actor, x + 120, y + WLH * 1)
end
def update_cursor
if @index < 0
self.cursor_rect.empty
elsif @index < @item_max
self.cursor_rect.set(0, @index * 96, contents.width, 96)
elsif @index >= 100
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
end
#------------------------------------------------------------------------------#
# Scene_Menu
#------------------------------------------------------------------------------#
class Scene_Menu < Scene_Base
def initialize(menu_index = 0)
@menu_index = menu_index
end
def start
super
create_menu_background
create_command_window
@gold_window = Window_Gold.new(0, 360)
@status_window = Window_MenuStatus.new(160, 0)
@map_window = Window_Map.new(160, 360)
@time_window = Window_Time.new(400, 360)
end
def terminate
super
dispose_menu_background
@command_window.dispose
@gold_window.dispose
@status_window.dispose
@map_window.dispose
@time_window.dispose
end
def update
super
update_menu_background
@command_window.update
@gold_window.update
@time_window.update
update_command_selection
end
def create_command_window
s1 = Vocab::item
s2 = Vocab::equip
s3 = Vocab::status
s4 = Vocab::save
s5 = Vocab::game_end
@command_window = Window_Command.new(544,[s1, s2, s3, s4, s5],5,0,10)
@command_window.index = @menu_index
if $game_party.members.size == 0
@command_window.draw_item(0, false)
@command_window.draw_item(1, false)
@command_window.draw_item(2, false)
@command_window.draw_item(3, false)
end
if $game_system.save_disabled
@command_window.draw_item(4, false)
end
end
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0
$scene = Scene_Item.new
when 1
$scene = Scene_Equip.new(0)
when 2
$scene = Scene_Status.new(0)
when 3
$scene = Scene_File.new(true, false, false)
when 4
$scene = Scene_End.new
end
end
end
end
def create_command_window
s1 = Vocab::item
s2 = Vocab::equip
s3 = Vocab::status
s4 = Vocab::save
s5 = Vocab::game_end
@command_window = Window_Command.new(544,[s1, s2, s3, s4, s5],5,0,10)
@command_window.index = @menu_index
if $game_party.members.size == 0
@command_window.draw_item(0, false)
@command_window.draw_item(1, false)
@command_window.draw_item(2, false)
end
if $game_system.save_disabled
@command_window.draw_item(3, false)
end
end
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0
$scene = Scene_Item.new
when 1
$scene = Scene_Equip.new(0)
when 2
$scene = Scene_Status.new(0)
when 3
$scene = Scene_File.new(true, false, false)
when 4
$scene = Scene_End.new
end
end
end