Jump to content
DoubleX

DoubleX RMVXA Counterattack Edit

Recommended Posts

Compatibility Fix

DoubleX RMVXA Counterattack Compatibility Fix

 

Script name

DoubleX RMVXA Counterattack Edit

 

Author

DoubleX

 

Terms of use

None other than not claiming this script as created by anyone except DoubleX or his alias

 

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

 

 

#------------------------------------------------------------------------------|
#  * (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_Edit
end # 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)

 

Instructions

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

 

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

 

FAQ

None

 

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.txt

Edited by DoubleX

Share this post


Link to post
Share on other sites

would it be possible to make a a magic blocking counter attack with this script?

You mean counter attack after nullifying magic(MEV)? If so, I'll have to add something to upgrade my script.

Share this post


Link to post
Share on other sites

 

would it be possible to make a a magic blocking counter attack with this script?

You mean counter attack after nullifying magic(MEV)? If so, I'll have to add something to upgrade my script.

 

Yes, that's exactly it. Soory for the trouble, I have no scripting skills of my own

Share this post


Link to post
Share on other sites

Hi, I don't know if there's a problem with how I have my scripts or damage calculations set up in my game, however I have them as default for now (for ex: a.atk * 4 - b.def * 2).

 

Having said that, it seems that counterattacks use the stats of the one who triggers the counterattack in determining how much damage the counter attack does, and not the stats of whomever is doing the counterattack. I hope what I said makes sense ^_^''

 

I suppose as a workaround, I could just reverse the a and b in the database's formula. Was this the intended effect?

 

EDIT: Nevermind, I think Victor Engine's Retaliation Damage script messed with this one. I changed the order of the scripts and now all is well.

Edited by joeyjoejoe

Share this post


Link to post
Share on other sites

After I installed the script, it lowers the damage counter attacks do. Where can I change that?

 

EDIT*

 

 

I started a brand new project to test, and even without additional scripts, it's using enemy's strength to calculate damage done by counter attacks.

Edited by tmrev

Share this post


Link to post
Share on other sites

Updates

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

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

 

Bug Causes:

 

 

It's merely due to my complete misunderstanding to method item_apply and apply_item_effects. This just clearly shows how utterly incompetent I'm :) (I'm just a nub pretending to be a pro XD)

 

 

Edited by DoubleX

Share this post


Link to post
Share on other sites

No worries man, if you're a noob, I'm a double noob.

 

That said, I've found another glitch.

When you counter attack, enemy attack states get inflicted on them as well. Example, a Wisp get's paralyzed, a Skeleton gets blinded, and so on.

Share this post


Link to post
Share on other sites

No worries man, if you're a noob, I'm a double noob.

 

That said, I've found another glitch.

When you counter attack, enemy attack states get inflicted on them as well. Example, a Wisp get's paralyzed, a Skeleton gets blinded, and so on.

It seems that the glitch you mentioned didn't occur(physical or mev cnt) in my test on a project without any other custom scripts. I also examined the mechanism of my script and its related methods and I don't think such glitch is even possible at all :)  But as the glitch is in fact occurred in your project, it must actually exist. May you please describe the settings of your project, the glitch itself and its situations more elaborately?

Share this post


Link to post
Share on other sites

I just ran a default project with no extra scripts. I set my actor's counter rate to 100% to test and just guarded. About every other successful counter hit inflict the enemy's attack state onto the enemy I countered. No change to any of the default settings, actor was using default equipment at lv 1.

 

Edit

So I recopied the script just to be sure and its working fine now. Don't know what happened, lol.

Edited by tmrev

Share this post


Link to post
Share on other sites

Getting an error (common theme with most of your scripts - this was tested in multiple projects and works in none of them - even a brand new project).

 

 

line 150: syntax error

 

target of repeat operator is not specified /+/

Share this post


Link to post
Share on other sites

Getting an error (common theme with most of your scripts - this was tested in multiple projects and works in none of them - even a brand new project).

 

 

line 150: syntax error

 

target of repeat operator is not specified /+/

I begin to suspect there's something wrong with the downloading of the script and something might have changed in your downloaded version due to this, so I'm afraid you'll have to quote the entire script you downloaded here :)

Share this post


Link to post
Share on other sites

