vindaca510

V's Emotion Balloons v0.3

Feb 21st, 2014
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 21.66 KB | None | 0 0
  1. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  2. #                                                                              #
  3. #                            V's  Emotion Balloons                             #
  4. #                                 Version  0.3                                 #
  5. #                                                                              #
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  7. #                                Written By:  V                                #
  8. #                        Last Edited: February 21, 2013                        #
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  10. #                             Extended Credit to:                              #
  11. #                                                                              #
  12. #                            SoulPour777 ~ Concept                             #
  13. #                                                                              #
  14. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  15.  
  16.  
  17. #==============================================================================#
  18. #------------------------------------------------------------------------------#
  19. # ** Disclaimer                                                                #
  20. #------------------------------------------------------------------------------#
  21. #                                                                              #
  22. # This script was intended for Non-commercial use only, if you wish to use     #
  23. # this script in a commercial game please PM me at which ever site you found   #
  24. # this script. Either way please give me credit in your game script as the     #
  25. # writer of this script, and send me a PM abuot the release of the game/demo.  #
  26. #                                                                              #
  27. #------------------------------------------------------------------------------#
  28. # ** How To Use                                                                #
  29. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  30. #                                                                              #
  31. #  * This script is Plug & Play with a few options below.                      #
  32. #                                                                              #
  33. #------------------------------------------------------------------------------#
  34. # ** Description                                                               #
  35. #------------------------------------------------------------------------------#
  36. #                                                                              #
  37. #  v0.1                                                                        #
  38. # ~=~=~=~                                                                      #
  39. #                                                                              #
  40. # In v0.1, this system will allow you to set up emotion balloons to be called  #
  41. # by hitting F5, F6, F7, or F8.                                                #
  42. #                                                                              #
  43. #  v0.2                                                                        #
  44. # ~=~=~=~                                                                      #
  45. #                                                                              #
  46. # In v0.2 I set-up an option for a menu to allow the player to change each of  #
  47. # the balloon's emotions while in game. I also set-up an option to add as many #
  48. # triggers as you want.                                                        #
  49. #                                                                              #
  50. #  v0.3                                                                        #
  51. # ~=~=~=~                                                                      #
  52. #                                                                              #
  53. # Sound effects can now be assigned to emotions that play when it is displayed.#
  54. #                                                                              #
  55. #------------------------------------------------------------------------------#
  56. #==============================================================================#
  57.  
  58. #==============================================================================
  59. # ** V's Emotion Balloons
  60. #------------------------------------------------------------------------------
  61. #  This module manages customizable features and methods.
  62. #==============================================================================
  63.  
  64. module Emotion_Balloons
  65.   module Specs
  66.   #=============================================================================
  67.   # Balloon Table
  68.   #-----------------------------------------------------------------------------
  69.   # 1  - Exclamation
  70.   # 2  - Question
  71.   # 3  - Music Note
  72.   # 4  - Heart
  73.   # 5  - Anger
  74.   # 6  - Sweat
  75.   # 7  - Cob Web
  76.   # 8  - Silence
  77.   # 9  - Light Bulb
  78.   # 10 - ZZZ
  79.   #=============================================================================
  80.  
  81. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  82. #                                                                              #
  83. #                           Start Customizable Area.                           #
  84. #                                                                              #
  85. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  86. #                                                                              #
  87. #                      ONLY EDIT AFTER THE EQUALS SYMBOL.                      #
  88. #                                                                              #
  89. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  90.    
  91.  
  92.   #=============================================================================
  93.   # * Menu Command:
  94.   #=============================================================================
  95.  
  96.     #--------------------------------------------------------------------------
  97.     # * Adds a command to the Main Menu for the Emotion Balloons Menu
  98.     #--------------------------------------------------------------------------
  99.     Use_Emo_Balloon_Menu_Command = true
  100.    
  101.     #--------------------------------------------------------------------------
  102.     # * Menu Command Vocab
  103.     #--------------------------------------------------------------------------
  104.     Balloon_Menu_Vocab = "Emo Options"
  105.  
  106.    
  107.   #=============================================================================
  108.   # * Emotion Sound Effects:
  109.   #=============================================================================
  110.     Emotion_SFX = [
  111.                     ["Cursor2", 80, 100],   # Exclamation
  112.                     ["Confuse", 80, 100],   # Question
  113.                     ["Saint5", 80, 100],    # Music Note
  114.                     ["Load", 80, 100],      # Heart
  115.                     ["Monster6", 80, 100],  # Anger
  116.                     ["Sound3", 80, 100],    # Sweat
  117.                     ["Sand", 80, 100],      # Cob Web
  118.                     ["Silence", 80, 100],   # Silence
  119.                     ["Thunder12", 80, 100], # Light Bulb
  120.                     ["Sleep", 80, 100],     # ZZZ
  121.                   ]
  122.  
  123.  
  124.   #=============================================================================
  125.   # * Balloon Information:
  126.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127.   # More triggers may be added if wanted.
  128.   #=============================================================================
  129.     Balloon_Info = [   #Trigger          Vocab     Default Emotion
  130.                      [ Input::F5,     "F5 Button",        1      ],
  131.                      [ Input::F6,     "F6 Button",        2      ],
  132.                      [ Input::F7,     "F7 Button",        3      ],
  133.                      [ Input::F8,     "F8 Button",        4      ],
  134.                    ]
  135.  
  136.                    
  137.                    
  138.                    
  139.                    
  140.                    
  141.                    
  142.                    
  143.                    
  144.                    
  145.                    
  146.                    
  147.                    
  148.                    
  149.  
  150. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  151. #                                                                              #
  152. #                            End Customizable Area.                            #
  153. #                                                                              #
  154. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  155. #                                                                              #
  156. #         DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING.         #
  157. #                                                                              #
  158. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  159.    
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. end
  196. end
  197.  
  198. #==============================================================================
  199. # ** Game_System
  200. #------------------------------------------------------------------------------
  201. #  This class handles system data. It saves the disable state of saving and
  202. # menus. Instances of this class are referenced by $game_system.
  203. #==============================================================================
  204.  
  205. class Game_System
  206.  
  207.   #--------------------------------------------------------------------------
  208.   # * Includes Module's Variables With Class
  209.   #--------------------------------------------------------------------------
  210.  
  211.   include Emotion_Balloons::Specs
  212.  
  213.   #--------------------------------------------------------------------------
  214.   # * Public Instance Variables
  215.   #--------------------------------------------------------------------------
  216.   attr_accessor :emo_balloon
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # * Method for Aliasing: Object Initialization
  220.   #--------------------------------------------------------------------------
  221.   alias :gsi5404045000054548485 :initialize
  222.    
  223.   #--------------------------------------------------------------------------
  224.   # * Object Initialization
  225.   #--------------------------------------------------------------------------
  226.   def initialize
  227.     gsi5404045000054548485()
  228.     @emo_balloon = []
  229.     Balloon_Info.size.times { |i| @emo_balloon.push Balloon_Info[i][2] }
  230.   end
  231.  
  232. end
  233.  
  234.  
  235. #==============================================================================
  236. # ** Window_Command
  237. #------------------------------------------------------------------------------
  238. #  This window deals with general command choices.
  239. #==============================================================================
  240.  
  241. class Window_BalloonSelect < Window_Command
  242.  
  243.   #--------------------------------------------------------------------------
  244.   # * Includes Module's Variables With Class
  245.   #--------------------------------------------------------------------------
  246.  
  247.   include Emotion_Balloons::Specs
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # * Start Processing
  251.   #--------------------------------------------------------------------------
  252.   def initialize(x, y)
  253.     super(x, y)
  254.   end
  255.  
  256.   #--------------------------------------------------------------------------
  257.   # * Window Height
  258.   #--------------------------------------------------------------------------
  259.   def window_height
  260.     return Graphics.height
  261.   end
  262.  
  263.   #--------------------------------------------------------------------------
  264.   # * Window Width
  265.   #--------------------------------------------------------------------------
  266.   def window_width
  267.     return Graphics.width / 2
  268.   end
  269.  
  270.   #--------------------------------------------------------------------------
  271.   # * Start Processing
  272.   #--------------------------------------------------------------------------
  273.   def make_command_list
  274.     Balloon_Info.size.times { |i| add_command(Balloon_Info[i][1],  Balloon_Info[i][1].to_sym) }
  275.   end
  276.  
  277. end
  278.  
  279. #==============================================================================
  280. # ** Window_Command
  281. #------------------------------------------------------------------------------
  282. #  This window deals with general command choices.
  283. #==============================================================================
  284.  
  285. class Window_EmotionSelect < Window_Command
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # * Includes Module's Variables With Class
  289.   #--------------------------------------------------------------------------
  290.  
  291.   include Emotion_Balloons::Specs
  292.  
  293.   #--------------------------------------------------------------------------
  294.   # * Start Processing
  295.   #--------------------------------------------------------------------------
  296.   def initialize(x, y)
  297.     super(x, y)
  298.   end
  299.  
  300.   #--------------------------------------------------------------------------
  301.   # * Window Height
  302.   #--------------------------------------------------------------------------
  303.   def window_height
  304.     return Graphics.height
  305.   end
  306.  
  307.   #--------------------------------------------------------------------------
  308.   # * Window Width
  309.   #--------------------------------------------------------------------------
  310.   def window_width
  311.     return Graphics.width / 2
  312.   end
  313.  
  314.   #--------------------------------------------------------------------------
  315.   # * Start Processing
  316.   #--------------------------------------------------------------------------
  317.   def make_command_list
  318.     add_command("Exclamation", :first_emotion)
  319.     add_command("Question",    :second_emotion)
  320.     add_command("Music Note",  :third_emotion)
  321.     add_command("Heart",       :forth_emotion)
  322.     add_command("Anger",       :fifth_emotion)
  323.     add_command("Sweat",       :sixth_emotion)
  324.     add_command("Cob Web",     :seventh_emotion)
  325.     add_command("Silence",     :eighth_emotion)
  326.     add_command("Light Bulb",  :ninth_emotion)
  327.     add_command("ZZZ",         :tenth_emotion)
  328.   end
  329.  
  330. end
  331.  
  332. #==============================================================================
  333. # ** Window_MenuCommand
  334. #------------------------------------------------------------------------------
  335. #  This command window appears on the menu screen.
  336. #==============================================================================
  337.  
  338. class Window_MenuCommand < Window_Command
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # * Includes Module's Variables With Class
  342.   #--------------------------------------------------------------------------
  343.  
  344.   include Emotion_Balloons::Specs
  345.  
  346.   #--------------------------------------------------------------------------
  347.   # * Method for Aliasing: Add Original Commands
  348.   #--------------------------------------------------------------------------
  349.   alias :wmaoc3216504040640 :add_original_commands
  350.    
  351.   #--------------------------------------------------------------------------
  352.   # * Add Original Commands
  353.   #--------------------------------------------------------------------------
  354.   def add_original_commands
  355.     wmaoc3216504040640()
  356.     add_command(Balloon_Menu_Vocab, :emoballoonmenu) if Use_Emo_Balloon_Menu_Command == true
  357.   end
  358.  
  359. end
  360.  
  361.  
  362. #==============================================================================
  363. # ** Scene_Base
  364. #------------------------------------------------------------------------------
  365. #  This is a super class of all scenes within the game.
  366. #==============================================================================
  367.  
  368. class Scene_BalloonEmoMenu < Scene_Base
  369.  
  370.   #--------------------------------------------------------------------------
  371.   # * Includes Module's Variables With Class
  372.   #--------------------------------------------------------------------------
  373.  
  374.   include Emotion_Balloons::Specs
  375.  
  376.   #--------------------------------------------------------------------------
  377.   # * Start Processing
  378.   #--------------------------------------------------------------------------
  379.   def initialize
  380.     create_windows
  381.   end
  382.  
  383.   #--------------------------------------------------------------------------
  384.   # * Create Windows
  385.   #--------------------------------------------------------------------------
  386.   def create_windows
  387.     @balloon_select_window = Window_BalloonSelect.new(0, 0)
  388.     Balloon_Info.size.times { |i|
  389.       @balloon_select_window.set_handler(Balloon_Info[i][1].to_sym,  method(:select_balloon))
  390.     }
  391.     @emo_select_window = Window_EmotionSelect.new(@balloon_select_window.width, 0)
  392.     @emo_select_window.set_handler(:first_emotion,     method(:select_emo))
  393.     @emo_select_window.set_handler(:second_emotion,    method(:select_emo))
  394.     @emo_select_window.set_handler(:third_emotion,     method(:select_emo))
  395.     @emo_select_window.set_handler(:forth_emotion,     method(:select_emo))
  396.     @emo_select_window.set_handler(:fifth_emotion,     method(:select_emo))
  397.     @emo_select_window.set_handler(:sixth_emotion,     method(:select_emo))
  398.     @emo_select_window.set_handler(:seventh_emotion,   method(:select_emo))
  399.     @emo_select_window.set_handler(:eighth_emotion,    method(:select_emo))
  400.     @emo_select_window.set_handler(:ninth_emotion,     method(:select_emo))
  401.     @emo_select_window.set_handler(:tenth_emotion,     method(:select_emo))
  402.     @emo_select_window.unselect
  403.     @emo_select_window.deactivate
  404.   end
  405.  
  406.   #--------------------------------------------------------------------------
  407.   # * Command Method: Select Balloon
  408.   #--------------------------------------------------------------------------
  409.   def select_balloon
  410.     @balloon_select_window.deactivate
  411.     @emo_select_window.select($game_system.emo_balloon[@balloon_select_window.index] - 1)
  412.     @emo_select_window.activate
  413.   end
  414.  
  415.   #--------------------------------------------------------------------------
  416.   # * Command Method: Select Emotion
  417.   #--------------------------------------------------------------------------
  418.   def select_emo
  419.     $game_system.emo_balloon[@balloon_select_window.index] = @emo_select_window.index + 1
  420.     @emo_select_window.unselect
  421.     @emo_select_window.deactivate
  422.     @balloon_select_window.activate
  423.   end
  424.  
  425.   #--------------------------------------------------------------------------
  426.   # * Cancel Current Input
  427.   #--------------------------------------------------------------------------
  428.   def cancel
  429.     Sound.play_cancel
  430.     if @emo_select_window.index >= 0
  431.       @emo_select_window.unselect
  432.       @emo_select_window.deactivate
  433.       @balloon_select_window.activate
  434.     else
  435.       return_scene
  436.     end
  437.   end
  438.  
  439.   #--------------------------------------------------------------------------
  440.   # * Update Processing
  441.   #--------------------------------------------------------------------------
  442.   def update
  443.     super
  444.     cancel if Input.trigger?(:B)
  445.   end
  446.  
  447. end
  448.  
  449.  
  450. #==============================================================================
  451. # ** Scene_Menu
  452. #------------------------------------------------------------------------------
  453. #  This class performs the menu screen processing.
  454. #==============================================================================
  455.  
  456. class Scene_Menu < Scene_MenuBase
  457.  
  458.   #--------------------------------------------------------------------------
  459.   # * Method for Aliasing: Create Command Window
  460.   #--------------------------------------------------------------------------
  461.   alias :smccw54065400000455 :create_command_window
  462.    
  463.   #--------------------------------------------------------------------------
  464.   # * Create Command Window
  465.   #--------------------------------------------------------------------------
  466.   def create_command_window
  467.     smccw54065400000455()
  468.     @command_window.set_handler(:emoballoonmenu,  method(:command_emoballoons))
  469.   end
  470.  
  471.   #--------------------------------------------------------------------------
  472.   # * [Shut Down] Command
  473.   #--------------------------------------------------------------------------
  474.   def command_emoballoons
  475.     SceneManager.call(Scene_BalloonEmoMenu)
  476.   end
  477.    
  478. end
  479.  
  480.  
  481. #==============================================================================
  482. # ** Scene_Map
  483. #------------------------------------------------------------------------------
  484. #  This class performs the map screen processing.
  485. #==============================================================================
  486. class Scene_Map < Scene_Base
  487.  
  488.   #--------------------------------------------------------------------------
  489.   # * Includes Module's Variables With Class
  490.   #--------------------------------------------------------------------------
  491.  
  492.   include Emotion_Balloons::Specs
  493.  
  494.   #--------------------------------------------------------------------------
  495.   # * Method for Aliasing: Update Processing
  496.   #--------------------------------------------------------------------------
  497.   alias :smu4560000 :update
  498.  
  499.   # -----------------------------------------------------
  500.   # Update Processing
  501.   # -----------------------------------------------------
  502.   def update
  503.     smu4560000()
  504.     unless $game_message.visible
  505.       Balloon_Info.size.times { |i|
  506.         show_emotion(i) if Input.trigger?(Balloon_Info[i][0])
  507.       }
  508.     end
  509.   end
  510.  
  511.   # -----------------------------------------------------
  512.   # Update Processing
  513.   # -----------------------------------------------------
  514.   def show_emotion(index)
  515.     RPG::SE.new(Emotion_SFX[index][0], Emotion_SFX[index][1], Emotion_SFX[index][2]).play
  516.     $game_player.balloon_id = $game_system.emo_balloon[index] if Input.trigger?(Balloon_Info[index][0])
  517.   end
  518.  
  519. end
Advertisement
Add Comment
Please, Sign In to add comment