#===============================================================================# Button Mashing# Author: Mobius XVI# Version: 1.0# Date: 3 OCT 2015#===============================================================================## Introduction:## This script allows characters to 'button mash' prior to their attack in# order to increase the damage.## Instructions:## - Place this script below all the default scripts but above main.## - The customization section below has additional instructions.## Issues/Bugs/Possible Bugs:## - None right now## Credits/Thanks:# - Mobius XVI, author## License# # This script is available in its entirety for commercial and non-commercial# use. View the specific license terms below. ## The MIT License (MIT)## Copyright (c) 2015 darmes## Permission is hereby granted, free of charge, to any person obtaining a copy# of this software and associated documentation files (the "Software"), to deal# in the Software without restriction, including without limitation the rights# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell# copies of the Software, and to permit persons to whom the Software is# furnished to do so, subject to the following conditions:## The above copyright notice and this permission notice shall be included in all# copies or substantial portions of the Software.## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE# SOFTWARE.# # Further, if you do decide to use this script in a commercial product, # I'd ask that you let me know via a forum post or a PM. Thanks.##==============================================================================# ** CUSTOMIZATION START#==============================================================================module Mobius module ButtonMashing # Set this to the name of the image that you want to use as the prompt. # The image should be placed in your 'pictures' folder. The file # extension is not necessary. Prompt_Image = "" # The prompt will automatically center left/right on whichever actor # is currently taking their turn. Use this to set the prompt's up/down # position. As the default screen is 480 pixels tall, you can set this # value from 0 (the top of the screen) to 480 (the bottom of the screen). Prompt_y = 240 # In addition to the prompt image, you can display an animation on it # as well. This is useful if you want to display some kind of visual # timer. You specify which animation to play by the animation ID. # This sets which game variable to use for the prompt animation ID, # so that you can change the animation during the game. Prompt_Animation_Variable = 0 # If the Prompt_Animation_Variable above is set to zero, then the script # will use the value you specify below for the animation ID. This is # mostly useful for testing/debugging as you can quickly change the value. # If this value is also set to zero, then no animation will be used. Default_Prompt_Animation = 0 # This sets which game variable to use for the 'timer' or how long # the player has to button mash. You can then use eventing calls to # change how long the player has. Keep in mind that the value of the # variable will be frames not seconds. So 40 frames = 1 second. Timer_Variable = 0 # If the Timer_Variable above is set to zero, then the script will use # the value you specify below for the timer. This is mostly useful for # testing/debugging as you can quickly change the value for testing. Default_Timer = 40 * 3 # This sets which game variable to use for the 'damage variance' or # how much extra damage each button press will do. You can then use # eventing calls to change this value. The damage formula is: # Normal_Damage + Number_of_Button_Presses * Damage_Variance Damage_Variance_Variable = 0 # If the Damage_Variance_Variable above is set to zero, then the script # will use the value you specify below for the timer. This is mostly useful for # testing/debugging as you can quickly change the value for testing. Default_Damage_Variance = 1 endend #==============================================================================# ** CUSTOMIZATION END #------------------------------------------------------------------------------# ** EDIT BELOW THIS LINE AT OWN RISK!!!#============================================================================== #==============================================================================# ** Scene_Battle#==============================================================================class Scene_Battle # Alias Old Methods # alias mobius_update_phase4 update_phase4 alias mobius_update_phase4_step2 update_phase4_step2 # New methods # #-------------------------------------------------------------------------- # * Update Phase 4 - Branch to 'button mashing' phase #-------------------------------------------------------------------------- def update_phase4 case @phase4_step when "button_mashing" # do stuff update_phase4_button_mashing else mobius_update_phase4 end end #-------------------------------------------------------------------------- # * Update Phase 4 Step 2 #-------------------------------------------------------------------------- def update_phase4_step2 # call original mobius_update_phase4_step2 # check for button mashing (normal attack) if @active_battler.is_a?(Game_Actor) and @active_battler.current_action.kind == 0 and @active_battler.current_action.basic == 0 and not @active_battler.restriction == 3 then start_phase4_button_mashing end end #-------------------------------------------------------------------------- # * Start Phase 4 Button Mashing #-------------------------------------------------------------------------- def start_phase4_button_mashing # Set phase variable @phase4_step = "button_mashing" # Set up Prompt sprite @spriteset.prompt_sprite.visible = true @spriteset.prompt_sprite.x = @active_battler.screen_x if Mobius::ButtonMashing:

rompt_Animation_Variable == 0 unless Mobius::ButtonMashing:

efault_Prompt_Animation == 0 @spriteset.prompt_sprite.animation($data_animations[Mobius::ButtonMashing:

efault_Prompt_Animation], true) end else @spriteset.prompt_sprite.animation($data_animations[$game_variables[Mobius::ButtonMashing:

rompt_Animation_Variable]], true) end # Initialize timer to either default value or variable if Mobius::ButtonMashing::Timer_Variable == 0 @prompt_timer = Mobius::ButtonMashing:

efault_Timer else @prompt_timer = $game_variables[Mobius::ButtonMashing::Timer_Variable] end # Initialize button count to zero @button_counter = 0 # Initialize damage variance to either default value or variable if Mobius::ButtonMashing:

amage_Variance_Variable == 0 @damage_variance = Mobius::ButtonMashing:

efault_Damage_Variance else @damage_variance = $game_variables[Mobius::ButtonMashing:

amage_Variance_Variable] end end #-------------------------------------------------------------------------- # * Update Phase 4 Button Mashing #-------------------------------------------------------------------------- def update_phase4_button_mashing # If input time is up if @prompt_timer == 0 # Set phase variable @phase4_step = 3 # Hide prompt @spriteset.prompt_sprite.visible = false # Get enemy enemy = @target_battlers[0] # If enemy was damaged if enemy.damage.is_a?(Numeric) # Deal bonus damage bonus_damage = @button_counter * @damage_variance enemy.hp -= bonus_damage enemy.damage += bonus_damage end else # Decrease timer @prompt_timer -= 1 # Check for input if Input.trigger?(Input::C) # Increase button count @button_counter += 1 end end endend#==============================================================================# ** Spriteset_Battle#==============================================================================class Spriteset_Battle # Alias Old Methods # alias mobius_initialize initialize alias mobius_update update alias mobius_dispose dispose # New Public Variables # attr_accessor

rompt_sprite # New Methods # #-------------------------------------------------------------------------- # * Object Initialize #-------------------------------------------------------------------------- def initialize # Create viewport for prompt sprite @viewport5 = Viewport.new(0, 0, 640, 480) @viewport5.z = 5000 # Initialize prompt sprite @prompt_sprite = RPG::Sprite.new(@viewport5) @prompt_sprite.bitmap = RPG::Cache.picture(Mobius::ButtonMashing:

rompt_Image) # Draw from center @prompt_sprite.ox = @prompt_sprite.bitmap.width / 2 @prompt_sprite.oy = @prompt_sprite.bitmap.height / 2 # Intially center @prompt_sprite.x = 320 @prompt_sprite.y = Mobius::ButtonMashing:

rompt_y # Hide sprite @prompt_sprite.visible = false # Call old method mobius_initialize end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update @prompt_sprite.update mobius_update @viewport5.update end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose @prompt_sprite.dispose mobius_dispose @viewport5.dispose endend