Hey Double X,

 

I had a quick question about this script. Does this script require the skill to be learned by the actor to use it as a viable counter attack?

 

If not is there an easy edit to do so?

 

~ Dinhbat

Share this post


Link to post
Share on other sites

I will try it out once I get my counterattack issue fixed! Thanks DoubleX

 

**EDIT**

 

Tried it out and the requirement to learn skill works perfectly!

 

I did run into a different issue however...

For some reason the magic counter causes an odd loop. Here is the test I ran so you can see what happened.

 

Actor 1: Uses Magic Evade 100% State Skill

Enemy 1: Uses Ice - Actor 1 Evades

Actor 1: Uses Counterattack 100% State Skill

Enemy 1: Uses Ice - Actor 1 Evades & Counters with Attack

Enemy 1: Dies... BUT.... Enemy 1 Uses Ice Again - Actor 1 Counters with Attack

 

If the enemy dies there is no harm other than a dead enemy using a skill and a counter attack on a dead enemy. When there are multiple enemies on screen or when the enemy does not die ending the battle crashes with this message popping up

 

 

 

CounterIssue_zps74d48af6.png

 

 

 

I tried it with a clean file using the magic evade & counter 100% combo. The initial spell cast by the enemy and the counterattack happens twice, but there is no game crash. I am hoping if there is a way to make sure it only happens once it would stop the crash from happening in the main file I am working on as well.

 

Any thoughts on this?

 

~ Dinhbat

Edited by dinhbat3

Share this post


Link to post
Share on other sites

Hey DoubleX,

 

Just wanted to poke in and see if you had a chance to look into the Magic Counter issue I mentioned in the last post. Thanks again for the scripts and support thus far, I really appreciate it =D

 

~ Dinhbat

Share this post


Link to post
Share on other sites

I will try it out once I get my counterattack issue fixed! Thanks DoubleX

 

**EDIT**

 

Tried it out and the requirement to learn skill works perfectly!

 

I did run into a different issue however...

For some reason the magic counter causes an odd loop. Here is the test I ran so you can see what happened.

 

Actor 1: Uses Magic Evade 100% State Skill

Enemy 1: Uses Ice - Actor 1 Evades

Actor 1: Uses Counterattack 100% State Skill

Enemy 1: Uses Ice - Actor 1 Evades & Counters with Attack

Enemy 1: Dies... BUT.... Enemy 1 Uses Ice Again - Actor 1 Counters with Attack

 

If the enemy dies there is no harm other than a dead enemy using a skill and a counter attack on a dead enemy. When there are multiple enemies on screen or when the enemy does not die ending the battle crashes with this message popping up

 

 

 

CounterIssue_zps74d48af6.png

 

 

 

I tried it with a clean file using the magic evade & counter 100% combo. The initial spell cast by the enemy and the counterattack happens twice, but there is no game crash. I am hoping if there is a way to make sure it only happens once it would stop the crash from happening in the main file I am working on as well.

 

Any thoughts on this?

 

~ Dinhbat

May you please tell me the complete setting of the script you used?(Actor_Learn_Counterattack_Skill, CNT_Negate_Hit, COUNTERATTACK_MESSAGE, MEV_Invoke_CNT, Default_Counterattack)? I tried to reproduce your situation but I failed to reproduce the bug.

For the crash, it must be involved with script evaluation in common events or battle events since it's what Game_Interpreter line 1411 does and my script didn't even touch Game_Interpreter at all. It means that you must have added scripts(advanced section of event commands) in common events or battle events for it to evaluate. May you also please tell me what that or those script is?

P.S. My late reply is because I haven't seen your reply on 3 April. It appeared in my notifications but I just didn't notice at all :)

Edited by DoubleX

Share this post


Link to post
Share on other sites

Thanks for the quick reply.

 

I think it was because I editted my last one to avoid double posting!

 

I did more testing, and there is something incompatible with Yanfly's Ace Battle Engine.

I used a blank game file added in this order:

 

Test 1: Counterattack script only - No problem

Test 2: Counterattack & Counterattack Compatability - No problem

Test 3: Counterattack & Counterattack Compatability & Yanfly Core - No problem

Test 4: Counterattack & Counterattack Compatability & Yanfly Core & YEA Battle Engine Ace - This is when the problem happens

 

