DoubleX RMVXA Counterattack Edit

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
DoubleX RMVXA Counterattack Edit  v1.05b​
by DoubleX​

Compatibility Fix

DoubleX RMVXA Counterattack Compatibility Fix

Introduction

In the default setting, the counterattack skill's id is always 1(Attack). This is hardcoded(can only be modified by scripts).

With this script, it can be altered but its scope is set to a single target and its repeat is set to 1(which are intended).

(v1.01a+)Allows users to set whether magic evasion invokes counterattack

(v1.02a+)Allows users to set whether counterattack messages will be shown
(v1.03a+)Allows users to set whether counterattack negates hits

(v1.04a+)Allows users to set actor's counterattack skill needs to be learnt

(v1.05a+)Allows users to keep counterattack skill's animation, scope or times

(It's just the user edition region of this script. The attachment at the bottom is the complete script)

#------------------------------------------------------------------------------|#  * (v1.01a+)Notetag <mev invoke cnt> for actors, classes, equips, enemies and|#    states:                                                                   |#    To set a battler having chance based on his/her/its CNT to invoke         |#    counterattack upon successful magic evasion, put the above notetag into   |#    the related actor's, class's, equip's, enemy's or state's notebox in the  |#    database.                                                                 |#------------------------------------------------------------------------------|#  * Notetag <counterattack skill: x> for actors(1), classes(2), equips(3),    |#    enemies(1) and states(4):(the larger the number, the higher the priority) |#    To alter a battler's counterattack skill's id to x, put the above notetag |#    into the related actor's, class's, equip's, enemy's or state's notebox in |#    the database.                                                             |#------------------------------------------------------------------------------|#==============================================================================|#  ** You only need to edit this part as it's about what this script does      |#------------------------------------------------------------------------------|module DoubleX_RMVXA  module Counterattack_Edit#------------------------------------------------------------------------------|#  * (v1.05a+)Keep_Ani, default = false                                        |#    If Keep_Ani is true, the counterattack skill's animations will be played  |#    when the counterattack's invoked                                          |#------------------------------------------------------------------------------|    Keep_Ani = false#------------------------------------------------------------------------------|#  * (v1.05a+)Keep_Scope, default = false                                      |#    If Keep_Scope is true, the counterattack skill's scope will stay intact,  |#    otherwise it'll only target the one attacked that battler                 |#------------------------------------------------------------------------------|    Keep_Scope = false#------------------------------------------------------------------------------|#  * (v1.05a+)Keep_Times, default = false                                      |#    If Keep_Scope is true, the counterattack skill's repeats will stay intact,|#    otherwise it'll be 1                                                      |#------------------------------------------------------------------------------|    Keep_Times = false#------------------------------------------------------------------------------|#  * (v1.04a+)Actor_Learn_Counterattack_Skill, default = false                 |#    If Actor_Learn_Counterattack_Skill is true and an actor hasn't learnt the |#    counterattack skill, Default_Counterattack will be that actor's skill     |#------------------------------------------------------------------------------|    Actor_Learn_Counterattack_Skill = false#------------------------------------------------------------------------------|#  * (v1.03a+)CNT_Negate_Hit, default = true                                   |#    Normal physical hit and damage determinations will take place before that |#    of CNT if CNT_Negate_Hit is false                                         |#------------------------------------------------------------------------------|    CNT_Negate_Hit = true#------------------------------------------------------------------------------|#  * (v1.02a+)COUNTERATTACK_MESSAGE, default = true                            |#    Counterattack messages won't be shown if COUNTERATTACK_MESSAGE is false   |#------------------------------------------------------------------------------|    COUNTERATTACK_MESSAGE = true#------------------------------------------------------------------------------|#  * (v1.01a+)MEV_Invoke_CNT, default = false                                  |#    Successful magic evasion invokes counterattack with chance based on CNT if|#    MEV_Invoke_CNT is true, even when <mev invoke cnt> notetags are absent    |#------------------------------------------------------------------------------|    MEV_Invoke_CNT = false#------------------------------------------------------------------------------|#  * Default_Counterattack, default = 1                                        |#    The counterattack skill of a battler will be the one's id equal to        |#    Default_Counterattack if he/she/it doesn't have any notetag               |#------------------------------------------------------------------------------|  Default_Counterattack = 1  end # Counterattack_Editend # DoubleX_RMVXA#==============================================================================|
Features

Use of notetags(requires knowledge of notetag usage) to alter battlers' counterattack skills' id via notetags in the related actors', classes', equips', enemies' or states ' notebox

A way to set all counterattack skill id without using notetags(but they still take precedence over this)

v1.01a+:

Use of notetags(requires knowledge of notetag usage) to set battlers having chance based on their CNT to invoke counterattack upon successful magic evasion in the related actors', classes', equips', enemies' or states ' notebox

A way to set all battlers having such chance without using notetags(but they still take precedence over this)

How to use

Open the script editor and put this script into an open slot between Materials and Main. Save to take effect.

FAQ

None

Credit and Thanks

DoubleX(Giving me credit is completely optional)

No terms of use other than not claiming this script as created by anyone except DoubleX or his alias

Compatibility

Scripts rewriting Vocab CounterAttack or aliasing or rewriting method:

- item_apply under class Game_Battler

- display_counter under class Window_BattleLog

- apply_item_effects and invoke_counter_attack under class Scene_Battle

may have compatibility issues with this script

Place this script above those aliasing this method if possible

Changelog

v1.05b(GMT 0800 4-7-2015):

- Fixed class notetags not working bug

- In sync with the latest DoubleX RMVXA Substitute Edit version

- Improved this script's readibility

v1.05a(GMT 0200 5-7-2014):

- Allows users to keep counterattack skill's animations, scopes and times

- Compatible with DoubleX RMVXA Substitute Edit

v1.04a(GMT 2300 1-4-2014):

- Allows users to set actor's counterattack skill needs to be learnt

v1.03a(GMT 0900 18-3-2014):

- Allows users to set whether counterattack negates hits

v1.02a(GMT 0000 14-2-2014):

- Allows users to set whether counterattack messages will be shown

v1.01b (GMT 0900 16-1-2014):

- Fixed a & b bug in damage formula of counterattack skills

v1.01a (GMT 1000 15-1-2014):

- Allows users to set whether magic evasion invokes counterattack

v1.00a (GMT 0400 5-1-2014):

- 1st version of this script finished

(DoubleX)Counterattack Edit v1.05b.rar
 

Attachments

Last edited by a moderator:

Neo Soul Gamer

Veteran
Veteran
Joined
Aug 10, 2012
Messages
653
Reaction score
391
First Language
English
Primarily Uses
N/A
The default Counter Attack function in VXA always causes the attacker to miss before a counter attack is triggered. Does this script let the attack follow normal attack processing first? By normal attack processing, I mean factoring in the normal hit chance, elements, damage formulas, etc.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Updates

v1.03a(GMT 0900 18-3-2014):

- Allows users to set whether counterattack negates hits
 

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
DoubleX - first off, great script.

Secondly, I'm trying to get this to work (counterattack negates hits FALSE), but no matter what - the original hit is negated. I've tried reordering the scripts and right now I haev them in this order:

- counter

- yanfly battle

- counter fix

Any help is appreciated! Thanks!
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Unfortunately, I can't even reproduce the error. I followed your script ordering and uses no other custom scripts and counterattack negates hits FALSE works for me.

Maybe you'll want to send me your project so I can see if there's anything strange :)
 

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
Sure, sent you the link to a new project with only these 4 scripts:

- counter

- yanfly core

- yanfly battle

- counter fix

Maybe we're misunderstanding each other? I assumed setting the below item to FALSE would result in a normal hit, followed by the counterattack:

CNT_Negate_Hit = falseBut, as you can see in the demo, the actor takes no damage (like a miss) and performs the counterattack.

Thanks!
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
I've checked your project and I find that my counterattack script there isn't complete. It seems to me that you thought the spoiler just below the introduction of this topic is the entire script, while in fact the whole script has to be downloaded from the attachment at the bottom of this topic. It's 100% my fault that I didn't make it crystal clear, and from now on I'll consider stating explicitly that that spoiler isn't the entire script :)

Maybe something like:

(It's just the user edition region of this script. The attachment at the bottom is the complete script)

will make things crystal clear :D
 
Last edited by a moderator:

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
Omg - what a total tool I am. Sorry you had to suffer through my stupidity!
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Updates

v1.05b(GMT 0800 4-7-2015):

- Fixed class notetags not working bug

- In sync with the latest DoubleX RMVXA Substitute Edit version

- Improved this script's readibility
 

DomTSVG

Certified Game Boi
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
RMVXA
I'm having trouble with a script error stating that a value or method cnte on the line I've starred down below, and I have not edited this script. 

  #----------------------------------------------------------------------------|

  #  (v1.05b+)New method: apply_counterattack_edit                             |

  #----------------------------------------------------------------------------|

  def apply_counterattack_edit(target, attack_skill, scope, substitute = false)

    ******show_animation(scope, attack_skill.animation_id) if cnte::Keep_Ani********

    repeats = cnte::Keep_Times ? attack_skill.repeats : 1

    scope.each { |s|

      repeats.times {

        if substitute

          if DoubleX_RMVXA::Substitute_Edit::Hit_Substitute

            s.item_apply(target, attack_skill)

            @log_window.display_action_results(s, attack_skill)

          else

            sub = apply_substitute(s, attack_skill)

            sub.item_apply(target, attack_skill)

            @log_window.display_action_results(s, attack_skill) if sub == s

          end

        else

          s.item_apply(target, attack_skill)

          @log_window.display_action_results(s, attack_skill)

        end

      }

    }

  end # apply_counterattack_edit

 

The attatched file is the error message I get when the counter is attempted via state. I have only this script and a limit edit script, and removing the limit edit did nothing

 

2015-07-20 22_18_29-AFB Epic as ****.png
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
I'm having trouble with a script error stating that a value or method cnte on the line I've starred down below, and I have not edited this script. 

  #----------------------------------------------------------------------------|

  #  (v1.05b+)New method: apply_counterattack_edit                             |

  #----------------------------------------------------------------------------|

  def apply_counterattack_edit(target, attack_skill, scope, substitute = false)

    ******show_animation(scope, attack_skill.animation_id) if cnte::Keep_Ani********

    repeats = cnte::Keep_Times ? attack_skill.repeats : 1

    scope.each { |s|

      repeats.times {

        if substitute

          if DoubleX_RMVXA::Substitute_Edit::Hit_Substitute

            s.item_apply(target, attack_skill)

            @log_window.display_action_results(s, attack_skill)

          else

            sub = apply_substitute(s, attack_skill)

            sub.item_apply(target, attack_skill)

            @log_window.display_action_results(s, attack_skill) if sub == s

          end

        else

          s.item_apply(target, attack_skill)

          @log_window.display_action_results(s, attack_skill)

        end

      }

    }

  end # apply_counterattack_edit

 

The attatched file is the error message I get when the counter is attempted via state. I have only this script and a limit edit script, and removing the limit edit did nothing
Maybe I've accidentally uploaded a wrong version of this script. I've just doubled checked the newest version and the code isn't the same. I've reuploaded that new version so you may want to try to download it again and see if anything changes :)
 

DomTSVG

Certified Game Boi
Veteran
Joined
Apr 24, 2015
Messages
54
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Fixed, thanks a bunch!
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top