stop BGS while in menu

NeoPGX

~ King of Cuteness ~
Veteran
Joined
May 15, 2014
Messages
847
Reaction score
175
First Language
English (US)
Primarily Uses
N/A
I noticed that whenever you go into the in-game menu / stats screen. The BGS continues to play, I would like a script that stops the sound the very instant the menu is brought up and resumes it when you exit the menu.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Try putting this on a blank script under materials and see if it works

Code:
class Scene_Base  alias start_stop_bgs start  def start    start_stop_bgs    if self.is_a?(Scene_Map)      $RPG_BGS.play unless $RPG_BGS.nil?    elsif self.is_a?(Scene_Menu)      $RPG_BGS = RPG::BGS      $RPG_BGS.stop unless $RPG_BGS.nil?    end  endend
 
Last edited by a moderator:

NeoPGX

~ King of Cuteness ~
Veteran
Joined
May 15, 2014
Messages
847
Reaction score
175
First Language
English (US)
Primarily Uses
N/A
Works well, however I do get this error the very instant I exit the menu

stopBGSmenuerror.png
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Go to the help file, go to the 2nd tab, find RPG::BGS topic. Try to look for the play method there.


Can't check now as I'm at work and have no access to Ace here.
 
Last edited by a moderator:

NeoPGX

~ King of Cuteness ~
Veteran
Joined
May 15, 2014
Messages
847
Reaction score
175
First Language
English (US)
Primarily Uses
N/A
Go to the help file, go to the 2nd tab, find RPG::BGS topic. Try to look for the play method there.

Can't check now as I'm at work and have no access to Ace here.
Looked at it and closed the file almost instantly. That stuff looks way too complicated to me.
 

NeoPGX

~ King of Cuteness ~
Veteran
Joined
May 15, 2014
Messages
847
Reaction score
175
First Language
English (US)
Primarily Uses
N/A
Hey, are you gonna fix this? Still waiting. :)
 
Last edited by a moderator:

Solistra

Veteran
Veteran
Joined
Aug 15, 2012
Messages
593
Reaction score
247
Primarily Uses
Untested (I don't have my VM open), but I'd recommend something like this instead:

Code:
class Scene_Menu < Scene_MenuBase  alias_method :start_stop_bgs, :start  def start(*args, &block)    start_stop_bgs(*args, &block)    Audio.bgs_stop  end    alias_method :terminate_start_bgs, :terminate  def terminate(*args, &block)    terminate_start_bgs(*args, &block)    RPG::BGS.last.replay  endend
Let me know if that works for you.
 

NeoPGX

~ King of Cuteness ~
Veteran
Joined
May 15, 2014
Messages
847
Reaction score
175
First Language
English (US)
Primarily Uses
N/A
Untested (I don't have my VM open), but I'd recommend something like this instead:

class Scene_Menu < Scene_MenuBase alias_method :start_stop_bgs, :start def start(*args, &block) start_stop_bgs(*args, &block) Audio.bgs_stop end alias_method :terminate_start_bgs, :terminate def terminate(*args, &block) terminate_start_bgs(*args, &block) RPG::BGS.last.replay endendLet me know if that works for you.
Works fine on the main menu, but when I go to any other menu from that menu, the BGS starts back up again.

Also I am using Yanfly Engine Ace - System Options, so you might want to keep that in mind.
 
Last edited by a moderator:

Solistra

Veteran
Veteran
Joined
Aug 15, 2012
Messages
593
Reaction score
247
Primarily Uses
Of course it would -- there's an obvious problem with what I posted. Try this instead:

Code:
class Scene_Base  alias_method :start_stop_bgs, :start  def start(*args, &block)    start_stop_bgs(*args, &block)    RPG::BGS.last.replay if kind_of?(Scene_Map)    Audio.bgs_stop if kind_of?(Scene_Menu)  endend
Edit: I'm known to make stupid mistakes when I don't have RPG Maker open in front of me, but that really should do what you want now. :)
 
Last edited by a moderator:

NeoPGX

~ King of Cuteness ~
Veteran
Joined
May 15, 2014
Messages
847
Reaction score
175
First Language
English (US)
Primarily Uses
N/A
Of course it would -- there's an obvious problem with what I posted. Try this instead:

class Scene_Base alias_method :start_stop_bgs, :start def start(*args, &block) start_stop_bgs(*args, &block) RPG::BGS.last.replay if kind_of?(Scene_Map) Audio.bgs_stop if kind_of?(Scene_Menu) endendEdit: I'm known to make stupid mistakes when I don't have RPG Maker open in front of me, but that really should do what you want now. :)
Works perfectly now! Thanks a lot! :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top