Reactive Abilities (VXAce)

Anduie

Warper
Member
Joined
Jun 6, 2015
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Why

I have been trying to find something that add new levels of complexity to combat. I don't know why, but I thought it would serve some purpose to add increased reactive abilities, like expanding on evade and counter attack. I was able to find Fomar0153's Counter Attack Skills (http://cobbtocs.co.uk/wp/?p=345) and tried it out for a while, but I was never fully satisfied with the outcome. So, going off of what Fomar had developed, I reworked a lot of it into something more to my liking.

What it does

It adds several new reactive abilities. These are:

  • Dodge. It is a physical evade. It gets priority over everything else.
  • Parry. Another physical evade, second to dodge.
  • Riposte. A counter attack that requires a parry.
  • Block. A chance to take reduced damage on a physical attack.
  • Endure. A chance to take damage and then recover 5% of your health. If the damage kills you, you revive.
  • Mumble. A counter attack against magical abilities.
  • Backlash. Same as mumble.
Please note that mumble and backlash happen after damage occurs.

What needs to happen

Tons. I state it in the notes, but....

  • I would like to make it so there is an on/off switch. No blocking without a shield. Soldiers can't backlash. That sort of thing.
  • De-couple certain abilities. Block blocks a flat amount, endure heals a flat percentage. I think it might be of value to make block block different amounts so that the cleric with a shield is not as good as the warrior.
  • There is no native way for the parameters to have values. I am using a script by Yanfly now, but I need to define it within the script.
  • I don't have a handle on the sounds and I can't seem to call sounds that are not the 22 for the system. Then again, I have not really tried.
  • I might want to add a bubble: an amount of temporary HP that regenerates after each battle.
  • Eliminate bloat.
  • Riposte does not work correctly. It is will not be considered whenever you parry. How can I tell it to counter attack when there is no damage? Change parry to just say there is no damage but still hit? Is there another way?
The code dump

Here you go:

=beginReactive Skillsby AnduieCribbed off of Fomar0153's Counter Attack Skills http://cobbtocs.co.uk/wp/?p=345Version 1.0 8/29/2015----------------------Notes----------------------Allows you to reactive abilities----------------------Instructions----------------------Notetag the actor, class, enemy or state:<riposte x><mumble x><endure x><backlash x>where x is the skill id----------------------Known bugs----------------------Tried to script a fight and riposte would not get called. Solutions?----------------------To Do----------------------On and off switches so that only certain classes can parry or certain itemsallow you to blockBlock value variableNative definition of what the variables are and what increases them.Sounds.Animations?Maybe a bubble feature where a character starts with X amount of temporary HPand it goes until it is popped and regenerates at next combat.=end#Establishes terms the game will use.module Vocab Parry = "%s parries!" Dodge = "%s dodges the attack, and is awesome!" Riposte = "%s ripostes!" Block = "%s blocks!" Endure = "%s endures the attack!" Mumble = "In pain %s mumbles incoherently." Backlash = "In an act of defiance, %s's spirit lashes out." end#All the sounds. I do not know how to call any other sound other than the#system sounds. Can anyone give me a clue?module Sound def self.play_parry play_system_sound(18) end def self.play_dodge play_system_sound(18) end def self.play_riposte play_system_sound(22) end def self.play_block play_system_sound(1) end def self.play_endure play_system_sound(1) end def self.play_mumble play_system_sound(22) end def self.play_backlash play_system_sound(22) endend#For the notetagsclass RPG::BaseItem def riposte if @riposte.nil? if @note =~ /<riposte (.*)>/i @riposte = $1.to_i else @riposte = 1 end end @riposte end def endure if @endure.nil? if @note =~ /<endure (.*)>/i @endure = $1.to_i else @endure = 127 end end @endure end def mumble if @mumble.nil? if @note =~ /<mumble (.*)>/i @mumble = $1.to_i else @mumble = 1 end end @mumble end def backlash if @backlash.nil? if @note =~ /<backlash (.*)>/i @backlash = $1.to_i else @backlash = 1 end end @backlash end endclass Game_ActionResult#Skill flags attr_accessor :parried # parried flag attr_accessor :riposted # riposted flag attr_accessor :dodged # dodged flag attr_accessor :endured # endured flag attr_accessor :mumbled # mumbled flag attr_accessor :blocked # endured flag attr_accessor :backlashed # endured flag#Clears all the flags for abilities used def clear_hit_flags @used = false @missed = false @blocked = false @evaded = false @parried = false @dodged = false @endured = false @riposted = false @mumbled = false @critical = false @success = false @backlashed = false end#Makes it clear that dodged, parried, and riposted (not necessary?)#abilities don't hit. def hit? @used && !@missed && !@evaded && !@dodged && !@parried && !@riposted endend class Game_BattlerBase def rst; xparam(10); end def dge; xparam(11); end def pry; xparam(12); end def blk; xparam(13); end def ndr; xparam(14); end def mbl; xparam(15); end def bkl; xparam(16); end end class Game_Battler < Game_BattlerBase#Establishes riposte. It is a counter attack that must follow up parry.#Therefore, it only can respond to physical activities. Is the physical#check necessary? def item_rst(user, item) return 0 unless item.physical? return 0 unless @result.parried return rst # Return riposte if parried end#Establishes parry, which evades physical attacks. Can be followed up by riposte. def item_pry(user, item) return 0 unless item.physical? # Return parry if physical attack return pry end#Establishes dodge, which evades physical attacks. def item_dge(user, item) return 0 unless item.physical? # Return dodge if physical attack return dge end #Establishes block, which reduces physical damage. def item_blk(user, item) return 0 unless item.physical? return blk end#Establishes endure. Character is unkillable (will revive at 1 HP if reduced to#0 HP) and regenerate 5% of health. def item_ndr(user, item) return ndr # Return endure end #Establishes mumble, which is a suite of status effects in response to getting#hit by a magical ability. def item_mbl(user, item) return mbl if item.magical? # Return mbl if magical attack return 0 end#Establishes backlash, which does a mana burn and adds a state that ticks down#MP and HP. Is it possible to make the initial mana burn also do HP damage and#Make the state, upon expiration, do additional damage? def item_bkl(user, item) return bkl if item.magical? # Return mbl if magical attack return 0 end def item_apply(user, item) @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.dodged = (!@result.missed && rand < item_dge(user, item)) @result.parried = (!@result.missed && rand < item_pry(user, item)) @result.riposted = (@result.parried && rand < item_rst(user, item)) if @result.hit? unless item.damage.none? #Block and endure only come up if hit. @result.blocked = (item.physical? && rand < (item_blk(user, item))) @result.critical = (rand < item_cri(user, item)) @result.endured = (rand < item_ndr(user, item)) make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end end def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) if @result.blocked value *= 0.5 #To be added: a variable for the block amount. end @result.make_damage(value.to_i, item) #Endure, mumble, and backlash only happen after damage @result.endured = rand < item_ndr(user, item) @result.mumbled = rand < item_mbl(user, item) @result.backlashed = rand < item_bkl(user, item) end def execute_damage(user) on_damage(@result.hp_damage) if @result.hp_damage > 0 self.hp -= @result.hp_damage self.mp -= @result.mp_damage user.hp += @result.hp_drain user.mp += @result.mp_drain if self.hp <= 0 && @result.endured #The endure revive. Is this duplicated? remove_state(1) clear_states end end endclass Game_Actor < Game_Battler#From Fomar's stuff. I don't know what exactly it does. def riposte for state in states return state.riposte if state.riposte > 1 end return actor.riposte end def endure for state in states return state.endure if state.endure > 127 end return actor.endure end def mumble for state in states return state.mumble if state.mumble > 128 end return actor.mumble end def backlash for state in states return state.backlash if state.backlash > 129 end return actor.backlash end endclass Game_Enemy < Game_Battler def riposte for state in states return state.riposte if state.riposte > 1 end return enemy.riposte end def endure for state in states return state.endure if state.endure > 127 end return enemy.endure end def mumble for state in states return state.mumble if state.mumble > 128 end return enemy.mumble end def backlash for state in states return state.backlash if state.backlash > 129 end return enemy.backlash end end#Displays messages.class Window_BattleLog < Window_Selectable def display_damage(target, item) if target.result.missed display_miss(target, item) elsif target.result.dodged display_dodge(target, item) #Can't parry if dodged, dodge gets priority. elsif target.result.parried display_parry(target, item) else if target.result.blocked display_block(target, item) end display_hp_damage(target, item) display_mp_damage(target, item) display_tp_damage(target, item) end end #Establishes messages def display_dodge(target, item) if !item || item.physical? fmt = Vocab::Dodge Sound.play_dodge else 0 end add_text(sprintf(fmt, target.name)) wait end def display_parry(target, item) if !item || item.physical? fmt = Vocab::parry Sound.play_parry else 0 end add_text(sprintf(fmt, target.name)) wait end def display_riposte(target, item) if !item || item.physical? fmt = Vocab::Riposte Sound.play_riposte else 0 end add_text(sprintf(fmt, target.name)) wait end def display_block(target, item) if !item || item.physical? fmt = Vocab::Block Sound.play_block add_text(sprintf(fmt, target.name)) wait else 0 end end def display_endure(target, item) fmt = Vocab::Endure Sound.play_endure add_text(sprintf(fmt, target.name)) wait end def display_mumble(target, item) if !item || item.magical? fmt = Vocab::Mumble Sound.play_mumble else 0 end add_text(sprintf(fmt, target.name)) wait end def display_backlash(target, item) if !item || item.magical? fmt = Vocab::Backlash Sound.play_backlash else 0 end add_text(sprintf(fmt, target.name)) wait endendclass Scene_Battle #Calls up skills that are reactive. def invoke_item(target, item) if target.result.riposted @log_window.display_parry(target, item) invoke_riposte(target, item) else apply_item_effects(apply_substitute(target, item), item) if target.result.mumbled invoke_mumble(target, item) end if target.result.backlashed invoke_backlash(target, item) end if target.result.endured invoke_endure(target, item) end end @subject.last_target_index = target.index end #Invokes said skills. Mostly taken straight from Fomar. My gut says there is #a lot of bloat here, but I can't tell you how much or what. def invoke_riposte(target, item) @log_window.display_riposte(target, item) attack_skill = $data_skills[target.riposte] if attack_skill.for_opponent? if attack_skill.for_all? show_animation(target.opponents_unit.alive_members, attack_skill.animation_id) for t in target.opponents_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation([@subject], attack_skill.animation_id) @subject.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(@subject, attack_skill) end else if attack_skill.for_all? if attack_skill.for_dead_friend? show_animation(target.friends_unit.dead_members, attack_skill.animation_id) for t in target.friends_unit.dead_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation(target.friends_unit.alive_members, attack_skill.animation_id) for t in target.friends_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end end else show_animation([target], attack_skill.animation_id) target.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(target, attack_skill) end end end def invoke_backlash(target, item) @log_window.display_backlash(target, item) attack_skill = $data_skills[target.backlash] if attack_skill.for_opponent? if attack_skill.for_all? show_animation(target.opponents_unit.alive_members, attack_skill.animation_id) for t in target.opponents_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation([@subject], attack_skill.animation_id) @subject.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(@subject, attack_skill) end else if attack_skill.for_all? if attack_skill.for_dead_friend? show_animation(target.friends_unit.dead_members, attack_skill.animation_id) for t in target.friends_unit.dead_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation(target.friends_unit.alive_members, attack_skill.animation_id) for t in target.friends_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end end else show_animation([target], attack_skill.animation_id) target.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(target, attack_skill) end end end def invoke_endure(target, item) @log_window.display_endure(target, item) attack_skill = $data_skills[target.endure] if attack_skill.for_opponent? if attack_skill.for_all? show_animation(target.opponents_unit.alive_members, attack_skill.animation_id) for t in target.opponents_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation([@subject], attack_skill.animation_id) @subject.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(@subject, attack_skill) end else if attack_skill.for_all? if attack_skill.for_dead_friend? show_animation(target.friends_unit.dead_members, attack_skill.animation_id) for t in target.friends_unit.dead_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation(target.friends_unit.alive_members, attack_skill.animation_id) for t in target.friends_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end end else show_animation([target], attack_skill.animation_id) target.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(target, attack_skill) end end end def invoke_mumble(target, item) @log_window.display_mumble(target, item) attack_skill = $data_skills[target.mumble] if attack_skill.for_opponent? if attack_skill.for_all? show_animation(target.opponents_unit.alive_members, attack_skill.animation_id) for t in target.opponents_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation([@subject], attack_skill.animation_id) @subject.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(@subject, attack_skill) end else if attack_skill.for_all? if attack_skill.for_dead_friend? show_animation(target.friends_unit.dead_members, attack_skill.animation_id) for t in target.friends_unit.dead_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end else show_animation(target.friends_unit.alive_members, attack_skill.animation_id) for t in target.friends_unit.alive_members t.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(t, attack_skill) end end else show_animation([target], attack_skill.animation_id) target.item_apply(target, attack_skill) refresh_status @log_window.display_action_results(target, attack_skill) end end end end
 Thoughts? Opinions? Constructive criticism? Destructive criticism? Dirty jokes?
 
Last edited by a moderator:

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

Latest Threads

Latest Profile Posts

Who knew a adding menu commands would be so hard for something that should be a basic feature.
When you discover great tileset resources that you completely forgot that you had. :kaomad3::kaopride:
Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.
I've just checked the VisuStella Plugins for MZ and there are already 11 plugins. The Yanfly team(perhaps a big one?) really works so effectively and efficiently that some MZ users can likely use tons of Yanfly plugins right after MZ's released (still 13 days from now). I wonder if any other plugin developer(or team) will try to compete with Yanfly this time, no matter how slim the chance to win is :)
Hello! :kaopride:I am new to RPG Maker, though I have been lurking the forums for a while. :kaoswt: Hope to make some friends and learn some stuff here! :kaothx:

Forum statistics

Threads
100,597
Messages
977,610
Members
132,202
Latest member
gerreh
Top