Smash Button!! (Defeat the Bull or Whatever)

Smashing Button System

Version: 1.0

By: MephistoX


Introduction

This Script let you to call a Scene with a Bar with a X number of filled, you need to smash a button to fill the bar, if you fill the bar, a Local switch will be active, else, you return to the Map.

This System is similar to the MK1 Bonus Games, or other Similars like Defeat the Bull,
MK Shaoling Monks, o Resident Evil Open Doors Engine.

For Now, this script is a Kind of template to do something, it doesn't have a really use, but, if you have Imagination, you will make great things :).

Features

  • Very Customizable...very...very
  • Easy to Call
  • I don't Know what more...

Screenshots

It's Ridiculus, like the Harry Potter Spell... 😢

Content Hidden Spoiler
Image



Demo

Yes, but it's a donkeyness... (If this word Exists...) so, just for fun.

4Shared Link


Script

It's Very Short, so:

Content Hidden Spoiler
  1. #==============================================================================
  2. # ** Smashing Button System
  3. #------------------------------------------------------------------------------
  4. # MephistoX
  5. # Version 1.0
  6. # 01/03/09
  7. # SDK : Version 2.4+
  8. #------------------------------------------------------------------------------
  9. # * Version History :
  10. #
  11. #    Version 1 ---------------------------------------------------- (01/03/09)
  12. #       - Log : First Version Released
  13. #------------------------------------------------------------------------------
  14. # * Requirements :
  15. #
  16. #    Method & Class Library (2.3 +)
  17. #------------------------------------------------------------------------------
  18. # * Description :
  19. #
  20. #    This Script let you to call a Scene with a Bar with a X number of filled,
  21. #    you need to smash a button to fill the bar, if you fill the bar, a Local
  22. #    switch will be active, else, you return to the Map.
  23. #   
  24. #    This System is similar to the MK1 Bonus Games, or other Similars like
  25. #    Defeat the Bull, MK Shaoling Monks, o Resident Evil Open Doors Engine.
  26. #------------------------------------------------------------------------------
  27. # * Instructions :
  28. #
  29. #    Place The Script Below the SDK and Above Main.
  30. #    Refer to Syntax to call the Smashing Scene
  31. #------------------------------------------------------------------------------
  32. # * Syntax :
  33. #
  34. #    Calling Scene :
  35. #      - Script : Scene_SmashButton.new(map_id, event_id, switch_key, options = {})
  36. #
  37. #    Parameters(Must be Defined)
  38. #   
  39. #    - map_id = Event Map ID, this is to active the Local Switch
  40. #    - event_id = Event ID, see above
  41. #    - switch_key = Local Switch Key('A', 'B', 'C', 'D')
  42. #
  43. #
  44. #                      |Options(Optional Use)|                              |Defaults/Examples|
  45. #
  46. #      - 'Gradient' => Gradient Graphic for the Window       = 'MP_001-Oranges01'
  47. #      - 'Button' => Button to smash to fill the Bar          = Input::C
  48. #      - 'Resistance' => Resistance of the Bar                   = 1
  49. #      - 'Power' => Smash Button Power                               = 1
  50. #      - 'Filled' => Bar Initial Filled                              = rand_between(20, 50)
  51. #      - 'Max' => Bar Max Filled                                        = 100
  52. #
  53. #==============================================================================
  54.  
  55. #------------------------------------------------------------------------------
  56. # * SDK Log Script
  57. #------------------------------------------------------------------------------
  58. SDK.log('Smashing Button System', 'MephistoX', 1.0, '01/03/09')
  59. SDK.check_requirements(2.4, [], {'Method & Class Library' => 2.2})
  60.  
  61. #------------------------------------------------------------------------------
  62. # * Begin SDK Enable Test
  63. #------------------------------------------------------------------------------
  64. if SDK.enabled?('Smashing Button System')
  65.  
  66. #==============================================================================
  67. # ** Scene_SmashButton
  68. #------------------------------------------------------------------------------
  69. #   This class performs Smashing Button Screen Processing.
  70. #==============================================================================
  71.  
  72. class Scene_SmashButton < SDK::Scene_Base
  73.   #--------------------------------------------------------------------------
  74.   # * Object Initialization
  75.   #--------------------------------------------------------------------------
  76.   def initialize(map, event, key, options = {})
  77.      # Sets Default Parameters (If Undefined)
  78.      gradient = options.member?('Gradient') ? options['Gradient'] : 'MP_001-Oranges01'
  79.      button = options.member?('Button') ? options['Button']   : Input::C
  80.      resistance = options.member?('Resistance') ? options['Resistance'] : 1
  81.      power = options.member?('Power') ? options['Power'] : 1
  82.      filled = options.member?('Filled') ? options['Filled'] : rand_between(20, 50)
  83.      max = options.member?('Max') ? options['Max'] : 300
  84.      # Saves Parameters
  85.      @map            = map                     # Event Map ID
  86.      @event         = event                  # Event ID
  87.      @key            = key                     # Local Switch Key
  88.      @gradient    = gradient             # Window's Bar Gradient
  89.      @button       = button                # Button to Trigger
  90.      @resistance = resistance          # Bar Resistance
  91.      @power         = power                  # Smash Power
  92.      @filled       = filled                # Initial Filled
  93.      @max            = max                     # Maximum Fill
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # * Main Sprite_Set
  97.   #--------------------------------------------------------------------------
  98.   def main_spriteset
  99.      # Sets Up Spriteset
  100.      @spriteset = Spriteset_Map.new
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # * Main Processing : Window Initialization
  104.   #--------------------------------------------------------------------------
  105.   def main_window
  106.      super
  107.      @bar_window = Window_Bar.new(@gradient, @filled, @max)
  108.      @bar_window.active = true
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # * Frame Update
  112.   #--------------------------------------------------------------------------
  113.   def update
  114.      super
  115.      # Every Frame substrac Resistance to Bar Filling if Self > 0
  116.      @bar_window.filling -= @resistance if @bar_window.filling > 0
  117.      # Refresh Window
  118.      @bar_window.refresh
  119.      # If B button was pressed
  120.      if Input.trigger?(Input::B)
  121.         # Play cancel SE
  122.         $game_system.se_play($data_system.cancel_se)
  123.         # Switch to menu screen
  124.         $scene = Scene_Map.new
  125.         return
  126.      end
  127.      # If Defined Button was pressed
  128.      if Input.trigger?(@button)
  129.         # Play decision SE
  130.         $game_system.se_play($data_system.decision_se)
  131.         # Add XNumber to the Bar Filling if self is > Maximum Filling
  132.         @bar_window.filling += (@power *10) if @bar_window.filling < @max
  133.         return
  134.      end
  135.      # If Bar Filling < 1
  136.      if @bar_window.filling < 1
  137.         # Play wrong SE
  138.         Audio.se_play('Audio/SE/058-Wrong02', 80)
  139.         # Return to Map
  140.         $scene = Scene_Map.new
  141.         return
  142.      end
  143.      # If Bar Filling is Full
  144.      if @bar_window.filling >= @max
  145.         # Active Self Switch
  146.         key = [@map, @event, @key]
  147.         $game_self_switches[key] = true
  148.         $game_map.need_refresh = true
  149.         # Return to Map
  150.         $scene = Scene_Map.new
  151.         return
  152.      end
  153.   end
  154. end
  155.  
  156.  
  157. #==============================================================================
  158. # ** Window_Bar
  159. #------------------------------------------------------------------------------
  160. #   This window displays a Gradient Bar
  161. #==============================================================================
  162.  
  163. class Scene_SmashButton::Window_Bar < Window_Base
  164.   #--------------------------------------------------------------------------
  165.   # * Public Instance Variables
  166.   #--------------------------------------------------------------------------
  167.   attr_accessor :filling             # Bar Initial Filling
  168.   #--------------------------------------------------------------------------
  169.   # * Object Initialization
  170.   #--------------------------------------------------------------------------
  171.   def initialize(gradient, filling, max)
  172.      super(0, 0, 160, 64)
  173.      self.contents = Bitmap.new(width - 32, height - 32)
  174.      self.back_opacity = 160
  175.      @gradient = gradient
  176.      @filling = filling
  177.      @max = max
  178.      refresh
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # * Refresh
  182.   #--------------------------------------------------------------------------
  183.   def refresh
  184.      self.contents.clear
  185.      # Draw Gradient Bara
  186.      self.contents.draw_trick_gradient_bar(0, 0, @filling, @max,
  187.      @gradient, self.width - 32, 8, 'MP_001-Back01','MP_001-Back02')
  188.   end
  189. end
  190.  
  191. #--------------------------------------------------------------------------
  192. # * End SDK Enable Test
  193. #--------------------------------------------------------------------------
  194. end
