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

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
- #==============================================================================
- # ** Smashing Button System
- #------------------------------------------------------------------------------
- # MephistoX
- # Version 1.0
- # 01/03/09
- # SDK : Version 2.4+
- #------------------------------------------------------------------------------
- # * Version History :
- #
- # Version 1 ---------------------------------------------------- (01/03/09)
- # - Log : First Version Released
- #------------------------------------------------------------------------------
- # * Requirements :
- #
- # Method & Class Library (2.3 +)
- #------------------------------------------------------------------------------
- # * Description :
- #
- # 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.
- #------------------------------------------------------------------------------
- # * Instructions :
- #
- # Place The Script Below the SDK and Above Main.
- # Refer to Syntax to call the Smashing Scene
- #------------------------------------------------------------------------------
- # * Syntax :
- #
- # Calling Scene :
- # - Script : Scene_SmashButton.new(map_id, event_id, switch_key, options = {})
- #
- # Parameters(Must be Defined)
- #
- # - map_id = Event Map ID, this is to active the Local Switch
- # - event_id = Event ID, see above
- # - switch_key = Local Switch Key('A', 'B', 'C', 'D')
- #
- #
- # |Options(Optional Use)| |Defaults/Examples|
- #
- # - 'Gradient' => Gradient Graphic for the Window = 'MP_001-Oranges01'
- # - 'Button' => Button to smash to fill the Bar = Input::C
- # - 'Resistance' => Resistance of the Bar = 1
- # - 'Power' => Smash Button Power = 1
- # - 'Filled' => Bar Initial Filled = rand_between(20, 50)
- # - 'Max' => Bar Max Filled = 100
- #
- #==============================================================================
- #------------------------------------------------------------------------------
- # * SDK Log Script
- #------------------------------------------------------------------------------
- SDK.log('Smashing Button System', 'MephistoX', 1.0, '01/03/09')
- SDK.check_requirements(2.4, [], {'Method & Class Library' => 2.2})
- #------------------------------------------------------------------------------
- # * Begin SDK Enable Test
- #------------------------------------------------------------------------------
- if SDK.enabled?('Smashing Button System')
- #==============================================================================
- # ** Scene_SmashButton
- #------------------------------------------------------------------------------
- # This class performs Smashing Button Screen Processing.
- #==============================================================================
- class Scene_SmashButton < SDK::Scene_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(map, event, key, options = {})
- # Sets Default Parameters (If Undefined)
- gradient = options.member?('Gradient') ? options['Gradient'] : 'MP_001-Oranges01'
- button = options.member?('Button') ? options['Button'] : Input::C
- resistance = options.member?('Resistance') ? options['Resistance'] : 1
- power = options.member?('Power') ? options['Power'] : 1
- filled = options.member?('Filled') ? options['Filled'] : rand_between(20, 50)
- max = options.member?('Max') ? options['Max'] : 300
- # Saves Parameters
- @map = map # Event Map ID
- @event = event # Event ID
- @key = key # Local Switch Key
- @gradient = gradient # Window's Bar Gradient
- @button = button # Button to Trigger
- @resistance = resistance # Bar Resistance
- @power = power # Smash Power
- @filled = filled # Initial Filled
- @max = max # Maximum Fill
- end
- #--------------------------------------------------------------------------
- # * Main Sprite_Set
- #--------------------------------------------------------------------------
- def main_spriteset
- # Sets Up Spriteset
- @spriteset = Spriteset_Map.new
- end
- #--------------------------------------------------------------------------
- # * Main Processing : Window Initialization
- #--------------------------------------------------------------------------
- def main_window
- super
- @bar_window = Window_Bar.new(@gradient, @filled, @max)
- @bar_window.active = true
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- # Every Frame substrac Resistance to Bar Filling if Self > 0
- @bar_window.filling -= @resistance if @bar_window.filling > 0
- # Refresh Window
- @bar_window.refresh
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Map.new
- return
- end
- # If Defined Button was pressed
- if Input.trigger?(@button)
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Add XNumber to the Bar Filling if self is > Maximum Filling
- @bar_window.filling += (@power *10) if @bar_window.filling < @max
- return
- end
- # If Bar Filling < 1
- if @bar_window.filling < 1
- # Play wrong SE
- Audio.se_play('Audio/SE/058-Wrong02', 80)
- # Return to Map
- $scene = Scene_Map.new
- return
- end
- # If Bar Filling is Full
- if @bar_window.filling >= @max
- # Active Self Switch
- key = [@map, @event, @key]
- $game_self_switches[key] = true
- $game_map.need_refresh = true
- # Return to Map
- $scene = Scene_Map.new
- return
- end
- end
- end
- #==============================================================================
- # ** Window_Bar
- #------------------------------------------------------------------------------
- # This window displays a Gradient Bar
- #==============================================================================
- class Scene_SmashButton::Window_Bar < Window_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :filling # Bar Initial Filling
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(gradient, filling, max)
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.back_opacity = 160
- @gradient = gradient
- @filling = filling
- @max = max
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- # Draw Gradient Bara
- self.contents.draw_trick_gradient_bar(0, 0, @filling, @max,
- @gradient, self.width - 32, 8, 'MP_001-Back01','MP_001-Back02')
- end
- end
- #--------------------------------------------------------------------------
- # * End SDK Enable Test
- #--------------------------------------------------------------------------
- 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!