Don't like ads? PRO users don't see any ads ;-)

Play SE On Balloon Pop-Up ~ RGSS2 & RGSS3

By: diamondandplatinum3 on Jul 22nd, 2012  |  syntax: Ruby  |  size: 6.24 KB  |  hits: 224  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Play SE On Balloon Pop-Up
  3. #             Version: 1.0
  4. #             Author: DiamondandPlatinum3
  5. #             Date: July 31, 2012
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #
  9. #    This script allows you to play an SE (Sound Effect) when a ballon icon
  10. #    pops-up above someones head.
  11. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12. #------------------------------------------------------------------------------
  13. #  Instructions:
  14. #  
  15. #     -  All you have to do is go into the editable region and change the
  16. #        appropriate settings to suit your needs. This includes which SE plays
  17. #        depending on the balloon icon that is being shown.
  18. #
  19. #     -  If you do not wish for an SE to play on any specific balloon icon,
  20. #        simply set the value to nil.
  21. #
  22. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. module DP3_BalloonSE_Options
  24. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  25. #                                                        -=
  26. #                 Editable Region        ////            ==
  27. #                                                        =-
  28. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29.  
  30. # Event Switch ID to turn off Balloon SE (maybe you have a serious scene and
  31. # The balloons are taking away the seriousness. This switch will turn them off.
  32. Event_Switch_ID = 10
  33.  
  34.  
  35.                 # SE to Play, Volume, Pitch
  36. Exclamation_SE  = [ "Raise1",   80,   100 ] # SE played with Exclamation Balloon
  37. Question_SE     = [ "Confuse",  80,   100 ] # SE played with Question Balloon
  38. Music_Note_SE   = [ "Sound1",   80,   100 ] # SE played with Music Note Balloon
  39. Heart_SE        = [ "Recovery", 80,   100 ] # SE played with Heart Balloon
  40. Anger_SE        = [ "Buzzer1",  80,   100 ] # SE played with Anger Balloon
  41. Sweat_SE        = [ "Fall",     80,   100 ] # SE played with Sweat Balloon
  42. Cobweb_SE       = [ "Sand",     80,   100 ] # SE played with Cobweb Balloon
  43. Silence_SE      = [ "Silence",  60,   100 ] # SE played with Silence Balloon
  44. Lightbulb_SE    = [ "Stare",    80,   100 ] # SE played with Lightbulb Balloon
  45. Zzz_SE          = [ nil,        80,   100 ] # SE played with Zzz Balloon
  46.  
  47. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  48. end # of Editable Region
  49. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  50. #---------------------------------------------------------
  51. # No touchie past here unless you know what you are
  52. # doing. Failure to heed this warning could cause your
  53. # computer to yell and scream at you.
  54. #
  55. # Edit at your own risk.
  56. #--------------------------------------------------------
  57.  
  58.  
  59.  
  60. class Sprite_Character < Sprite_Base
  61.   alias dp3_balloon_sfx_play_9huf start_balloon
  62.   def start_balloon
  63.    
  64.     unless $game_switches[DP3_BalloonSE_Options::Event_Switch_ID]
  65.       #===========================================================================
  66.       #Find out which balloon is being used and play the SE appropriately.
  67.       case @balloon_id
  68.      
  69.       when 1 # Exclamation Balloon
  70.         RPG::SE.new(DP3_BalloonSE_Options::Exclamation_SE[0],
  71.                     DP3_BalloonSE_Options::Exclamation_SE[1],
  72.                     DP3_BalloonSE_Options::Exclamation_SE[2]
  73.                     ).play if DP3_BalloonSE_Options::Exclamation_SE[0]
  74.                    
  75.       when 2 # Question Balloon
  76.         RPG::SE.new(DP3_BalloonSE_Options::Question_SE[0],
  77.                     DP3_BalloonSE_Options::Question_SE[1],
  78.                     DP3_BalloonSE_Options::Question_SE[2]
  79.                     ).play if DP3_BalloonSE_Options::Question_SE[0]
  80.        
  81.       when 3 # Music Note Balloon
  82.         RPG::SE.new(DP3_BalloonSE_Options::Music_Note_SE[0],
  83.                     DP3_BalloonSE_Options::Music_Note_SE[1],
  84.                     DP3_BalloonSE_Options::Music_Note_SE[2]
  85.                     ).play if DP3_BalloonSE_Options::Music_Note_SE[0]
  86.        
  87.       when 4 # Heart Balloon
  88.         RPG::SE.new(DP3_BalloonSE_Options::Heart_SE[0],
  89.                     DP3_BalloonSE_Options::Heart_SE[1],
  90.                     DP3_BalloonSE_Options::Heart_SE[2]
  91.                     ).play if DP3_BalloonSE_Options::Heart_SE[0]
  92.        
  93.       when 5 # Anger Balloon
  94.         RPG::SE.new(DP3_BalloonSE_Options::Anger_SE[0],
  95.                     DP3_BalloonSE_Options::Anger_SE[1],
  96.                     DP3_BalloonSE_Options::Anger_SE[2]
  97.                     ).play if DP3_BalloonSE_Options::Anger_SE[0]
  98.        
  99.       when 6 # Sweat Balloon
  100.         RPG::SE.new(DP3_BalloonSE_Options::Sweat_SE[0],
  101.                     DP3_BalloonSE_Options::Sweat_SE[1],
  102.                     DP3_BalloonSE_Options::Sweat_SE[2]
  103.                     ).play if DP3_BalloonSE_Options::Sweat_SE[0]
  104.        
  105.       when 7 # Cobweb Balloon
  106.         RPG::SE.new(DP3_BalloonSE_Options::Cobweb_SE[0],
  107.                     DP3_BalloonSE_Options::Cobweb_SE[1],
  108.                     DP3_BalloonSE_Options::Cobweb_SE[2]
  109.                     ).play if DP3_BalloonSE_Options::Cobweb_SE[0]
  110.        
  111.       when 8 # Silence Balloon
  112.         RPG::SE.new(DP3_BalloonSE_Options::Silence_SE[0],
  113.                     DP3_BalloonSE_Options::Silence_SE[1],
  114.                     DP3_BalloonSE_Options::Silence_SE[2]
  115.                     ).play if DP3_BalloonSE_Options::Silence_SE[0]
  116.        
  117.       when 9 # Lightbulb Balloon
  118.         RPG::SE.new(DP3_BalloonSE_Options::Lightbulb_SE[0],
  119.                     DP3_BalloonSE_Options::Lightbulb_SE[1],
  120.                     DP3_BalloonSE_Options::Lightbulb_SE[2]
  121.                     ).play if DP3_BalloonSE_Options::Lightbulb_SE[0]
  122.        
  123.       when 10 # Zzz Balloon
  124.         RPG::SE.new(DP3_BalloonSE_Options::Zzz_SE[0],
  125.                     DP3_BalloonSE_Options::Zzz_SE[1],
  126.                     DP3_BalloonSE_Options::Zzz_SE[2]
  127.                     ).play if DP3_BalloonSE_Options::Zzz_SE[0]
  128.        
  129.       end # of case
  130.       #===========================================================================
  131.     end # of 'unless' statement
  132.    
  133.     # call the original function (we've done what we need)
  134.     dp3_balloon_sfx_play_9huf
  135.    
  136.   end # of function
  137. end # of class