Expand to see the code.



Instructions

See the Script Header, it's very simple.

FAQ

None yet...

Compatibility

- Requires SDK 2.4+
- Requires MACL 2.3+

It's very simple, no more.


Credits and Thanks

Well, I think, Credits to Me xD.


Author's Notes

Any comment?, Question, Bug?.... Leave a Message.
Also, I have another script, but I'm lazy to post here, but If anyone want to post for me..
I need you ___________ (Fill the Blank with your name).

See ya!
Pretty neat code. Only one real suggestion on this:

Window_Bar might be a common window name. I suggest changing this to be a window within your scene.

  1. class Scene_SmashButton::Window_Bar
Expand to see the code.


That's all I have for you on this one. Good work buddy. :thumb:
Hey, Thanks for the Tip, I didn't care about that name, i forgot there are a lot of scripts that uses that name XD.

I am honored that SephirothSpawn leave me a tip :toot:
How do you change the power to make it much harder to get the bar upto full? thanks.
Don’t know if the “Fuck you” is appropriate at the end for our little youngsters here but, oh well. Nice script! I like it very much!

ozer: Fine line @bar_window.filling += (@power *10) if @bar_window.filling < @max

Once you find that, change the number after the astric(@power *50) to whatever you want. *1 being the hardest.
Don’t know if the “Fuck you” is appropriate at the end for our little youngsters here but, oh well. Nice script! I like it very much!

