Stopping a specific BGS

mcscottyG

Villager
Member
Joined
Mar 22, 2016
Messages
9
Reaction score
0
First Language
english
Primarily Uses
Hello everyone!  I'm a long time lurker, but first time contributor to the forums.  To get the point, I've been playing around with a weather system that relies on temperature, dewpoint, and weather chance.  Basically, if the temperature is lower than the dewpoint and the weather chance is above a certain amount (weather==ON), it will rain/storm/snow.  The temperature changes every day and night, allowing the system to switch from rain to snow or vice versa if the conditions are right.  What I'm having trouble with is when rain switches to snow, I want the rain BGS to stop, but the wind BGS to keep playing.  Instead, the BGS stops completely, as the fadeout BGS function affects all BGS's instead of a specific one.  I've looked a little into working it as script, but the commands seem to offer the same function, fading out all BGS's rather than a specific one.  Any thoughts how to do this? 
 

Lightness

Veteran
Veteran
Joined
May 11, 2012
Messages
37
Reaction score
4
First Language
English
Primarily Uses
By default, RMXP only allows one BGS to be playing at a time which is why there's no option to stop a specific one. I'm guessing the ability to play more than one is being added by the script that you're using for this weather system. If that is the case, could you provide a link to the script you're using (and we may want to get this thread moved to the script support forum)?
 

mcscottyG

Villager
Member
Joined
Mar 22, 2016
Messages
9
Reaction score
0
First Language
english
Primarily Uses
By default, RMXP only allows one BGS to be playing at a time which is why there's no option to stop a specific one. I'm guessing the ability to play more than one is being added by the script that you're using for this weather system. If that is the case, could you provide a link to the script you're using (and we may want to get this thread moved to the script support forum)?
I'm not using any script that allows that. That would explain why the functionality doesn't exist haha. Since that's the case, I'm sure there's a spot in my Common Event that falls short on accomplishing my goal.  I'll have to comb through it more thoroughly.  Thank you for your response.
 

Heretic86

Veteran
Veteran
Joined
Nov 30, 2014
Messages
240
Reaction score
167
First Language
Engrish
Primarily Uses
Try this:


#==============================================================================
#
#     Background Sound Playing?
#
#  ---  Instructions  ---
#
#  Run a Script, usually from Conditional Branch -> Script, or from custom methods:
#
#  - bgs_playing?
#   * Evaluates to True if any Background Sound is playing
#
#  - bgs_playing?('005-Rain01')
#   * Evaluates to True if the current Background Sound is this file name
#
#  NOTE: Untested on RMVX or RMVX Ace
#
#==============================================================================


#==============================================================================
# ** Game_System - Class
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  # * BGS Playing? - Game_System
  #      sound : name
  #   Example: bgs_playing? returns true if there is ANY Background Sound
  #            bgs_playing?('005-Rain01') returns true if the name matches
  #--------------------------------------------------------------------------
  def bgs_playing?(sound = nil)
    # If a Background Sound is Playing
    if @playing_bgs
      # Return true that Background Sound is Playing when not specifying sound
      return true if not sound
      # Return true if a Bacground Sound matches the specified sound
      return true if @playing_bgs.name == sound
    end
    # Default - Sound is not playing or file does not match specified sound
    return false
  end
end


#==============================================================================
# ** Interpreter - Class
#  NOTE: Rename this to Game_Interpreter for VX+, wont work with RMMV


#


#  - This just allows people to put "bgs_playing?(sound_name)" in a Script or Conditional Branch


#    without having to put in "$game_system.bgs_playing('sound_name')" so its shorter.
#==============================================================================
class Interpreter
  #--------------------------------------------------------------------------
  # * BGS Playing? - Interpreter
  #--------------------------------------------------------------------------
  def bgs_playing?(sound = nil)
    # Call same method in Game_System
    return $game_system.bgs_playing?(sound)
  end
end


In your Event inside your Conditional Branch, after you see that a specific sound is playing, just put in a "Fade Out BGS..." command.  After "Fade Out BGS..." is called, this won't evaluate to true.


NOTE:  I tested this with some other scripts as I was writing it, but it appears to not work with Ryexs Dynamic Sounds without additional modifications to the script.  There is another script by ForeverZer0 called Ambient SFX which does allow multiple backgrounds to play at the same time.  This quick script also wont detect Ambient SFX if your sound is Ambient.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top