Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> How do you check when an ME is playing?, Can't work out how to script it
steve09424
post Sep 1 2011, 10:00 AM
Post #1


Level 4
Group Icon

Group: Member
Posts: 52
Type: None
RM Skill: Undisclosed




Hello!

As you know, BulletXT Audio Engine 1.2 doesn't stop the BGM temporarily when a ME is played. I was just wondering how you add a little script to it that will tell the audio engine to pause the map BGM, the play the ME, then resuming the map BGM.

Please help.
Thanks!
Go to the top of the page
 
+Quote Post
   
The Law G14
post Sep 1 2011, 02:24 PM
Post #2


Scripter FTW
Group Icon

Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5




Hopefully this is what you were looking for and I'm also hoping that this is compatible with your Audio Engine:

CODE
#==============================================================================
# Title: Stop BGM When playing ME
# Version: 1.0
# Author: The Law G14
#==============================================================================

#==============================================================================
# ** Module_RPG
#------------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#==============================================================================

module RPG
  #==========================================================================
==
  # ** Class BGM
  #==========================================================================
==
  class BGM < AudioFile
    #-------------------------------------------------------------------------
    # * Class Variables
    #-------------------------------------------------------------------------
    @@last = BGM.new
    #-------------------------------------------------------------------------
    # * Alias Listing
    #-------------------------------------------------------------------------
    alias law_bgm_stop_when_me_rpg_bgm_play play
    #-------------------------------------------------------------------------
    # * Play
    #-------------------------------------------------------------------------
    def play
      # Check if ME is valid
      if !@name.empty?
        Audio.bgm_play("Audio/BGM/" + @name, @volume, @pitch)
        @@last = "Audio/BGM/" + @name
      else
        law_bgm_stop_when_me_rpg_bgm_play
      end
    end
  end
  #==========================================================================
==
  # ** Class ME
  #==========================================================================
==
  class ME < AudioFile
    #-------------------------------------------------------------------------
    # * Alias Listing
    #-------------------------------------------------------------------------
    alias law_bgm_stop_when_me_rpg_me_play play
    #-------------------------------------------------------------------------
    # * Play
    #-------------------------------------------------------------------------
    def play
      # Check if ME is valid
      if !@name.empty?
        # If so temporarily stop currently playing BGM
        bgm = RPG::BGM.last
        Audio.bgm_stop
        # Play ME
        Audio.me_play("Audio/ME/" + @name, @volume, @pitch)
        # Then return back to original BGM
        Audio.bgm_play(bgm.to_s)
      else
        # If not, return to original method
        law_bgm_stop_when_me_rpg_me_play
      end
    end
  end
end

#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================


Hope this helps smile.gif


__________________________

To put in sig, copy this link:
CODE
[url="http://www.rpgrevolution.com/forums/index.php?showtopic=51540"][img]http://img40.imageshack.us/img40/6504/conceptthelawbanner.png[/img][/url]


Sig Stuff


"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!

If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One

My Project Thread: Gai's Hunters


Go to the top of the page
 
+Quote Post
   
steve09424
post Sep 5 2011, 06:10 AM
Post #3


Level 4
Group Icon

Group: Member
Posts: 52
Type: None
RM Skill: Undisclosed




I get an error when an ME is played "Unable to find file #<RPG::BGM:0x2b657e0>". It could be due to the new Audio engine, and I've tried the script above and below it. I'll see if I can tinker with it a bit more so I can get it to work.

Thanks for replying!
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 08:53 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker