Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # Script by: Tigurus Fay, edit by mjshi #
- # Requires: None #
- #==============================================================================#
- # Script: One-Player Menu Script #
- # Version: v1.2.2, #
- # Install: Press F11 and place the Script directly above [Main]. #
- # Description: This script allows a menu optimized for 1 player only. #
- #==============================================================================#
- class Game_Actor < Game_Battler
- def now_exp
- return @exp - @exp_list[@level]
- end
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : @exp_list[@level]
- end
- end
- def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
- if type == "horizontal"
- width = length
- height = thick
- self.contents.fill_rect(x-1, y - 1, width + 1, height + 3, Color.new(0, 0, 0, 255))
- self.contents.fill_rect(x, y, width + 1, height + 1, Color.new(0, 0, 0, 255))
- w = width * e1.to_f / e2.to_f
- for i in 0..height
- r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
- g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
- b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
- a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
- self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
- end
- end
- end
- def draw_actor_battler(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
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This window will allow the use of locations on the menu
- #==============================================================================
- class Game_Map
- attr_reader :map_id
- def mpname
- $mpname = load_data("Data/MapInfos.rxdata")
- $mpname[@map_id].name
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This class is for all in-game windows.
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # * Draw EXP
- # actor : actor
- # x : draw spot x-coordinate24
- # y : draw spot y-coordinate
- #--------------------------------------------------------------------------
- def draw_actor_exp(actor, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 84, 32, "Experience")
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 68, y, 74, 32, actor.exp_s, 2)
- self.contents.draw_text(x + 142, y, 12, 32, "/", 1)
- self.contents.draw_text(x + 154, y, 74, 32, actor.next_exp_s)
- end
- #--------------------------------------------------------------------------
- # * Draw HP
- # actor : actor
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # width : draw spot width
- #--------------------------------------------------------------------------
- def draw_actor_health(actor, x, y, width = 144)
- # Draw "HP" text string
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 84, 32, $data_system.words.hp)
- # Calculate if there is draw space for MaxHP
- if width - 32 >= 108
- hp_x = x + width - 50
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- # Draw HP
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
- # Draw MaxHP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw SP
- # actor : actor
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # width : draw spot width
- #--------------------------------------------------------------------------
- def draw_actor_mana(actor, x, y, width = 144)
- # Draw "SP" text string
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 84, 32, $data_system.words.sp)
- # Calculate if there is draw space for MaxHP
- if width - 32 >= 108
- sp_x = x + width - 50
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- # Draw SP
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
- # Draw MaxSP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
- end
- end
- end
- #==============================================================================
- # ** Window_Avatar
- #------------------------------------------------------------------------------
- # This window displays the Battler on Scene_Menu
- #==============================================================================
- class Window_Avatar < Window_Base
- def initialize
- super(0, 0, 320, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[0]
- draw_actor_battler(actor, x + 220, y + 165)
- end
- end
- end
- #==============================================================================
- # ** Window_Mapname
- #------------------------------------------------------------------------------
- # This window displays the name of the map.
- #==============================================================================
- class Window_Mapname < Window_Base
- def initialize
- super(0, 0, 160, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.name = "Arial"
- self.contents.font.size = 22
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- lx = contents.text_size("Location").width
- self.contents.draw_text(4, -55, lx, 144, "Location", 1)
- self.contents.font.color = normal_color
- self.contents.font.size = 20
- self.contents.draw_text(0, 0, 110, 106, $game_map.mpname.to_s)
- bitmap = RPG::Cache.icon("038-Item07")
- self.contents.blt(105, 40, bitmap, Rect.new(0, 0, 24, 24))
- end
- end
- #==============================================================================
- # ** Window_Gold
- #------------------------------------------------------------------------------
- # This window displays amount of gold.
- #==============================================================================
- class Window_Gold < Window_Base
- def initialize
- super(0, 0, 160, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- def refresh
- self.contents.clear
- cx = contents.text_size($data_system.words.gold).width
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 120, 32, "Gold", 30)
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 90-cx-2, 106, $game_party.gold.to_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(94-cx, 0, cx, 106, $data_system.words.gold, 2)
- bitmap = RPG::Cache.icon("032-Item01")
- self.contents.blt(105, 40, bitmap, Rect.new(0, 0, 24, 24))
- end
- end
- #==============================================================================
- # ** Window_PlayTime
- #------------------------------------------------------------------------------
- # This window displays play time on the menu screen.
- #==============================================================================
- class Window_PlayTime < Window_Base
- def initialize
- super(0, 0, 160, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 120, 32, "Play Time")
- @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, 96, 40, text, 2)
- bitmap = RPG::Cache.icon("037-Item06")
- self.contents.blt(105, 40, bitmap, Rect.new(0, 0, 24, 24))
- end
- def update
- super
- if Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- end
- #==============================================================================
- # ** Window_Steps
- #------------------------------------------------------------------------------
- # This window displays step count on the menu screen.
- #==============================================================================
- class Window_Steps < Window_Base
- def initialize
- super(0, 0, 160, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 120, 32, "Step Count")
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 32, 96, 40, $game_party.steps.to_s, 2)
- bitmap = RPG::Cache.icon("020-Accessory05")
- self.contents.blt(105, 40, bitmap, Rect.new(0, 0, 24, 24))
- end
- end
- #==============================================================================
- # ** Window_MenuStatus
- #------------------------------------------------------------------------------
- # This window displays party member status on the menu screen.
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- def initialize
- super(0, 0, 640, 287)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- self.active = false
- self.index = -1
- end
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 64
- y = 0
- actor = $game_party.actors[0]
- draw_actor_graphic(actor, x - 40, y + 80)
- draw_actor_name(actor, x - 60, y)
- draw_actor_class(actor, x + 110, y)
- draw_actor_level(actor, x, y + 32)
- draw_actor_state(actor, x + 110, y + 32)
- draw_actor_exp(actor, x, y + 158)
- draw_actor_barz(actor, x, y + 190, "horizontal", 168, 1, actor.now_exp.to_f, actor.next_exp, Color.new(-255, 200, -86, 255), Color.new(-168, -157, 184, 255))
- draw_actor_health(actor, x, y + 74)
- draw_actor_barz(actor, x, y + 106 , "horizontal", 168, 4, actor.hp, actor.maxhp, Color.new(102, --200, 160, 0), Color.new(0, 0, 0, 0))
- draw_actor_mana(actor, x, y + 116)
- draw_actor_barz(actor, x, y + 148, "horizontal", 168, 4, actor.sp, actor.maxsp, Color.new(0, 0, 0, 0), Color.new(-102, 160, -200, 0))
- draw_actor_parameter(actor, x + 242, y - 8, 0)
- draw_actor_parameter(actor, x + 242, y + 30, 1)
- draw_actor_parameter(actor, x + 242, y + 68, 2)
- draw_actor_parameter(actor, x + 242, y + 110, 3)
- draw_actor_parameter(actor, x + 242, y + 152, 4)
- draw_actor_parameter(actor, x + 242, y + 194, 5)
- draw_actor_parameter(actor, x + 242, y + 232, 6)
- draw_actor_barz(actor, x + 415, y + 10, "horizontal", 168, 1, actor.atk, 999, Color.new(242, 2, 6, 255), Color.new(253, 53, 56, 255))
- draw_actor_barz(actor, x + 415, y + 47, "horizontal", 168, 1, actor.pdef, 999, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
- draw_actor_barz(actor, x + 415, y + 85, "horizontal", 168, 1, actor.mdef, 999, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
- draw_actor_barz(actor, x + 415, y + 125, "horizontal", 168, 1, actor.str, 999, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
- draw_actor_barz(actor, x + 415, y + 167, "horizontal", 168, 1, actor.dex, 999, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
- draw_actor_barz(actor, x + 415, y + 209, "horizontal", 168, 1, actor.agi, 999, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
- draw_actor_barz(actor, x + 415, y + 247, "horizontal", 168, 1, actor.int, 999, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
- draw_item_name($data_weapons[actor.weapon_id], x, y + 210)
- end
- end
- #==============================================================================
- # ** Cursor_update
- #=============================================================================
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index * 300, self.width - 32, 256)
- end
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs menu screen processing.
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # * Object Initialization
- # menu_index : command cursor's initial position
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Make command window
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = "Quest Log"
- s5 = "More..."
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
- @command_window.index = @menu_index
- @command_window.width = 160
- @command_window.back_opacity = 0
- # Make MapName Window
- @mapname_window = Window_Mapname.new
- @mapname_window.x = 480
- @mapname_window.y = 0
- #Make Avatar Window
- @avatar_window = Window_Avatar.new
- # Make play time window
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 320
- @playtime_window.y = 0
- # Make steps window
- @steps_window = Window_Steps.new
- @steps_window.x = 320
- @steps_window.y = 96
- # Make gold window
- @gold_window = Window_Gold.new
- @gold_window.x = 480
- @gold_window.y = 96
- # Make status window
- @status_window = Window_MenuStatus.new
- @status_window.x = 0
- @status_window.y = 192
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- @avatar_window.dispose
- @mapname_window.dispose
- @command_window.dispose
- @playtime_window.dispose
- @steps_window.dispose
- @gold_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update windows
- @avatar_window.update
- @mapname_window.update
- @command_window.update
- @playtime_window.update
- @steps_window.update
- @gold_window.update
- @status_window.update
- # If command window is active: call update_command
- if @command_window.active
- update_command
- return
- end
- # If status window is active: call update_status
- if @status_window.active
- update_status
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (when command window is active)
- #--------------------------------------------------------------------------
- def update_command
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # If command other than save or end game, and party members = 0
- if $game_party.actors.size == 0 and @command_window.index < 1
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Branch by command window cursor position
- case @command_window.index
- when 0 # Item
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Item.new
- when 1 #Skill
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # Equip
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # Quest Log
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Quest.new
- when 4 # Options
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to end game screen
- $scene = Scene_End.new
- end
- return
- end
- end
- end
- #==============================================================================
- # ** Window_Item
- #------------------------------------------------------------------------------
- # This window displays items in possession on the item and battle screens.
- #==============================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor : actor
- #--------------------------------------------------------------------------
- def initialize(actor = nil)
- super(0, 128, 640, 352)
- @actor = actor.nil? ? $game_party.actors[0] : actor
- @column_max = 2
- refresh
- self.index = 0
- # If in battle, move window to center of screen
- # and make it semi-transparent
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- end
- #==============================================================================
- # ** Scene_Item
- #------------------------------------------------------------------------------
- # This class performs item screen processing.
- #==============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor_index : actor index
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Get actor
- @actor = $game_party.actors[@actor_index]
- # Make help window, status window, and skill window
- @help_window = Window_Help.new
- @status_window = Window_SkillStatus.new(@actor)
- @item_window = Window_Item.new(2)
- # Associate help window
- @item_window.help_window = @help_window
- # Make target window (set to invisible / inactive)
- @target_window = Window_Target.new
- @target_window.visible = false
- @target_window.active = false
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of windows
- @help_window.dispose
- @status_window.dispose
- @item_window.dispose
- @target_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update windows
- @help_window.update
- @status_window.update
- @item_window.update
- @target_window.update
- # If item window is active: call update_item
- if @item_window.active
- update_item
- return
- end
- # If target window is active: call update_target
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (when item window is active)
- #--------------------------------------------------------------------------
- def update_item
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(0)
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Get currently selected data on the item window
- @item = @item_window.item
- # If not a use item
- unless @item.is_a?(RPG::Item)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # If it can't be used
- unless $game_party.item_can_use?(@item.id)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # If effect scope is an ally
- if @item.scope >= 3
- # If items are used up
- if $game_party.item_number(@item.id) == 0
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # If target is all
- if @target_window.index == -1
- # Apply item effects to entire party
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- # If single target
- if @target_window.index >= 0
- # Apply item use effects to target actor
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- # If an item was used
- if used
- # Play item use SE
- $game_system.se_play(@item.menu_se)
- # If consumable
- if @item.consumable
- # Decrease used items by 1
- $game_party.lose_item(@item.id, 1)
- # Redraw item window item
- @item_window.draw_item(@item_window.index)
- end
- # Remake target window contents
- @target_window.refresh
- @status_window.refresh
- # If all party members are dead
- if $game_party.all_dead?
- # Switch to game over screen
- $scene = Scene_Gameover.new
- return
- end
- # If common event ID is valid
- if @item.common_event_id > 0
- # Common event call reservation
- $game_temp.common_event_id = @item.common_event_id
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- end
- # If effect scope is other than an ally
- else
- # If command event ID is valid
- if @item.common_event_id > 0
- # Command event call reservation
- $game_temp.common_event_id = @item.common_event_id
- # Play item use SE
- $game_system.se_play(@item.menu_se)
- # If consumable
- if @item.consumable
- # Decrease used items by 1
- $game_party.lose_item(@item.id, 1)
- # Draw item window item
- @item_window.draw_item(@item_window.index)
- end
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #------------------------------------------------------------------------------
- # This class performs skill screen processing.
- #==============================================================================
- class Scene_Skill
- def update_skill
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(1)
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Get currently selected data on the skill window
- @skill = @skill_window.skill
- # If unable to use
- if @skill == nil or not @actor.skill_can_use?(@skill.id)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # If effect scope is ally
- if @skill.scope >= 3
- # If unable to use because SP ran out
- unless @actor.skill_can_use?(@skill.id)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # If target is all
- if @target_window.index == -1
- # Apply skill use effects to entire party
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- # If target is user
- if @target_window.index <= -2
- # Apply skill use effects to target actor
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- # If single target
- if @target_window.index >= 0
- # Apply skill use effects to target actor
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- # If skill was used
- if used
- # Play skill use SE
- $game_system.se_play(@skill.menu_se)
- # Use up SP
- @actor.sp -= @skill.sp_cost
- # Remake each window content
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # If entire party is dead
- if $game_party.all_dead?
- # Switch to game over screen
- $scene = Scene_Gameover.new
- return
- end
- # If command event ID is valid
- if @skill.common_event_id > 0
- # Command event call reservation
- $game_temp.common_event_id = @skill.common_event_id
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- end
- # If effect scope is other than ally
- else
- # If common event ID is valid
- if @skill.common_event_id > 0
- # Common event call reservation
- $game_temp.common_event_id = @skill.common_event_id
- # Play use skill SE
- $game_system.se_play(@skill.menu_se)
- # Use up SP
- @actor.sp -= @skill.sp_cost
- # Remake each window content
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- # If R button was pressed
- if Input.trigger?(Input::R)
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # To next actor
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # Switch to different skill screen
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- # If L button was pressed
- if Input.trigger?(Input::L)
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # To previous actor
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # Switch to different skill screen
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- end
- end
- #==============================================================================
- # ** Scene_Equip
- #------------------------------------------------------------------------------
- # This class performs equipment screen processing.
- #==============================================================================
- class Scene_Equip
- def update_right
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(2)
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # If equipment is fixed
- if @actor.equip_fix?(@right_window.index)
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Activate item window
- @right_window.active = false
- @item_window.active = true
- @item_window.index = 0
- return
- end
- # If R button was pressed
- if Input.trigger?(Input::R)
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # To next actor
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # Switch to different equipment screen
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- # If L button was pressed
- if Input.trigger?(Input::L)
- # Play cursor SE
- $game_system.se_play($data_system.cursor_se)
- # To previous actor
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # Switch to different equipment screen
- $scene = Scene_Equip.new(@actor_index, @right_window.index)
- return
- end
- end
- end
- #==============================================================================
- # ** Scene_Save
- #------------------------------------------------------------------------------
- # This class performs save screen processing.
- #==============================================================================
- class Scene_Save < Scene_File
- def on_decision(filename)
- # Play save SE
- $game_system.se_play($data_system.save_se)
- # Write save data
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- # If called from event
- if $game_temp.save_calling
- # Clear save call flag
- $game_temp.save_calling = false
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # Switch to menu screen
- $scene = Scene_Menu.new(0)
- end
- def on_cancel
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # If called from event
- if $game_temp.save_calling
- # Clear save call flag
- $game_temp.save_calling = false
- # Switch to map screen
- $scene = Scene_Map.new
- return
- end
- # Switch to menu screen
- $scene = Scene_Menu.new(0)
- end
- end
- class Scene_End
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Make command window
- s1 = "Save"
- s2 = "To Title"
- s3 = "Exit"
- s4 = "Cancel"
- @command_window = Window_Command.new(192, [s1, s2, s3, s4])
- @command_window.x = 320 - @command_window.width / 2
- @command_window.y = 240 - @command_window.height / 2
- # Execute transition
- Graphics.transition
- if $game_system.save_disabled
- # Disable save
- @command_window.disable_item(0)
- end
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame Update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- # Dispose of window
- @command_window.dispose
- # If switching to title screen
- if $scene.is_a?(Scene_Title)
- # Fade out screen
- Graphics.transition
- Graphics.freeze
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- # Update command window
- @command_window.update
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(4)
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Branch by command window cursor position
- case @command_window.index
- when 0 # Save
- command_save
- when 1 # to title
- command_to_title
- when 2 # shutdown
- command_shutdown
- when 3 # cancel
- command_cancel
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Process When Choosing [Save] Command
- #--------------------------------------------------------------------------
- def command_save
- if $game_system.save_disabled
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Save.new
- end
- #--------------------------------------------------------------------------
- # * Process When Choosing [To Title] Command
- #--------------------------------------------------------------------------
- def command_to_title
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Fade out BGM, BGS, and ME
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # Switch to title screen
- $scene = Scene_Title.new
- end
- #--------------------------------------------------------------------------
- # * Process When Choosing [Shutdown] Command
- #--------------------------------------------------------------------------
- def command_shutdown
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Fade out BGM, BGS, and ME
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # Shutdown
- $scene = nil
- end
- #--------------------------------------------------------------------------
- # * Process When Choosing [Cancel] Command
- #--------------------------------------------------------------------------
- def command_cancel
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(4)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement