(RGSS1) button mashing for more damage.

SWAMPFOOT9000

Veteran
Veteran
Joined
Jun 1, 2014
Messages
52
Reaction score
8
First Language
English
Primarily Uses
N/A
I was wondering if anybody could write up a relatively simple script to go with the battle system for rpgmaker xp. This is how the battle would work step by step:

-The player selects attack, and picks an enemy, as usual.

-Before the attack starts, the player is then prompted to spam the C button as many times as they can, within a time limit.

-The amount of times that the player pressed the C button is added on to the damge dealt by the player.

In a perfect situation, the script would have these three features:

-The amount of damage added from each press, is kept as a variable that can be changed in game.

-The message telling the player to mash the C button, is just an image that pops up in the center of the screen, and goes away when the time is up.

-Sound effect whenever you press C.

Thank you for your consideration. :)
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
A few questions:

1. Is this only for normal attacks, i.e. it won't be used for skills or items?

2. Is this for all actors, classes, and weapons? Or does it only apply to some?

3. Is the time limit the same in all instances? Or does it vary?

4. To clarify the damage formula: if 'N' is the number of times the button was pressed, 'D' is normal damage, and 'V' is the variable amount of damage added, then the resulting damage formula should be: (N*V)+D = Final_Damage. Yes?
 

SWAMPFOOT9000

Veteran
Veteran
Joined
Jun 1, 2014
Messages
52
Reaction score
8
First Language
English
Primarily Uses
N/A
A few questions:

1. Is this only for normal attacks, i.e. it won't be used for skills or items?

2. Is this for all actors, classes, and weapons? Or does it only apply to some?

3. Is the time limit the same in all instances? Or does it vary?

4. To clarify the damage formula: if 'N' is the number of times the button was pressed, 'D' is normal damage, and 'V' is the variable amount of damage added, then the resulting damage formula should be: (N*V)+D = Final_Damage. Yes?
Thank you for the reply!

Here are my answers to your questions:

1. It would only be for normal attacks.

2. It will happen with all characters, weapons, and classes.

3. I guess the time limit should be set to an adjustable in game variable, if posable. But if not, then just the same time limit every time.

4. (N*V)+D = Final_Damage, yes.
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
Here you go! If you have questions, just ask.

Code:
#===============================================================================# 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::Prompt_Animation_Variable == 0			unless Mobius::ButtonMashing::Default_Prompt_Animation == 0				@spriteset.prompt_sprite.animation($data_animations[Mobius::ButtonMashing::Default_Prompt_Animation], true) 			end		else			@spriteset.prompt_sprite.animation($data_animations[$game_variables[Mobius::ButtonMashing::Prompt_Animation_Variable]], true)		end				# Initialize timer to either default value or variable		if Mobius::ButtonMashing::Timer_Variable == 0			@prompt_timer = Mobius::ButtonMashing::Default_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::Damage_Variance_Variable == 0			@damage_variance = Mobius::ButtonMashing::Default_Damage_Variance 		else			@damage_variance = $game_variables[Mobius::ButtonMashing::Damage_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 :prompt_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::Prompt_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::Prompt_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 
 
Last edited by a moderator:

SWAMPFOOT9000

Veteran
Veteran
Joined
Jun 1, 2014
Messages
52
Reaction score
8
First Language
English
Primarily Uses
N/A
Here you go! If you have questions, just ask.

#===============================================================================# 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::prompt_Animation_Variable == 0 unless Mobius::ButtonMashing::Default_Prompt_Animation == 0 @spriteset.prompt_sprite.animation($data_animations[Mobius::ButtonMashing::Default_Prompt_Animation], true) end else @spriteset.prompt_sprite.animation($data_animations[$game_variables[Mobius::ButtonMashing::prompt_Animation_Variable]], true) end # Initialize timer to either default value or variable if Mobius::ButtonMashing::Timer_Variable == 0 @prompt_timer = Mobius::ButtonMashing::Default_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::Damage_Variance_Variable == 0 @damage_variance = Mobius::ButtonMashing::Default_Damage_Variance else @damage_variance = $game_variables[Mobius::ButtonMashing::Damage_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 :prompt_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::prompt_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::prompt_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 
wow. Much thank mate.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,847
Messages
1,016,972
Members
137,561
Latest member
JaCrispy85
Top