Pause Screen (In & Out of Battle)

Introduction

This will allow you to pause the game in and out of battle by the press of a button.

Script

Spoiler
#==============================================================================# Pause Screen by Z3R0X505#------------------------------------------------------------------------------# Allows you to pause the game in battle and on the map using a set button.#==============================================================================# Terms of Use: May be used for commercial and non-commercial as long as I am# properly credited.#==============================================================================module Pause_Screen #Button used to call and cancel the pause screen. Pause_Input = Input::F8 #Default F8 #SE to be played when triggered. Pause_SE = "Decision2" Pause_SE_Volume = 100 Pause_SE_Pitch = 100 #BGM to be played while paused. Pause_BGM = "Dungeon7" Pause_BGM_Volume = 100 Pause_BGM_Pitch = 100 #Picture used as the pause screen located in Graphic/Pictures/ folder. Pause_Pic = "Pause" #Allow pause in battle? Allow_IN_Battle = true Allow_ON_Map = trueend#========================= Don't edit past here ===============================class Game_Temp attr_accessor 😛aused alias pause_init initialize def initialize @paused = false pause_init endendmodule Game_Pause_Screen include Pause_Screen def update_pause update_pausing update_pause_input end def update_pause_input if SceneManager.scene_is?(Scene_Battle) if Allow_IN_Battle == true check_if_paused if Input.trigger?(Pause_Screen:😛ause_Input) end elsif SceneManager.scene_is?(Scene_Map) if Allow_ON_Map == true check_if_paused if Input.trigger?(Pause_Screen:😛ause_Input) end end end def check_if_paused Audio.se_play("Audio/SE/" + Pause_SE,Pause_SE_Volume,Pause_SE_Pitch) $game_temp.paused = $game_temp.paused == true ? false : true end def update_pausing return if !$game_temp.paused $game_system.save_bgm Audio.bgm_play("Audio/BGM/" + Pause_BGM, Pause_BGM_Volume, Pause_BGM_Pitch) loop do if !$game_temp.paused @pause_pic.dispose $game_system.replay_bgm end break if !$game_temp.paused update_paused Input.update Graphics.update end end def update_paused update_pause_input endendclass Scene_Battle < Scene_Base include Game_Pause_Screen alias pause_update_basic update_basic def update_basic pause_update_basic update_pause if $game_temp.paused draw_pause_pic end end def draw_pause_pic @pause_pic = Sprite.new @pause_pic.bitmap = Cache.picture(Pause_Screen:😛ause_Pic) endendclass Scene_Map < Scene_Base include Game_Pause_Screen alias pause_map_update update def update pause_map_update update_pause if $game_temp.paused draw_pause_pic end end def draw_pause_pic @pause_pic = Sprite.new @pause_pic.bitmap = Cache.picture(Pause_Screen:😛ause_Pic) endend
Credits

  • Z3R0X505
Note: Make sure to place the pause image in the folder.

         To turn off the music set the names of them like this ->    Pause_SE =  ""
Very handy script  🙂  , thanks.

What are the terms of use of this script?
Free to use in any commercial or non-commercial as long as properly credited.
This is an awesome script!

I was wondering, is there a way to make it so that I can show a choice menu when the game is paused? I am making a side scrolling game and want it to be when people pause the game, that is also the place where they choose to either exit the level, restart the level, or resume.

So not sure if there would need to be major script changes for such a thing, or if maybe you could tell me which lines I'd need to include in a script call to pause the game and have a working menu.

Thanks in advance!
I found a slight bug with this, in battle after you pause then unpause, it causes the enemies to be killed, any way around this?
Also having battle pause issues how do I change the key from F8 if I change it to F2 it errors.


Here is the screen I made for the script.

pause_10.jpg


Anyone else wants made visit my workshop

http://forums.rpgmakerweb.com/index.php?/topic/5084-shingamixs-super-art-workshop-titles-game-overs-and-more/page-7
how about pausing the SE and play the SE to the point where it stops? how to do that? 🙂
I found a slight bug with this, in battle after you pause then unpause, it causes the enemies to be killed, any way around this?
Do you use the Yanfly battle engine? If so, that's what caused it. In test mode, the Yanfly battle engine has debug keys. F8 automatically kills all the enemies.
Is there any way to change the z value for the image? The pause image gets covered by message text and a few other items on the screen when used.
This is great put i run into a problem when using parallax images. My pause image seems to appear below the parallax image and thus I get my parallaxing picture all over it.