Here are the settings of the script at the moment

 

 

 

#==============================================================================|
#  ** You only need to edit this part as it's about what this script does      |
#------------------------------------------------------------------------------|

module DoubleX_RMVXA
  module Counterattack_Edit

#------------------------------------------------------------------------------|
#  * (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 = true
    
#------------------------------------------------------------------------------|
#  * (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 = false

#------------------------------------------------------------------------------|
#  * (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_Edit
end # DoubleX_RMVXA

#==============================================================================|
 

 

 

 

I attempted to change each one of the settings as well and still had the same result. So it seems to be a compatibility issue with Yanfly's Battle Engine.

Thanks for taking your time to help <3

 

~ Dinhbat

Share this post


Link to post
Share on other sites

Thanks for the quick reply.

 

I think it was because I editted my last one to avoid double posting!

 

I did more testing, and there is something incompatible with Yanfly's Ace Battle Engine.

I used a blank game file added in this order:

 

Test 1: Counterattack script only - No problem

Test 2: Counterattack & Counterattack Compatability - No problem

Test 3: Counterattack & Counterattack Compatability & Yanfly Core - No problem

Test 4: Counterattack & Counterattack Compatability & Yanfly Core & YEA Battle Engine Ace - This is when the problem happens

 

Here are the settings of the script at the moment

 

 

 

#==============================================================================|
#  ** You only need to edit this part as it's about what this script does      |
#------------------------------------------------------------------------------|

module DoubleX_RMVXA
  module Counterattack_Edit

#------------------------------------------------------------------------------|
#  * (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 = true
    
#------------------------------------------------------------------------------|
#  * (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 = false

#------------------------------------------------------------------------------|
#  * (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_Edit
end # DoubleX_RMVXA

#==============================================================================|
 

 

 

 

I attempted to change each one of the settings as well and still had the same result. So it seems to be a compatibility issue with Yanfly's Battle Engine.

Thanks for taking your time to help <3

 

~ Dinhbat

It seems that the latest changes of this script makes the compatibility fix outdated. I've updated the compatibility fix and it may fix at least some issues:

http://www.rpgmakervxace.net/topic/21880-doublex-rmvxa-counterattack-compatibility-fix/?p=151260

Edited by DoubleX

Share this post


Link to post
Share on other sites

Hey DoubleX

 

Unfortunately the update has the same issue... and actually now it does the double counterattack for normal counters in addition to the magic countering function =\

Sorry to pester you on this one xD

 

~ Dinhbat

Share this post


Link to post
Share on other sites

Hey DoubleX

 

Unfortunately the update has the same issue... and actually now it does the double counterattack for normal counters in addition to the magic countering function =\

Sorry to pester you on this one xD

 

~ Dinhbat

I can reproduce the error, but only when YEA Battle Engine is placed over my counterattack edit, so I suspect you placed them this way. If that's the case, try to follow the following order and see if the error still happens:

(DoubleX)Counterattack Edit

YEA-BattleEngine

(DoubleX)Counterattack Compatibility Fix

Share this post


Link to post
Share on other sites

Oh how silly of me... I always forget to rearrange the scripts xD Everything works out with that order of scripts.

 

You sir, have done it again!

Thanks for the help, and again sorry to be such a bother. <3

 

~ Dinhbat

Share this post


Link to post
Share on other sites

It seems that when you assign a skill for Counterattack, the animation doesn't play. The lack of animation makes the counter attack seem jarring and difficult to follow what's going on when text boxes are set to a high setting. Also, I tested having a skill like Dual Attack as a counter skill and only one hit is applied to the target. If the counter skill is a multi-target ability, it also only hits the actor that attacked and triggered the counter.

 

If it's not too difficult, could these issues be fixed? Being able to have a boss that counters physical with an AoE magic attack or something would be really nice, and being able to distinguish which ability is used as a counter, through a visible animation, will make them feel more complete and impactful. Perhaps include in the <counterattack: 4> tag a way to tell the counter to display the animation or not. Maybe something like <counterattack: 4, true>. Thanks!

Share this post


Link to post
Share on other sites

Updates

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

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

- Compatible with DoubleX RMVXA Substitute Edit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×