Pause Screen (In & Out of Battle)

Z3R0X505

Basic Scripter
Member
Joined
Apr 3, 2013
Messages
8
Reaction score
8
First Language
English
Primarily Uses
Introduction

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

Script

#==============================================================================# 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 :paused 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::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 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::pause_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::pause_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 =  ""
 
Last edited by a moderator:

Nosleinad

Storyteller
Veteran
Joined
Dec 12, 2012
Messages
351
Reaction score
29
First Language
Portuguese
Primarily Uses
Very handy script  :)  , thanks.

What are the terms of use of this script?
 

Z3R0X505

Basic Scripter
Member
Joined
Apr 3, 2013
Messages
8
Reaction score
8
First Language
English
Primarily Uses
Free to use in any commercial or non-commercial as long as properly credited.
 

KevinFrost

KevinFrost91
Veteran
Joined
Jul 19, 2013
Messages
39
Reaction score
9
First Language
English
Primarily Uses
RMMV
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!
 
Joined
Oct 30, 2013
Messages
2
Reaction score
0
First Language
English
Primarily Uses
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?
 

chelle01411

Veteran
Veteran
Joined
Jul 31, 2014
Messages
31
Reaction score
0
First Language
English
Primarily Uses
how about pausing the SE and play the SE to the point where it stops? how to do that? :)
 

HopeFragment

H'witch Nerd
Veteran
Joined
Mar 15, 2014
Messages
121
Reaction score
11
First Language
English
Primarily Uses
RMVXA
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.
 

Halfmoon Media

Illustrator, Eventer, Writer
Veteran
Joined
Aug 17, 2014
Messages
61
Reaction score
9
First Language
English
Primarily Uses
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.
 

Nanaki_Fan

Veteran
Veteran
Joined
Jul 15, 2014
Messages
501
Reaction score
159
First Language
English
Primarily Uses
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Try adding


@pause_pic.z = 10000


after each


@pause_pic = Sprite.new


command.
 

DavidFoxfire

Veteran
Veteran
Joined
Feb 28, 2014
Messages
224
Reaction score
44
Primarily Uses
What the dimension requirement for the Pause Picture.  Is it automatically centered on the screen?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top