Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Editable_Region
- # If this value is 1 or less it will act as a percentage.
- # If it is more than 1 it will be a flat amount.
- GoldLoss = 0.5
- # Set these to the variable ID's that you will store the MapID, X, and Y
- # of where you want the player to respwan at.
- MapID = 1
- XPos = 0
- YPos = 0
- end # STAT_VALUES
- ################################################################################
- ####### DO NOT EDIT BEYOND THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING #######
- ################################################################################
- module BattleManager
- def self.process_defeat
- $game_message.add(sprintf(Vocab::Defeat, $game_party.name))
- wait_for_message
- if @can_lose
- revive_battle_members
- replay_bgm_and_bgs
- SceneManager.return
- else
- SceneManager.goto(Scene_GameOver)
- end
- battle_end(2)
- return true
- end
- end
- class Game_interpreter
- def command_311
- value = operate_value(@params[2], @params[3], @params[4])
- iterate_actor_var(@params[0], @params[1]) do |actor|
- next if actor.dead?
- actor.change_hp(value, @params[5])
- actor.perform_collapse_effect if actor.dead?
- end
- SceneManager.goto(Scene_GameOver) if $game_party.all_dead?
- end
- end
- class Scene_Base
- def check_gameover
- SceneManager.goto(Scene_GameOver) if $game_party.all_dead?
- end
- end
- class Scene_GameOver < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_command_window
- end
- #--------------------------------------------------------------------------
- # * Create Background
- #--------------------------------------------------------------------------
- def create_background
- @background_sprite = Sprite.new
- @background_sprite.bitmap = Cache.system("GameOver")
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_GameOver.new
- @command_window.set_handler(:Continue?, method(:continue_and_close_command_window))
- @command_window.set_handler(:to_title, method(:command_to_title))
- @command_window.set_handler(:shutdown, method(:command_shutdown))
- end
- #--------------------------------------------------------------------------
- # * Close Command Window
- #--------------------------------------------------------------------------
- def continue_and_close_command_window
- @command_window.close
- @background_sprite.dispose
- update until @command_window.close?
- heal_all_actors
- $game_player.reserve_transfer($game_variables[Editable_Region::MapID], $game_variables[Editable_Region::XPos], $game_variables[Editable_Region::YPos], 2)
- SceneManager.goto(Scene_Map)
- if Editable_Region::GoldLoss > 1
- $game_party.gold -= Editable_Region::GoldLoss
- elsif Editable_Region::GoldLoss == 0
- else
- @gold = $game_party.gold
- @multiplier = Editable_Region::GoldLoss
- @value = @gold*@multiplier
- p "#{@value}"
- $game_party.lose_gold(@value.ceil)
- end
- end
- def heal_all_actors
- $game_party.members.each { |actor|
- actor.recover_all
- actor.hp = 1
- actor.mp = 1
- }
- end
- #--------------------------------------------------------------------------
- # * [Go to Title] Command
- #--------------------------------------------------------------------------
- def command_to_title
- @command_window.close
- @background_sprite.dispose
- fadeout_all
- SceneManager.goto(Scene_Title)
- end
- #--------------------------------------------------------------------------
- # * [Shut Down] Command
- #--------------------------------------------------------------------------
- def command_shutdown
- @command_window.close
- @background_sprite.dispose
- fadeout_all
- SceneManager.exit
- end
- end
- class Window_GameOver < Window_Command
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- update_placement
- self.openness = 0
- open
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 160
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.x = (Graphics.width - width) / 2
- self.y = ((Graphics.height - height) / 2) + 75
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command("Continue?", :Continue?)
- add_command(Vocab::to_title, :to_title)
- add_command(Vocab::shutdown, :shutdown)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement