12-29-2006, 01:00 PM
(This post was last modified: 05-12-2017, 03:58 AM by DerVVulfman.)
Kingdom Hearts Menu
Leon Blade
Dec 29 2006
Hello, I got the Kingdom Hearts Menu system finally to work. I would like some credit on this to!
More on the next post!
KH_Menu.zip (Size: 356.84 KB / Downloads: 6)
That last script was to go above main, you can call it KH Menu. Now place this script above main and the KH Menu...
One more thing on next post!
----------------------
Okay now I will explain to you how everything works...
First off there is the two different items scenes, Item and Item2.
Item one displays only regular items.
Item two displays only synthesis items, which are defined by a new attribute in the systems tab, ID 17 called Synth. Items.
After you do all of that there is the party command. You may not see it yet so turn on Switch[1] and you will get the command.
Now the last thing to discuss took me about 23 min to make. Its the journal scene. To use this press LEFT or RIGHT to flip between 3 pages. This works by using variables and switches.
Variable[1] is called Page Number. When Variable[1] = 0 you are on page 1, Var[1] = 1 your on page 2. This keeps going on like this. The maximum page is set in Scene_Journal. It will say
change the 3 to the maximum page number. The switches are for when you do certain things a switch activates and it gets writen in your Journal. The journal writing is well explained in Window_Journal. But ill explain it again. The writing goes onto the paper. The lines increse 32 Y cordinates every line and 42 every small break. Switches activate the journal entrys and variables determine what page your on so if you see a
that means the writing following this if command are on page 1 untill the if statment ends. Then it will most likly change to variables[1] == 1, then the following would be page 2 writing.
Thats all that you need to know to use this menu. The only trouble I had was making the different Item sections because I couldn't fine the code for armor element. But I found it and you can now use it.
-Leon Blade-
!REMEMBER GIVE ME CREDIT!
Leon Blade
Dec 29 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Hello, I got the Kingdom Hearts Menu system finally to work. I would like some credit on this to!
Kingdom Hearts Menu
Code:
#==============================================================================
# Kingdom Hearts Menu
# -Scripted by: Leon Blade-
#------------------------------------------------------------------------------
# This menu was scripted by Leon Blade for FinalXemnas
# Created after Kingdom Hearts Menu
#==============================================================================
#================================
# Windows
#================================
#----------------------------------------------------------------
# Window Base Add On(Used for displaying battlers)
#----------------------------------------------------------------
class Window_Base < Window
def draw_actor_battler_graphic(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
#----------------------------------------------------------------
# Extra Window(Contains Playtime and Step Counter)
#----------------------------------------------------------------
class Window_Extra < Window_Base
#--------------------------------------------------------------------------
# ● Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 104)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Play Time" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# ● Displays
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time")
self.contents.draw_text(300, 0, 120, 32, "Number of Steps")
@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, 32, 120, 32, text, 2)
self.contents.draw_text(300, 32, 120, 32, $game_party.steps.to_s, 2)
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#----------------------------------------------------------------
# Gold(Displays your curency and how much)
#----------------------------------------------------------------
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 168)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Gold" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# ● Display
#--------------------------------------------------------------------------
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
#----------------------------------------------------------------
# Map(Lets $map_infos = @map_id)
#----------------------------------------------------------------
class Game_Map
def name
$map_infos[@map_id]
end
end
#----------------------------------------------------------------
# Title(Checks your map in data files)
#----------------------------------------------------------------
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#----------------------------------------------------------------
# Mapname(Displays current location)
#----------------------------------------------------------------
class Window_Mapname < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 56)
self.contents = Bitmap.new(width - 52, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Display
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
new_name = $game_map.name.tr("/*","")
self.contents.draw_text(500, -5, 320, 32, new_name.to_s)
self.contents.draw_text(5, -5, 320, 32, "Location")
end
end
#----------------------------------------------------------------
# Menu Status 1(Displays stats for hero in slot 1)
#----------------------------------------------------------------
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 320)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● Display
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
if @item_max > 0
actor = $game_party.actors[0]
draw_actor_battler_graphic(actor, 55, 190)
draw_actor_name(actor, 40, -8)
draw_actor_level(actor, 0, 190)
draw_actor_hp(actor, 0, 212)
draw_actor_sp(actor, 0, 234)
draw_actor_state(actor, 0, 256)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#----------------------------------------------------------------
# Menu Status 2(Displays stats for hero in slot 2)
#----------------------------------------------------------------
class Window_MenuStatus2 < Window_Selectable
#--------------------------------------------------------------------------
# ● Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 320)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● Display
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
if @item_max > 1
actor = $game_party.actors[1]
draw_actor_battler_graphic(actor, 55, 190)
draw_actor_name(actor, 40, -8)
draw_actor_level(actor, 0, 190)
draw_actor_hp(actor, 0, 212)
draw_actor_sp(actor, 0, 234)
draw_actor_state(actor, 0, 256)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#----------------------------------------------------------------
# Menu Status 3(Displays stats for hero in slot 3)
#----------------------------------------------------------------
class Window_MenuStatus3 < Window_Selectable
#--------------------------------------------------------------------------
# ● Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 320)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● Display
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
if @item_max > 2
actor = $game_party.actors[2]
draw_actor_battler_graphic(actor, 60, 190)
draw_actor_name(actor, 40, -8)
draw_actor_level(actor, 0, 190)
draw_actor_hp(actor, 0, 212)
draw_actor_sp(actor, 0, 234)
draw_actor_state(actor, 0, 256)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#----------------------------------------------------------------
# Item(Item window to not display items of synthesis)
#
# To make an item synthesis make a new attribute in the
# systems tab ID: 17 and select it to all synthesis items.
#----------------------------------------------------------------
class Window_Item < Window_Selectable
def initialize
super(0, 64, 640, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
@column_max = 2
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(item_kind = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
case item_kind
when 0
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and
not $data_items[i].element_set.include?(17)
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and
not $data_weapons[i].element_set.include?(17)
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and
not $data_armors[i].guard_element_set.include?(17)
@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)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
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 % 2 * (288 + 32)
y = index / 2 * 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
#----------------------------------------------------------------
# Item2(Item window to display items of synthesis)
#
# To make an item synthesis make a new attribute in the
# systems tab ID: 17 and select it to all synthesis items.
#----------------------------------------------------------------
class Window_Item2 < Window_Selectable
def initialize
super(0, 64, 640, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
@column_max = 2
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(item_kind = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
case item_kind
when 0
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and
$data_items[i].element_set.include?(17)
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and
$data_weapons[i].element_set.include?(17)
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and
$data_armors[i].guard_element_set.include?(17)
@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)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
self.contents.font.name = $defaultfonttype # "Main" window font
self.contents.font.size = $defaultfontsize
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 % 2 * (288 + 32)
y = index / 2 * 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
#----------------------------------------------------------------
# Journal(Used in displaying things that happen)
#----------------------------------------------------------------
class Window_Journal < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(55, 55, 640, 640)
self.contents = Bitmap.new(width - 52, height - 52)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
if $game_variables[1] == 0 # Page 1
if $game_switches[3] == true
self.contents.draw_text(4, -9, 320, 32, "This is just an example of the journal and how cool it")
self.contents.draw_text(4, 23, 320, 32, "it can be. To make it work or to add messages first")
self.contents.draw_text(4, 55, 320, 32, "you need to make a switch that activates this in the")
self.contents.draw_text(4, 87, 320, 32, "journal so you may view it. Then in Window_Journal")
self.contents.draw_text(4, 119, 320, 32, "write in ''if $game_switches[?] == true'' after font color.")
self.contents.draw_text(4, 151, 320, 32, "The ? stands for the switch follow this example to make")
self.contents.draw_text(4, 183, 320, 32, "Your own entrys. The cordinates are as follows. Every")
self.contents.draw_text(4, 215, 320, 32, "line you add on 32 to the last one so the first line is -9")
self.contents.draw_text(4, 247, 320, 32, "you would add 32 to that and get 23. To skip a line or")
self.contents.draw_text(4, 279, 320, 32, "make a small space add on 42 instead of 32 this will")
self.contents.draw_text(4, 311, 320, 32, "seperate different entrys. Learn more view Window_Journal.")
self.contents.draw_text(4, 353, 320, 32, "-Leon Blade-")
end
end
if $game_variables[1] == 1 # Page 2
self.contents.draw_text(4, -9, 320, 32, "Just testing the page 2")
end
# Okay now that your here, here is how you make new pages. Okay first make a new variable
# in this case its [1]. The pages will work as such. Variable 1 will control page number.
# When its at 0 the page is 1, when its at 1 the page is 2. Here is a chart...
#
# Ammount - Page
# 0 1
# 1 2
# 2 3
# 3 4
# 4 5
# 5 6
#
# You get the idea. Now to control the pages start with if $game_variables[1] == 0 then that
# means if page 1 is open... then you use switches to control journal entrys. Now lets say you want
# a new page. After the first page's end from the first if variable, make another one only it should
# say if $game_variables[1] == 1 which means, if Page 2 open... then display that page. Look at
# Scene_Journal to see how you control viewing the pages.
end
end
#================================
# Scenes
#================================
#----------------------------------------------------------------
# Item 1(Used for regular items)
#----------------------------------------------------------------
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウ、アイテムウィンドウを作成
@help_window = Window_Help.new
@item_window = Window_Item.new
# ヘルプウィンドウを関連付け
@item_window.help_window = @help_window
# ターゲットウィンドウを作成 (不可視・非アクティブに設定)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# トランジション実行
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
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@item_window.update
@target_window.update
# アイテムウィンドウがアクティブの場合: update_item を呼ぶ
if @item_window.active
update_item
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_item
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$game_switches[2] = false
$scene = Scene_Menu.new(0)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @item_window.item
# 使用アイテムではない場合
unless @item.is_a?(RPG::Item)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 効果範囲が味方の場合
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@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
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$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
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$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
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを使い切った場合
if $game_party.item_number(@item.id) == 0
# ブザー SE を演奏
$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
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$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
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#----------------------------------------------------------------
# Item 2(Used for Materials scene)
#----------------------------------------------------------------
class Scene_Item2
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウ、アイテムウィンドウを作成
@help_window = Window_Help.new
@item_window = Window_Item2.new
# ヘルプウィンドウを関連付け
@item_window.help_window = @help_window
# ターゲットウィンドウを作成 (不可視・非アクティブに設定)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# トランジション実行
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
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@item_window.update
@target_window.update
# アイテムウィンドウがアクティブの場合: update_item を呼ぶ
if @item_window.active
update_item
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_item
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$game_switches[2] = false
$scene = Scene_Menu.new(0)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @item_window.item
# 使用アイテムではない場合
unless @item.is_a?(RPG::Item)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 効果範囲が味方の場合
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@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
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$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
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$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
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを使い切った場合
if $game_party.item_number(@item.id) == 0
# ブザー SE を演奏
$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
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$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
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#----------------------------------------------------------------
# Journal(Viewing things that have happened in the game
#----------------------------------------------------------------
class Scene_Journal
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
@command_window = Window_Journal.new
@command_window.opacity = 0
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title("paper")
@sprite.x = 25
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@command_window.update
@sprite.update
if @command_window.active
update_command
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_command
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::LEFT)
if $game_variables[1] <= 0
$game_system.se_play($data_system.buzzer_se)
else
Audio.se_play("Audio/SE/" + "046-Book01", 100, 100)
$game_variables[1] -= 1
@command_window.dispose
@command_window = Window_Journal.new
@command_window.opacity = 0
end
end
if Input.trigger?(Input::RIGHT)
if $game_variables[1] >= 2
$game_system.se_play($data_system.buzzer_se)
else
Audio.se_play("Audio/SE/" + "046-Book01", 100, 100)
$game_variables[1] += 1
@command_window.dispose
@command_window = Window_Journal.new
@command_window.opacity = 0
end
end
return
end
end
#----------------------------------------------------------------
# Menu
#----------------------------------------------------------------
class Scene_Menu
#--------------------------------------------------------------------------
# ● Initialize the menus
# menu_index : The index of the initial selected item on the command menu
# (0 = the first item on the menu, with the number increasing
# by one for each command below the top command)
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● Set up the menu, processes the user's actions in the main loop,
# and then disposes of the objects
#--------------------------------------------------------------------------
def main
# Set up command window
if $game_switches[1] == true
s1 = "Items"
s2 = "Skills"
s3 = "Equip"
s4 = "Status"
s5 = "Materials"
s6 = "Journal"
s7 = "Party"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.y = 56
@command_window.index = @menu_index
else
s1 = "Items"
s2 = "Skills"
s3 = "Equip"
s4 = "Status"
s5 = "Materials"
s6 = "Journal"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.y = 56
@command_window.index = @menu_index
end
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
# Set up play mapname window
@map_window = Window_Mapname.new
@map_window.x = 0
@map_window.y = 0
# Set up extra window
@extra_window = Window_Extra.new
@extra_window.x = 160
@extra_window.y = 376
# Set up gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 312
# Set up status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 56
# Set up status window 2
@status_window2 = Window_MenuStatus2.new
@status_window2.x = 320
@status_window2.y = 56
# Set up status window 2
@status_window3 = Window_MenuStatus3.new
@status_window3.x = 480
@status_window3.y = 56
# Set up status
@window_status = Window_MenuStatus4.new
@window_status.x = 160
@window_status.y = 56
@window_status.opacity = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
# Clean up
@command_window.dispose
@map_window.dispose
@gold_window.dispose
@status_window.dispose
@status_window2.dispose
@status_window3.dispose
@window_status.dispose
@extra_window.dispose
end
#--------------------------------------------------------------------------
# ● Update the contents of all five windows on the main menu
#--------------------------------------------------------------------------
def update
@command_window.update
@gold_window.update
@status_window.update
@map_window.update
@status_window2.update
@status_window3.update
@extra_window.update
@window_status.update
if @command_window.active
update_command
return
end
if @window_status.active
update_status
return
end
end
#--------------------------------------------------------------------------
# ● Update the command menu window in response to user input
#--------------------------------------------------------------------------
def update_command
# Cancel key is pressed
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
# Decision key is pressed
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 # Item selected
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1 # Skill selected
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@window_status.active = true
@window_status.index = 0
when 2 # Equipment selected
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@window_status.active = true
@window_status.index = 0
when 3 # Status selected
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@window_status.active = true
@window_status.index = 0
when 4 # Materials selected
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item2.new
when 5 # Journal selected
$game_system.se_play($data_system.decision_se)
$scene = Scene_Journal.new
when 6 # Party selected
$game_system.se_play($data_system.decision_se)
$scene = Scene_Switch.new(false, 1, 3)
end
return
end
end
#--------------------------------------------------------------------------
# ● Update the status of a menu opened through the main menu
#--------------------------------------------------------------------------
def update_status
# Cancel key pressed
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@window_status.active = false
@window_status.index = -1
return
end
# Make a decision
if Input.trigger?(Input::C)
case @command_window.index
when 1 # Skill Window
if $game_party.actors[@window_status.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@window_status.index)
when 2 # Equipment Window
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@window_status.index)
when 3 # Staus Window
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@window_status.index)
end
return
end
end
end
More on the next post!
KH_Menu.zip (Size: 356.84 KB / Downloads: 6)
That last script was to go above main, you can call it KH Menu. Now place this script above main and the KH Menu...
Party Command
Code:
#==============================================================================
# Window_SwitchStatus class definition
#------------------------------------------------------------------------------
# A window that displays the status of a character being selected.
#
# By exseiken, October 06, 2004 (v. 1.01)
#==============================================================================
class Window_SwitchStatus < Window_Base
#----------------------------------------------------------------------------
# Construct the window: create the contents bitmap.
#----------------------------------------------------------------------------
def initialize
# create the window and initialize its contents
super(256, 0, 384, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
#----------------------------------------------------------------------------
# Draw the status on an actor on the window's contents.
#
# Parameters:
# actor: The actor to put on the screen
#----------------------------------------------------------------------------
def draw_actor_status(actor)
# clear the contents of the bitmap
self.contents.clear
# if the actor to draw is nil, leave the window empty
if actor == nil
return
end
# draw the actor's graphic
draw_actor_graphic(actor, 12, 88)
# draw the actor's name, level
draw_actor_name(actor, 94, 0)
draw_actor_level(actor, 288, 0)
draw_actor_hp(actor, 94, 32)
draw_actor_sp(actor, 94, 64)
end
end
#==============================================================================
# Window_SwitchReserve class definition
#------------------------------------------------------------------------------
# A window that displays all characters available to pick in the party. Offers
# a cursor to select them
#
# By exseiken, October 06, 2004 (v. 1.01)
#==============================================================================
class Window_SwitchReserve < Window_Selectable
#----------------------------------------------------------------------------
# Window constructor. Create the contents bitmap and fill it with all
# characters that are not into the party, but that are loaded in the data
# member of the Game_Actors global object.
#
# Parameters:
# max_size: The maximum of characters that can fit into that
# window
#----------------------------------------------------------------------------
def initialize(max_size)
# initialize the window and its contents
super(256, 128, 384, 352)
self.contents = Bitmap.new(width - 32, ((max_size & ~(0x01)) << 5) + ((max_size & 0x01) << 6))
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
# initialize the list for the first time
@actor_list = $game_actors.data.clone
# remove currently active party members
$game_party.actors.each do |actor|
@actor_list[actor.actor_id] = nil
end
# remove all actors that are unavailable
$game_actors.data.each do |actor|
if actor != nil and actor.unavailable
@actor_list[actor.actor_id] = nil
end
end
# remove all holes in the list
@actor_list.compact!
# set the maximum of characters the list can contain
@item_max = max_size
# 2 columns
@column_max = 2
# select the first item
@index = 0
# default: unactive
self.active = false
# draw the window's contents
refresh
# draw the cursor rectangle
update_cursor_rect
end
#----------------------------------------------------------------------------
# Update the contents of the window: clear the contents bitmap, then rebuild
# it.
#----------------------------------------------------------------------------
def refresh
# clear the contents of the bitmap
self.contents.clear
# display all actors
for i in 0..@actor_list.size
# get the concerned actor
actor = @actor_list[i]
# if the actor is non-nil, draw it
if actor != nil
# get the coordinates
x = (i & 0x01) == 1 ? self.width / @column_max : 0
y = (i >> 0x01) * 64
# draw the actor's sprite
draw_actor_graphic(actor, x + 24, y + 48)
# draw the actor's name
draw_actor_name(actor, x + 64, y + 2)
end
end
end
#----------------------------------------------------------------------------
# Update the position rectangle of the cursor.
#----------------------------------------------------------------------------
def update_cursor_rect
# if the screen is not active, or the cursor is invalid, don't display the
# cursor
if not active or @index < 0
# set an empty cursor
self.cursor_rect.empty
# stop
return
end
# get the row of the item
row = @index / @column_max
# if the cursor went over the window, scroll up
if row < self.top_row
# set the top row as the current row
self.top_row = row
end
# if the cursor went farther than the bottom of the window, scroll down
if row > self.top_row + (self.page_row_max - 1)
# set the bottom row as the current row
self.top_row = row - (self.page_row_max - 1)
end
# set the width of the cursor
cursor_width = self.width / @column_max - 32
# get the upper-left coordinates of the window
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 64 - self.oy
# set the cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 64)
end
#----------------------------------------------------------------------------
# Takes a character, put in into the list at the selected position, and
# returns the character that was presently there. If there was no
# character, returns nil.
#
# Parameters:
# actor_to_switch: The character to put at the selected position
#----------------------------------------------------------------------------
def swap_characters(actor_to_switch)
# store the old actor (needed for swapping)
old_actor = @actor_list[@index]
# put the new actor at the place
@actor_list[@index] = actor_to_switch
# redraw the window
refresh
# return the old actor
return old_actor
end
#----------------------------------------------------------------------------
# Update the help window. (Here, the help window is really the actor status
# window.)
#----------------------------------------------------------------------------
def update_help
# draw the selected actor's name, level, status conditions and stats
@help_window.draw_actor_status(@actor_list[@index])
end
#--------------------------------------------------------------------------
# Return the index of the top row, that is, the first row that is displayed
# on the window.
#--------------------------------------------------------------------------
def top_row
# divide the coordinate of the top of the bitmap by the cursor's height,
# 64, returning the index of the top row
return self.oy / 64
end
#--------------------------------------------------------------------------
# Validate, and set the top row to a new value. The validation makes sure
# that the new row is not off-limits.
#
# Parameters:
# row : the index of the row to be set as the new top row
#--------------------------------------------------------------------------
def top_row=(row)
# forces the new row to be positive
if row < 0
row = 0
end
# forces the new row to be less or equal to the maximum
if row > row_max - 1
row = row_max - 1
end
# return the top of the window by multiplying it by the height of the
# cursor window: 64.
self.oy = row * 64
end
#--------------------------------------------------------------------------
# Return the maximum amount of rows that can
#--------------------------------------------------------------------------
def page_row_max
# return the maximum of rows fitting in a page by dividing the
# height of the bitmap by the height of a window, 64
return (self.height - 32) / 64
end
end
#==============================================================================
# Window_SwitchParty class definition
#------------------------------------------------------------------------------
# A window that displays all 4 character slots in the party, and offers a
# cursor to modify it.
#
# By exseiken, October 04, 2004
#==============================================================================
class Window_SwitchParty < Window_Selectable
#----------------------------------------------------------------------------
# Create public access variables
#----------------------------------------------------------------------------
attr_reader :new_party # The party shown in the window [R-O]
#----------------------------------------------------------------------------
# Window's constructor. Create the window's contents, makes a copy of the
# current party, then stocks it into member variable new_party, for later
# use.
#----------------------------------------------------------------------------
def initialize()
# create the window and its contents
super(0, 0, 256, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
# copy the party
@new_party = $game_party.actors.clone
# always 4 party members
@item_max = 3
# select the first character
if @new_party.size > 0
@index = @new_party.index(@new_party.first )
else
@index = 0
end
# draw the window's contents
refresh
# update the cursor rectangle
update_cursor_rect
end
#----------------------------------------------------------------------------
# Return the actor currently selected.
#----------------------------------------------------------------------------
def actor
# return the selected actor, or nil if none
@new_party[@index]
end
#----------------------------------------------------------------------------
# Update the contents of the window: clear the contents bitmap, then rebuild
# it.
#----------------------------------------------------------------------------
def refresh
# clear the contents of the bitmap
self.contents.clear
# draw each non-null party member
for i in 0..@new_party.size - 1
# get the actor
actor = @new_party[i]
# if the actor is valid, draw it on the screen
if actor != nil
# calculate the y coordinate
y = 160 * i
# draw the actor's graphic
draw_actor_graphic(actor, 24, y + 80)
# draw the actor's name
draw_actor_name(actor, 64, y + 20)
# if the actor is not available, write in red "can't select"
if actor.mandatory
self.contents.font.color = Color.new(255, 0, 0, 255)
self.contents.draw_text_shadow(0, y, 224, 32, "Must Be In Party", 1)
end
end
end
end
#----------------------------------------------------------------------------
# Update the position rectangle of the cursor.
#----------------------------------------------------------------------------
def update_cursor_rect
# reset the cursor rectangle
self.cursor_rect.set(0, 160 * @index, width - 32, 96)
end
#----------------------------------------------------------------------------
# Change the actor selected for another, then redraw the entire window.
#
# Parameters:
# actors: The actor that will replace the selected one
#----------------------------------------------------------------------------
def change_selection(actor)
# change the actor (can be nil to remove it)
@new_party[@index] = actor
# redraw the window
refresh
end
#----------------------------------------------------------------------------
# Update the help window. (Here, the help window is really the actor status
# window.)
#----------------------------------------------------------------------------
def update_help
# draw the selected actor's name, level, status conditions and stats
@help_window.draw_actor_status(@new_party[@index])
end
end
#==============================================================================
# Scene_Switch class definition
#------------------------------------------------------------------------------
# This class represents the party switching sub-screen. It allows the player
# to switch in and out characters from the party. Characters that are not in
# the party but that are available are said 'in reserve'.
#
# Characters available are those that exist in Game_Actors::data and whose
# property unavailable is set to false. In the default script, an actor is
# loaded in Game_Actors::data when s/he is added for the very first time in the
# party and is never deleted, unless it's done explicitly with scripts.
#
# This script requires you to create 2 additional attributes for the Game_Actor
# class: mandatory and unavailable. Both are boolean values.
#
# Mandatory is a boolean variable that, when set to true, means that the actor
# can't be switched out of the party. This is useful for main characters, that
# are in many RPGs required most of the time, if not always. The switch screen
# will display the word "Mandatory" in red above an actor that can't be put out
# of the party.
#
# Unavailable is another boolean variable that, when set to true, means that
# although the actor is defined in Game_Actors::data, won't appear in the
# reserve window. This is useful when a character leaves the party in the
# story, but you don't want to reset his stats and name when s/he comes back.
#
# Usage of this script requires the 3 other files: Window_SwitchParty,
# Window_SwitchReserve and Window_SwitchStatus, as well as a few modifications
# of the default scripts:
#
# 1 - In Game_Actor, add in the class definition (under "class Game_Actor
# [...]"):
# attr_reader :actor_id
# attr_accessor :mandatory
# attr_accessor :unavailable
#
# 2 - Again, in Game_Actor, add in the setup method (under "def setup"):
# mandatory = false
# unavailable = false
#
# 3 - In Game_Actors (with an "s"!) add in the class definition:
# attr_accessor :data
#
# 4 - In Game_Party, change:
# attr_reader :actors
# for
# attr_accessor :actors
#
# By exseiken, October 04, 2004
#==============================================================================
class Scene_Switch
#----------------------------------------------------------------------------
# Initialize the sub-screen. If it was called from the menu, it will return
# to the main menu when closed, otherwise, it will return to the map.
#
# Parameters:
# from_menu: Determines whether or not the scene was called from
# the menu or not [true|false]
# min_size: The minimum amount of characters that the new party
# must have [1; 4]
# max_size: The maximum amount of characters that the new party
# must have [min_size; 4]
#----------------------------------------------------------------------------
def initialize(from_menu, min_size = 1, max_size = 3)
# store the data telling whether or not the scene was called from the menu
@from_menu = from_menu
# store the array bounds for the max_size and min_size
@min_size = [[min_size, 1].max, 3].min
@max_size = [[max_size, @min_size].max, 3].min
end
#----------------------------------------------------------------------------
# The main routine, controlling the life of the object.
#----------------------------------------------------------------------------
def main
# create the window containing the current party members
@party_window = Window_SwitchParty.new
# create the window containing all available party members
@reserve_window = Window_SwitchReserve.new(10)
# create the window showing information about the selected character, be it
# from the party window or from the reserve window
@status_window = Window_SwitchStatus.new
# if the party is empty, the active window is reserve_window, otherwise
# it's the party window
if $game_party.actors.size == 0
@party_window.active = false
else
@reserve_window.active = false
end
# set this status window as the two other windows' help window
@party_window.help_window = @status_window
@reserve_window.help_window = @status_window
# display the transition
Graphics.transition
# enter the main loop
loop do
# flip the screen
Graphics.update
# get the buttons pressed
Input.update
# update the sub-screen
update
# if the scene has changed, return
if $scene != self
break
end
end
# stop drawing graphics
Graphics.freeze
# destroy the sub-windows
@status_window.dispose
@reserve_window.dispose
@party_window.dispose
end
#----------------------------------------------------------------------------
# Method called on every frame: update the contents of the scene (the 3,
# windows) and read on the keyboard.
#----------------------------------------------------------------------------
def update
# update all sub-windows
@party_window.update
@reserve_window.update
@status_window.update
# if the active screen is party_window, update it, else update the reserve
# window
if @party_window.active
update_party
return
else
update_reserve
return
end
end
#----------------------------------------------------------------------------
# Called when the focus is on the party window. Read on the keyboard and
# update the state of the scene according to the buttons pressed. If the
# played pressed B while this mode is on, the new party will be set and
# the scene will close.
#----------------------------------------------------------------------------
def update_party
# if the B (back) button was pressed, return to the preceeding screen
if Input.trigger?(Input::B)
# remove all holes in the party
new_party = @party_window.new_party.compact
# get the number of party members
n = new_party.size
# if the party doesn't have an acceptable amount of party members, don't
# allow quitting the sub-screen
if n < @min_size or n > @max_size
# play the buzzer and exit
$game_system.se_play($data_system.buzzer_se)
return
end
# play the confirm sound
$game_system.se_play($data_system.decision_se)
# set the new party
$game_party.actors = new_party
# return to the calling scene
if @from_menu
$scene = Scene_Menu.new(5)
else
$scene = Scene_Menu.new(5)
end
# refresh the player's sprite
$game_player.refresh
# skip (optimizing)
return
# if the C (confirm) button was pressed, switch the control to the reserve
# window
elsif Input.trigger?(Input::C)
# if the selected character is not nil, and is unavailable, play the buzzer
if(@party_window.actor != nil and @party_window.actor.mandatory)
# play the buzzer
$game_system.se_play($data_system.buzzer_se)
else
# play the decision sound
$game_system.se_play($data_system.decision_se)
# unactivate the party window
@party_window.active = false
# activate the reserve window
@reserve_window.active = true
end
end
end
#----------------------------------------------------------------------------
# Called when the focus is on the reserve window. Read on the keyboard and
# update the state of the scene according to the buttons pressed.
#----------------------------------------------------------------------------
def update_reserve
# if the B (back) button was pressed, give back the focus to the party
# window
if Input.trigger?(Input::B)
# play the cancel sound
$game_system.se_play($data_system.decision_se)
# unactivate the reserve window
@reserve_window.active = false
# activate the party window
@party_window.active = true
# skip
return
# if the C (confirm) button was pressed, switch the party member in reserve
# with the one selected in the party
elsif Input.trigger?(Input::C)
# play the confirm sound
$game_system.se_play($data_system.decision_se)
# swap the 2 party members
@party_window.change_selection(@reserve_window.swap_characters(@party_window.act
or))
# unactivate the reserve window
@reserve_window.active = false
# activate the party window
@party_window.active = true
end
end
end
One more thing on next post!
----------------------
Okay now I will explain to you how everything works...
First off there is the two different items scenes, Item and Item2.
Item one displays only regular items.
Item two displays only synthesis items, which are defined by a new attribute in the systems tab, ID 17 called Synth. Items.
After you do all of that there is the party command. You may not see it yet so turn on Switch[1] and you will get the command.
Now the last thing to discuss took me about 23 min to make. Its the journal scene. To use this press LEFT or RIGHT to flip between 3 pages. This works by using variables and switches.
Variable[1] is called Page Number. When Variable[1] = 0 you are on page 1, Var[1] = 1 your on page 2. This keeps going on like this. The maximum page is set in Scene_Journal. It will say
Code:
if $game_variables[1] == 3
Code:
if $game_variables[1] == 0
that means the writing following this if command are on page 1 untill the if statment ends. Then it will most likly change to variables[1] == 1, then the following would be page 2 writing.
Thats all that you need to know to use this menu. The only trouble I had was making the different Item sections because I couldn't fine the code for armor element. But I found it and you can now use it.
-Leon Blade-
!REMEMBER GIVE ME CREDIT!