ozer: Fine line @bar_window.filling += (@power *10) if @bar_window.filling < @max

Once you find that, change the number after the astric(@power *50) to whatever you want. *1 being the hardest.
Can you make a non SDK version of it because the SDK messes with my Blizz-Abs :shadow:
Nldarklord wrote:
Can you make a non SDK version of it because the SDK messes with my Blizz-Abs :shadow:

Considering that both Scene_SmashButton and Window_Bar are new classes (as far as i know >_>), to make it non-sdk, just remove the sdk check and sdk log... then change the SDK::Scene_Base to just Scene_Base.
That wont work. Rmxp doesnt have a Scene_Base like rmvx does. So that would just crash the script. SDK has a scene base. THe scenes under the module SDK.
gameguy27 wrote:
That wont work. Rmxp doesnt have a Scene_Base like rmvx does. So that would just crash the script. SDK has a scene base. THe scenes under the module SDK.

Ahh. Didn't know RMXP didn't have a scene_base. In that case... :o:
Its ok me and a friend are thinking of extracting SDK's Scene_Base so people can still use a few SDK scripts.
now here's another script that needs to be SDK free...
and able to configure pictures displayed during the smashing!

still re-config'n some other scripts, or I would dedicate some time on this one...


here's something close

viewtopic.php?f=156&t=11625

~g/A\/\/\|=|F/A\C|=

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=62544