How do I make it so that this pause picture is the one that is on top?
Try adding


@pause_pic.z = 10000


after each


@pause_pic = Sprite.new


command.
What the dimension requirement for the Pause Picture.  Is it automatically centered on the screen?
Try adding

@pause_pic.z = 10000

after each

@pause_pic = Sprite.new

command.
this worked.

many thanks 🙂
I can't get it to work. Can you put a proper formatted script up so I don't have to try and guess where the line breaks are suppose to be. Cause it gives me errors until I add in three more end statements.
Script update coming. Fixed formatting
Roninator2 fixed script format, credit Z3R0X505. And Shaz for parallax fix.

Note: Make sure to place the Pause image in the Graphics/Pictures folder.

To turn off the music set the names of them like this -> Pause_SE = ""

Ruby:
#==============================================================================
# Pause Screen by Z3R0X505
#------------------------------------------------------------------------------
# Allows you to pause the game in battle and on the map using a set button.
#==============================================================================
# Terms of Use: May be used for commercial and non-commercial as long as I am
# properly credited.
#==============================================================================
module Pause_Screen
  #Button used to call and cancel the pause screen.
  Pause_Input = Input::F8
  #Default F8
  #SE to be played when triggered.
  Pause_SE = "Decision2"
  Pause_SE_Volume = 100
  Pause_SE_Pitch = 100
  #BGM to be played while paused.
  Pause_BGM = "Dungeon7"
  Pause_BGM_Volume = 100
  Pause_BGM_Pitch = 100
  #Picture used as the pause screen located in Graphic/Pictures/ folder.
  Pause_Pic = "Pause"
  #Allow pause in battle?
  Allow_IN_Battle = true
  Allow_ON_Map = true
end
#========================= Don't edit past here ===============================
class Game_Temp
  attr_accessor :paused
  alias pause_init initialize
  def initialize
    @paused = false
    pause_init
  end
end
module Game_Pause_Screen
  include Pause_Screen
  def update_pause
    update_pausing
    update_pause_input
  end
  def update_pause_input
    if SceneManager.scene_is?(Scene_Battle)
      if Allow_IN_Battle == true
        check_if_paused if Input.trigger?(Pause_Screen::Pause_Input)
      end
    elsif SceneManager.scene_is?(Scene_Map)
      if Allow_ON_Map == true
        check_if_paused if Input.trigger?(Pause_Screen::Pause_Input)
      end
    end
  end
  def check_if_paused
    Audio.se_play("Audio/SE/" + Pause_SE,Pause_SE_Volume,Pause_SE_Pitch)
    $game_temp.paused = $game_temp.paused == true ? false : true
  end
  def update_pausing
    return if !$game_temp.paused
    $game_system.save_bgm
    Audio.bgm_play("Audio/BGM/" + Pause_BGM, Pause_BGM_Volume, Pause_BGM_Pitch)
    loop do
      if !$game_temp.paused
        @pause_pic.dispose
        $game_system.replay_bgm
      end
      break if !$game_temp.paused
      update_paused
      Input.update
      Graphics.update
    end
  end
  def update_paused
    update_pause_input
  end
end
class Scene_Battle < Scene_Base
  include Game_Pause_Screen
  alias pause_update_basic update_basic
  def update_basic
    pause_update_basic
    update_pause
    if $game_temp.paused
      draw_pause_pic
    end
  end
  def draw_pause_pic
    @pause_pic = Sprite.new
    @pause_pic.bitmap = Cache.picture(Pause_Screen::Pause_Pic)
  end
end
class Scene_Map < Scene_Base
  include Game_Pause_Screen
  alias pause_map_update update
  def update
    pause_map_update
    update_pause
    if $game_temp.paused
      draw_pause_pic
    end
  end
  def draw_pause_pic
    @pause_pic = Sprite.new
    @pause_pic.bitmap = Cache.picture(Pause_Screen::Pause_Pic)
  end
end


Spoiler: Pause
Pause.png


For default resolution: 544x416
You can use your own, this is an example

Original thread: https://forums.rpgmakerweb.com/threads/pause-screen-in-out-of-battle.11499/