じ☆ve冰风 发表于 2026-8-2 16:38:17

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 = 100Pause_SE_Pitch = 100    #BGM to be played while paused.Pause_BGM = "Dungeon7"Pause_BGM_Volume = 100Pause_BGM_Pitch = 100    #Picture used as the pause screen located in Graphic/Pictures/ folder.Pause_Pic = "Pause"    #Allow pause in battle?Allow_IN_Battle = trueAllow_ON_Map = trueend#========================= Don't edit past here ===============================class Game_Tempattr_accessor
aused                alias pause_init initializedef initialize    @paused = false    pause_initendendmodule Game_Pause_Screen    include Pause_Screendef 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    endend                      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            endend                  def update_paused    update_pause_inputendendclass Scene_Battle < Scene_Base   include Game_Pause_Screenalias pause_update_basic update_basicdef update_basic    pause_update_basic    update_pause    if $game_temp.paused      draw_pause_pic    endenddef draw_pause_pic    @pause_pic = Sprite.new    @pause_pic.bitmap = Cache.picture(Pause_Screen:
ause_Pic)endendclass Scene_Map < Scene_Baseinclude Game_Pause_Screenalias pause_map_update updatedef update    pause_map_update    update_pause    if $game_temp.paused      draw_pause_pic    endenddef 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 =  ""


本贴来自国际rpgmaker官方论坛作者:Z3R0X505处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/pause-screen-in-out-of-battle.11499/
页: [1]
查看完整版本: Pause Screen (In &amp; Out of Battle)