KMenuSound ACE
KMenuSound ACEby Kyonides Arkanthes
Introduction
A board member once requested a new scriptlet that could help the game developer play a BGM on the main menu scene. It also lets you resume the previously played map BGM right where it was interrupted. This script does not alter the GUI at all so no screenshots should be provided ever!
Ruby:
# * KMenuSound ACE
# Scripter : Kyonides Arkanthes
# 2021-10-01
# This scriptlet will let you resume the BGM or BGS previously played on the
# current map right after exiting the menu scene. Besides the menu also features
# its very own BGM! Please feel free to set the values of KMenuSound module's
# Constants at will.
module KMenuSound
BGM = "Theme2"
VOLUME = 70
PITCH = 100
extend self
attr_accessor :bgm_pos, :bgs_pos
@bgm_pos = 0
@bgs_pos = 0
end
class Game_Map
def play_last_bgms
@map.bgm.play(KMenuSound.bgm_pos) if @map.autoplay_bgm
@map.bgs.play(KMenuSound.bgs_pos) if @map.autoplay_bgs
end
end
class Scene_Menu
include KMenuSound
alias :kyon_menusnd_scn_menu_start :start
def start
kyon_menusnd_scn_menu_start
bgm = RPG::BGM.new(BGM, VOLUME, PITCH)
bgm.play
end
end
class Scene_Map
alias :kyon_menusnd_scn_map_start2 :post_start
alias :kyon_menusnd_scn_map_call_menu :call_menu
def post_start
kyon_menusnd_scn_map_start2
$game_map.play_last_bgms
end
def call_menu
KMenuSound.bgm_pos = RPG::BGM.last.pos
KMenuSound.bgs_pos = RPG::BGS.last.pos
kyon_menusnd_scn_map_call_menu
end
end
Terms & Conditions
Feel free to use it anywhere.
Mention me in your game credits!
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kmenusound-ace.140948/
页:
[1]