Ребят помогите совместить скрипты меню и бестиария.
МЕНЮ
Код:
#===============================================================================
# * Main Menu Evo II *Version 3*
# * Successor to Main Menu EVO
# * By Crazyninjaguy
# * http://www.planetdev.co.uk
# * Part of CNG Engine Evolution
# ---------------------------------------------------------------------------
# * Version 3 Changelog
# ---------------------------------------------------------------------------
# * Added support for 640 x 480 resolution
#===============================================================================
# * Compatible With:
# ---------------------------------------------------------------------------
# * Battle/Map BGM Selector Evo
#===============================================================================
$imported = {} if $imported == nil
$imported["CEE-MainMenuEvoII"] = true
module CngEvo
module Menu
#===========================================================================
# * Load System data to prevent errors when loading Vocab terms
#===========================================================================
$data_system = load_data("Data/System.rvdata")
#===========================================================================
# * Menu Commands, seperate each value with a comma.
# * To add new commands, either use a Vocab entry (See the Vocab Module),
# Or use a text string in quotes, example: "Quests"
#===========================================================================
COMMANDS = [
Vocab::item,
Vocab::skill,
Vocab::equip,
Vocab::status,
Vocab::save,
Vocab::game_end]
#===========================================================================
# * These are the icons that display next to the command option in the menu.
# * The best way to find the number of the icon is to use Yanfly's
# YEM IconView Melody, and look for the ID number.
# * Seperate each number with a comma.
#===========================================================================
ICONS = [
144,
128,
32,
106,
141,
142]
#===========================================================================
# * These are the scenes to call for each menu command.
# * Copy the existing examples to add new ones.
# * The last value (True/False) is whether or not you need to select an
# an actor to continue onto that scene.
# * True = Select an Actor.
# * False = Don't select one.
#===========================================================================
SCENES = [
[Scene_Item, false],
[Scene_Skill, true],
[Scene_Equip, true],
[Scene_Status, true],
[Scene_File, false],
[Scene_End, false]]
#===========================================================================
# * These are the Playtime, Steps, Map Name and Gold icons.
# * As with the others, seperate with a comma
#===========================================================================
INFO_ICONS = [
188,
48,
153,
205]
end # Menu
end # CngEvo
#===============================================================================
# * Scene_Menu Class, Processes the main menu.
#===============================================================================
class Scene_Menu < Scene_Base
#=============================================================================
# * Include the Menu module and initialize the command_window index
#=============================================================================
include CngEvo::Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end # initialize
#=============================================================================
# * Start the scene by creating windows etc
#=============================================================================
def start
super
create_menu_background
create_command_window
@status_window = Window_MenuEvoStatus.new
@menuinfo = Window_MenuInfo.new
end # start
#=============================================================================
# * End the scene and dispose windows etc
#=============================================================================
def terminate
super
dispose_menu_background
@command_window.dispose
@status_window.dispose
@menuinfo.dispose
end # terminate
#=============================================================================
# * Update the scene's windows
#=============================================================================
def update
super
@menuinfo.update
if @command_window.active
@command_window.update
update_command
elsif @status_window.active
@status_window.update
update_actor_selection
end
end # update
#=============================================================================
# * Create the main command window
#=============================================================================
def create_command_window
@command_window = Window_IconCommand.new(164, COMMANDS)
@command_window.index = @menu_index
if COMMANDS.size > 7
@command_window.height = (Graphics.height - 192)
end
end # create_command_window
#=============================================================================
# * Update the command window, and process choices
#=============================================================================
def update_command
if Input.trigger?(Input::C)
Sound.play_decision
if SCENES[@command_window.index][1] == false
if SCENES[@command_window.index][0] == Scene_File
$scene = SCENES[@command_window.index][0].new(true, false, false)
else
$scene = SCENES[@command_window.index][0].new
end
else
start_actor_selection
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
end
end # update_command
end # Scene_Menu
#===============================================================================
# * Window_MenuEvoStatus, this window is a Window_MenuStatus Replacement
#===============================================================================
class Window_MenuEvoStatus < Window_Selectable
#=============================================================================
# * Initialize the window, ans setup values
#=============================================================================
def initialize
super(0, (Graphics.height - 192), Graphics.width, 192)
refresh
self.active = false
self.index = -1
end # initialize
#=============================================================================
# * Draw window contents
#=============================================================================
def refresh
self.contents.clear
@item_max = $game_party.members.size
@facesprites = []
for actor in $game_party.members
x = actor.index * 128 + 16
draw_actor_evoface(actor, x, 64)
draw_actor_graphic(actor, x + 14, 158)
draw_actor_name(actor, x - 12, 0)
draw_actor_level(actor, x - 12, 32)
draw_actor_state(actor, x + 80, 0)
draw_actor_hp(actor, x - 12, 64)
draw_actor_mp(actor, x - 12, 96)
end
end # refresh
#=============================================================================
# * Update cursor
#=============================================================================
def update_cursor
if @index < 0 # No cursor
self.cursor_rect.empty
elsif @index < @item_max # Normal
self.cursor_rect.set((@index * ((Graphics.width - 32) / 4)), 0, ((Graphics.width - 32) / 4), 160)
elsif @index >= 100 # Self
self.cursor_rect.set((@index * ((Graphics.width - 32) / 4)), 0, ((Graphics.width - 32) / 4), 160)
else # All
self.cursor_rect.set(0, 0, contents.width, 160)
end
end # update_cursor
#=============================================================================
# * Add support for horizontal scrolling
#=============================================================================
def update
super
if cursor_movable?
last_index = @index
if Input.repeat?(Input::RIGHT)
if @index == 0
if $game_party.members.size > 1
@index = 1
end
elsif @index == 1
if $game_party.members.size > 2
@index = 2
end
elsif @index == 2
if $game_party.members.size > 3
@index = 3
end
elsif @index == 3
if $game_party.members.size >= 4
@index = 0
end
end
elsif Input.repeat?(Input::LEFT)
if @index == 0
if $game_party.members.size >= 4
@index = 3
end
elsif @index == 1
@index = 0
elsif @index == 2
@index = 1
elsif @index == 3
@index = 2
end
end
if @index != last_index
Sound.play_cursor
end
end
update_cursor
call_update_help
end # update
end # Window_MenuEvoStatus
#===============================================================================
# * Window_MenuInfo class, this window draws Playtime, Steps etc.
#===============================================================================
class Window_MenuInfo < Window_Base
#=============================================================================
# * Include the Menu module and setup window size
#=============================================================================
include CngEvo::Menu
def initialize
super((Graphics.width - 260), 0, 260, 128)
refresh
end # initialize
#=============================================================================
# * Draw Window contents
#=============================================================================
def refresh
self.contents.clear
draw_icon(INFO_ICONS[1], 0, 24) # Steps
draw_icon(INFO_ICONS[2], 0, 48) # Map Name
draw_icon(INFO_ICONS[3], 0, 72) # Area
draw_time
self.contents.draw_text(0, 24, width - 32, WLH, $game_party.steps, 2)
@map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
self.contents.draw_text(0, 48, width - 32, WLH, @map_name, 2)
self.contents.draw_text(0, 72, width - 32, WLH, $game_party.gold, 2)
end # refresh
#=============================================================================
# * Check if Playtime is different from last check
#=============================================================================
def update
if @text != (Graphics.frame_count / Graphics.frame_rate)
draw_time
end
super
end # update
#=============================================================================
# * Draw playtime info
#=============================================================================
def draw_time
self.contents.clear_rect(Rect.new(0, 0, (260 - 32), 24))
draw_icon(INFO_ICONS[0], 0, 0) # Playtime
@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.draw_text(0, 0, width - 32, WLH, @text, 2)
end # draw_time
end # Window_MenuInfo
#===============================================================================
# * Window_Base Edits to allow for face opacity changing
#===============================================================================
class Window_Base < Window
#=============================================================================
# * Draw the character's face graphic
#=============================================================================
def draw_evoface(face_name, face_index, x, y, size = 96)
opacity = 100
bitmap = Cache.face(face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4 * 96 + (96 - size) / 2
rect.y = face_index / 4 * 96 + (96 - size) / 2
rect.width = size
rect.height = size
self.contents.blt(x, y, bitmap, rect, opacity)
bitmap.dispose
end # draw_evoface
#=============================================================================
# * Call the draw_evoface method with the relevant arguments
#=============================================================================
def draw_actor_evoface(actor, x, y, size = 96)
draw_evoface(actor.face_name, actor.face_index, x, y, size)
end # draw_actor_evoface
end # Window_Base
#===============================================================================
# * Scene_File edit for returning to the right menu option
#===============================================================================
class Scene_File < Scene_Base
#=============================================================================
# * Return to the previous scene
#=============================================================================
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(5)
end
end # return_scene
end # Scene_File
#===============================================================================
# * Window_Command clone to support icon drawing and scrolling with commands
#===============================================================================
class Window_IconCommand < Window_Selectable
#=============================================================================
# * Include the menu module, and initialize the window
#=============================================================================
include CngEvo::Menu
attr_reader :commands # command
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(0, 0, width, row_max * WLH + 32, spacing)
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end # initialize
#=============================================================================
# * Draw window options
#=============================================================================
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end # refresh
#=============================================================================
# * Draw the text, and icon.
#=============================================================================
def draw_item(index)
icon = ICONS[index]
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = true ? 255 : 128
self.contents.draw_text(rect.x + 24, rect.y, rect.width, rect.height, @commands[index])
draw_icon(icon, rect.x - 2, rect.y)
end # draw_item
end # Window_IconCommand
БЕСТИАРИЙ
Код:
#===============================================================
# ● [VX] ◦ Monster Book ◦ □
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 10/08/2008
# ◦ Version: 1.0
#--------------------------------------------------------------
# ** HOW TO USE
#--------------------------------------------------------------
# * Call Scene Monster Book by call script:
# $scene = Scene_MonsterBook.new
# * Complete all enemies' information by call script:
# $game_system.set_monbook_complete
# * Clear all enemies' information by call script:
# $game_system.reset_monbook
#--------------------------------------------------------------
# * Show enemy's information by call script:
# $game_system.monbook[enemy_id] = true
# * Hide enemy's information by call script:
# $game_system.monbook[enemy_id] = false
# ^ Change enemy_id to ID of enemy you want
# ** e.g. $game_system.monbook[10] = true
#===============================================================
module Wora_Monbook
#===============================================================
# ** [Setup Part] - Config script in this part
#--------------------------------------------------------------
SHOW_IN_MENU = true # Show Monster Book in Menu Command? (true / false)
MENU_COMMAND = 'Бестиарий' # Menu command name for Monster Book
MENU_INDEX = 4 # Index of menu command you want to insert monster book
TEXT_TITLE = 'Книга Монстров'
# Monster Book Title (Show at top left of the screen)
TEXT_FOUND = 'Обнаружено: '
# Text before number of how many monster are found
TEXT_COMPLETED = 'Завершено: '
# Text before percentage of how many monster are found
TEXT_DOT = '.'
# Text show after enemy's ID (e.g. '.' will make '2.' and ')' will make '2)' )
COMPARE_STATUS = false
# Use Compare Status System? It will compare enemy's status with highest level
# actor in party. Show GREEN number if enemy has lower status.
# Show RED-GRAY number if enemy has higher status. (true / false)
#===============================================================
end
#===============================================================
# ** [Alias] Game_System
#--------------------------------------------------------------
class Game_System
attr_accessor :monbook
alias :wora_monbook_gamsys_ini :initialize
def initialize
wora_monbook_gamsys_ini
create_monbook
end
def create_monbook
@monbook ||= Array.new($data_enemies.size) {false}
end
def set_monbook_complete
@monbook = Array.new($data_enemies.size) {true}
@monbook[0] = false
end
def reset_monbook
@monbook = Array.new($data_enemies.size) {false}
end
end
#===============================================================
# ** [Alias] Game_Troop
#--------------------------------------------------------------
class Game_Troop < Game_Unit
alias :wora_monbook_gamtroop_setup :setup
def setup(*args)
wora_monbook_gamtroop_setup(*args)
$game_system.create_monbook
@enemies.each {|e| $game_system.monbook[e.enemy_id] = true }
end
end
#===============================================================
# ** Window_MonsterBHelp
#--------------------------------------------------------------
class Window_MonsterBHelp < Window_Base
include Wora_Monbook
def initialize
super(0, 0, 544, WLH + 32)
# Write Monster Book Title
contents.font.color = system_color
contents.draw_text(0, 0, contents.width, WLH, TEXT_TITLE)
# Calculate found monster & complete percentage
found_count = 0
$game_system.monbook.each {|e| found_count += 1 if e }
percent_count = (found_count * 100) / ($data_enemies.size - 1)
# Collect & Store Text in variables
found_text = found_count.to_s + '/' + ($data_enemies.size - 1).to_s
percent_text = percent_count.to_s + '%'
mid_text = ' | '
right_text = TEXT_FOUND + found_text + mid_text + TEXT_COMPLETED +
percent_text
# Calculate Text Width
found_t_width = contents.text_size(TEXT_FOUND).width
found_width = contents.text_size(found_text).width
percent_t_width = contents.text_size(TEXT_COMPLETED).width
mid_width = contents.text_size(mid_text).width
right_width = contents.text_size(right_text).width
# Write Monster Found & Complete Percentage
contents.font.color = normal_color
contents.draw_text(contents.width - right_width, 0, contents.width, WLH,
TEXT_FOUND)
contents.draw_text(contents.width - right_width + found_t_width +
found_width, 0, contents.width, WLH, mid_text + TEXT_COMPLETED)
contents.font.color = crisis_color
contents.draw_text(contents.width - right_width + found_t_width, 0,
contents.width, WLH, found_text)
contents.draw_text(contents.width - right_width + found_t_width +
found_width + mid_width + percent_t_width, 0, contents.width, WLH,
percent_text)
end
end
#===============================================================
# ** Window_MonsterBDetail
#--------------------------------------------------------------
class Window_MonsterBDetail < Window_Base
def initialize(window_temp)
super(window_temp.x, window_temp.y, window_temp.width, window_temp.height)
self.opacity = 0
@win_image = Window_Base.new(self.x, self.y, self.width, self.height)
self.z = @win_image.z + 1
@last_enemy = 0
end
def visible=(bool)
super
@win_image.visible = bool
end
def dispose
@win_image.dispose
super
end
def write_detail(enemy_id)
return if @last_enemy == enemy_id
contents.clear
@win_image.contents.clear
@last_enemy = enemy_id
data = $data_enemies[enemy_id]
# Draw Enemy Graphic
bitmap = Cache.battler(data.battler_name, data.battler_hue)
bw = bitmap.width < 220 ? (220 - bitmap.width) / 2 : 0
bh = bitmap.height < 200 ? (200 - bitmap.width)/ 2 : 0
@win_image.contents.blt(bw, bh, bitmap, bitmap.rect)
bitmap.dispose
# Write Name
contents.font.color = normal_color
contents.draw_text(0, 0, contents.width, WLH,
data.id.to_s + Wora_Monbook::TEXT_DOT + ' ' + data.name)
# Write Enemy Status
hpx = 120
draw_enemy_stat(data, contents.width - (hpx * 2) - 32, 0, hpx, 'hp')
draw_enemy_stat(data, contents.width - hpx, 0, hpx, 'mp')
draw_enemy_stat(data, contents.width - (hpx * 2) - 32, WLH * 2, hpx, 'atk')
draw_enemy_stat(data, contents.width - hpx, WLH * 2, hpx, 'def')
draw_enemy_stat(data, contents.width - (hpx * 2) - 32, WLH * 3, hpx, 'spi')
draw_enemy_stat(data, contents.width - hpx, WLH * 3, hpx, 'agi')
draw_enemy_stat(data, contents.width - (hpx * 2) - 32, WLH * 4, hpx, 'hit')
draw_enemy_stat(data, contents.width - hpx, WLH * 4, hpx, 'eva')
draw_enemy_stat(data, contents.width - (hpx * 2) - 32, WLH * 6, hpx, 'exp')
draw_enemy_stat(data, contents.width - hpx, WLH * 6, hpx, 'gold')
rect = Rect.new(contents.width - (hpx * 2) - 8, (WLH * 8) - 8, 216,
(WLH * 4) + 16)
contents.fill_rect(rect, Color.new(0,0,0,140))
lsize = 2 # Line Size
lcolor = Color.new(255,255,255,160) # Line Color
contents.fill_rect(rect.x, rect.y, lsize, rect.height, lcolor)
contents.fill_rect(rect.x, rect.y, rect.width, lsize, lcolor)
contents.fill_rect(rect.x + rect.width - lsize, rect.y, lsize,
rect.height, lcolor)
contents.fill_rect(rect.x, rect.y + rect.height - lsize, rect.width,
lsize, lcolor)
contents.font.color = system_color
contents.draw_text(contents.width - (hpx * 2), WLH * 8, 200, WLH,
'Трофей 1')
draw_enemy_drop(data, 1, contents.width - (hpx * 2), WLH * 9)
contents.font.color = system_color
contents.draw_text(contents.width - (hpx * 2), WLH * 10, 200, WLH,
'Трофей 2')
draw_enemy_drop(data, 2, contents.width - (hpx * 2), WLH * 11)
end
def draw_enemy_stat(actor, x, y, width, stat)
color1 = system_color
color2 = normal_color
slash = false
# Find highest level actor
if Wora_Monbook::COMPARE_STATUS
hactor = ($game_party.members.sort {|a,b| a.level <=> b.level })
hactor = hactor[hactor.size - 1]
end
case stat
when 'hp'
vocab = Vocab::hp
number = actor.maxhp
hnumber = hactor.maxhp if Wora_Monbook::COMPARE_STATUS
slash = true
when 'mp'
vocab = Vocab::mp
number = actor.maxmp
hnumber = hactor.maxmp if Wora_Monbook::COMPARE_STATUS
slash = true
when 'atk'
vocab = Vocab::atk
number = actor.atk
hnumber = hactor.atk if Wora_Monbook::COMPARE_STATUS
when 'def'
vocab = Vocab::def
number = actor.def
hnumber = hactor.def if Wora_Monbook::COMPARE_STATUS
when 'spi'
vocab = Vocab::spi
number = actor.spi
hnumber = hactor.spi if Wora_Monbook::COMPARE_STATUS
when 'agi'
vocab = Vocab::agi
number = actor.agi
hnumber = hactor.agi if Wora_Monbook::COMPARE_STATUS
when 'hit'
vocab = 'Тчн'
number = actor.hit
hnumber = hactor.hit if Wora_Monbook::COMPARE_STATUS
when 'eva'
vocab = 'Увр'
number = actor.eva
hnumber = hactor.eva if Wora_Monbook::COMPARE_STATUS
when 'exp'
vocab = 'Опыт'
number = actor.exp
color2 = crisis_color
when 'gold'
vocab = 'Дзето'
number = actor.gold
color2 = crisis_color
end
if Wora_Monbook::COMPARE_STATUS and !hnumber.nil?
if hnumber > number # Higher
color2 = power_up_color
elsif hnumber < number # Less
color2 = power_down_color
elsif hnumber == number # Equal
color2 = normal_color
end
end
contents.font.color = color1
contents.draw_text(x, y, 50, WLH, vocab)
xr = x + width
contents.font.color = color2
if slash
contents.draw_text(xr - 95, y, 40, WLH, number, 2)
contents.draw_text(xr - 55, y, 11, WLH, '/', 2)
end
w_ava = slash ? 40 : 80
contents.draw_text(xr - w_ava, y, w_ava, WLH, number, 2)
end
def draw_enemy_drop(actor, drop_id, x, y)
drop = eval('actor.drop_item' + drop_id.to_s)
if drop.kind.zero?
contents.font.color = normal_color
contents.draw_text(x, y, 200, WLH, " ---------")
else
case drop.kind
when 1; item = $data_items[drop.item_id]
when 2; item = $data_weapons[drop.weapon_id]
when 3; item = $data_armors[drop.armor_id]
end
draw_item_name(item, x, y)
end
end
end
#===============================================================
# ** Scene_MonsterBook
#--------------------------------------------------------------
class Scene_MonsterBook < Scene_Base
def initialize(from_menu = false)
@from_menu = from_menu
end
def start
super
create_menu_background
$game_system.create_monbook
@window_help = Window_MonsterBHelp.new
# Create Monster List
monlist = []
$game_system.monbook.each_index do |i|
next if i == 0 # The first index in $data_enemies is blank
# If player found the monster
if $game_system.monbook[i]
montext = i.to_s + Wora_Monbook::TEXT_DOT + ' ' + $data_enemies[i].name
else # If player haven't found
montext = i.to_s + Wora_Monbook::TEXT_DOT
end
monlist << montext
end
@window_monlist = Window_Command.new(544, monlist, 2)
@window_monlist.y = @window_help.height
@window_monlist.height = Graphics.height - @window_help.height
@window_monlist.active = true
@window_mondetail = Window_MonsterBDetail.new(@window_monlist)
@window_mondetail.visible = false
end
def update
super
if @window_monlist.active
@window_monlist.update
if Input.trigger?(Input::C)
# View monster's detail if found monster
if $game_system.monbook[@window_monlist.index + 1]
Sound.play_decision
@window_monlist.active = false
@window_monlist.visible = false
@window_mondetail.active = true
@window_mondetail.visible = true
@window_mondetail.write_detail(@window_monlist.index + 1)
else
Sound.play_cancel
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
# Return
$scene = @from_menu ? Scene_Menu.new(Wora_Monbook::MENU_INDEX) :
Scene_Map.new
end
elsif @window_mondetail.active
if Input.trigger?(Input::B)
Sound.play_cancel
@window_monlist.active = true
@window_monlist.visible = true
@window_mondetail.active = false
@window_mondetail.visible = false
end
end
end
def terminate
super
dispose_menu_background
@window_help.dispose
@window_monlist.dispose
@window_mondetail.dispose
end
end
#=============================================================
# * Window_Command Insert Tool
#=============================================================
class Window_Command < Window_Selectable
unless method_defined? :wora_cominstool_wincom_ini
alias wora_cominstool_wincom_ini initialize
alias wora_cominstool_wincom_drawitem draw_item
end
#------------------------------------
# * [Alias] Initialize
#------------------------------------
def initialize(*args)
@disabled_commands = [] # Array to keep track of disabled commands
wora_cominstool_wincom_ini(*args)
end
#------------------------------------
# * [Alias] Draw_Item
#------------------------------------
def draw_item(*args)
wora_cominstool_wincom_drawitem(*args)
# Set array's index to 1 if command is disabled
@disabled_commands[args[0]] = args[1].nil? || args[1] ? nil : true
end
#------------------------------------
# * Insert Command
#------------------------------------
def ins_command(index, text)
@commands.insert(index, text) # Insert new commands
@disabled_commands.insert(index, nil)
# Set new height for window
old_disabled_commands = @disabled_commands.dup
self.height = (@commands.size + @column_max - 1) / @column_max * WLH + 32
@item_max = @commands.size # Update @item_max to make refresh works correctly
create_contents # Create new content because window's size changed
refresh # Redraw window's contents
old_disabled_commands.each_index do |i|
if !old_disabled_commands[i].nil?
draw_item(i, false) # Draw commands that disabled before
end
end
end
#------------------------------------
# * Add Command
#------------------------------------
def add_command(text)
ins_command(@commands.size, text) # Add new command to new index
end
end
#=============================================================
# * Add command linked to Monster Book in Menu
#=============================================================
if Wora_Monbook::SHOW_IN_MENU
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Sort New Command(s)
#--------------------------------------------------------------------------
def wsort_newcommand
@wsorted_command ||= [] # Array to collect sorted commands
wnewcommand = @wnewcommand - @wsorted_command # Remove sorted commands
wnewcommand.sort.each {|i| @menu_index += 1 if @menu_index >= i }
@command_window.index = @menu_index # Set window's index to new index
@wsorted_command = @wsorted_command + @wnewcommand # Add sorted commands
end
#--------------------------------------------------------------------------
# * [Alias] Create Command Window
#--------------------------------------------------------------------------
alias wora_menucomorg_scemenu_crecomwin create_command_window
def create_command_window(*args)
wora_menucomorg_scemenu_crecomwin(*args)
# Insert new command
@command_window.ins_command(Wora_Monbook::MENU_INDEX,
Wora_Monbook::MENU_COMMAND)
# Set index to correct one if @menu_index is after/equal to new command
@wnewcommand ||= []
@wnewcommand << Wora_Monbook::MENU_INDEX
wsort_newcommand
end
#--------------------------------------------------------------------------
# * [Alias] Update Command Selection
#--------------------------------------------------------------------------
alias wora_menucomorg_scemenu_updcomsel update_command_selection
def update_command_selection(*args)
@menucomorpg_change = false
# If player choose new command
if Input.trigger?(Input::C) and @command_window.index ==
Wora_Monbook::MENU_INDEX
Sound.play_decision
$scene = Scene_MonsterBook.new(true)
else # If player choose index after new command
if Input.trigger?(Input::C) and @command_window.index >
Wora_Monbook::MENU_INDEX
@command_window.index -= 1 # Decrease index to make old update works
@menucomorpg_change = true
end
wora_menucomorg_scemenu_updcomsel(*args)
end
@command_window.index += 1 if @menucomorpg_change # Increase index back
end
#--------------------------------------------------------------------------
# * [Alias] Update Actor Selection
#--------------------------------------------------------------------------
alias wora_menucomorg_scemenu_updactsel update_actor_selection
def update_actor_selection(*args)
@menucomorpg_change = false
# If player choose index after new command
if Input.trigger?(Input::C) and @command_window.index >
Wora_Monbook::MENU_INDEX
@command_window.index -= 1 # Decrease index to make old update works
@menucomorpg_change = true
end
wora_menucomorg_scemenu_updactsel(*args)
@command_window.index += 1 if @menucomorpg_change # Increase index back
end
end
end
Социальные закладки