MARREND'S CUSTOM COUNTER

Customizible the counter-atttack skill of friend and foe alike!

  • Marrend
  • 03/25/2024 09:17 PM
  • 3417 views
Introduction:
This is an RPG Maker MZ script/plugin I made that allows customization of what skill a battler counter-attacks with.

A counter-attack is considered as a skill that is used by a battler in response to an attack with a "Physical Attack" type back to the user of the skill that invoked the counter-attack to begin with. It largely assumes a damage effect.

Skills defined with "Certain Hit" or "Magic Attack" type are outside the scope of this plug-in!


Terms of use:
The script is for use in any commercial, or non-commercial game. Compatibility with other scripts/plugins were not taken into consideration when writing this, so, if you do have issues that arise from that, my ability to assist may be hampered, but will still be considered on a case-by-case basis.

While I do not currently ask for monetary recompense, I would, humbly, ask that I am credited in your project if this script/plugin is used. The precise details can be up to the end-user, but, I would prefer to be credited by my username. "Marrend", in this case.


Points of contact:
The preferred point of contact is through RMN. So, posting here, or use RMN's messaging service would be sufficient. I also dip in and out on RMN's Discord channel at times, and can also be contacted on that platform. My user ID on Discord is Masako#3234.


Instructions:
First, register the plugin into your project's Plugin Manager. This plug-in uses the note-tag...
<counterskill: id>

...to delineate the skill ID to use as a counter-attack. If the note-tag is not present, it merely defaults to the standard attack action.

The note-tag can go directly into the note field for enemies under the Enemy tab in the database. For player-characters, the note-tag is placed into the note field for equipment in the Weapon tab.

Details

  • 2.2 KB
  • 123
  • 04/18/2024 03:01 PM

Actions

Posts

Pages: 1
Marrend
Guardian of the Description Thread
21781
For full disclosure, this code was based off of research done on the base-line materials that come with MZ. I don't have VisuStella's Battle Core, or, frankly, anything made by them. Hence...

snip
Compatibility with other scripts/plugins were not taken into consideration when writing this, so, if you do have issues that arise from that, my ability to assist may be hampered, but will still be considered on a case-by-case basis.


..this text.
So I desperatly tried to get this to work in my project. And when it didn't I tried to use it in a completely new project.
Made a counter skill that puts your character into the counter-stance and all, put <counterskill = id> in the notetag for the weapon the actor uses (<counterskill = 141>) and made sure the skill is:
A. A Physical Attack and not either magic or certain
B. That the actor has the resources to perform the set skill
But no matter what, it always does the default attack. I even tried it with enemys and they also use the default attack no matter what I do.

Is there anything I missed, maybe something obvious?
I really want this to work as I haven't found any other Plugin that changes the counter but I'm ripping off my hair because it seems so simple and yet it doesn't work. I also made sure it's the counter for physical attacks and not for magic attacks.
Marrend
Guardian of the Description Thread
21781
All I can says is that's it's my idiocy, and I apologize for not noticing this earlier. For what it is worth, the notetag should use a colon...

<counterskill: id>


...like so, rather than utilize the equals sign. Both this page, and the script's help file have been updated. You might not necessarily "need" to get the updated file to get it to work, but, regardless of if you do or not, if replacing the notetag with this syntax still doesn't work for you, let me know!
First off thank you so much for taking your time with me!

Sadly, it only kinda works now. Tested it on a freshly made project again and it still doesn't work for actors.
It kinda works for enemies, though:

- It seemingly keeps the default attack animation. I tested it with a magic spell as a counter this time and the enemy definitly did way more damage even though it sounded and looked like they countered using a normal attack

- I then used a buff as a counter attack and when the enemy countered, the actor got buffed instead of the enemy. I set the scope to "1 ally" and "to self" just in case but both times the actor got buffed.
Marrend
Guardian of the Description Thread
21781
- It seemingly keeps the default attack animation

This... makes a certain amount of sense? I remember needing to insert code into deathblows so that the "standard" light/medium/heavy attacks, regardless of what skill IDs are used, use the default attack animation, rather than the default skill animation in regards to side-view sprite animations. I fully admit that I might not have been too concerned about side-view systems when I wrote this. *nervous laughter*

I then used a buff as a counter attack and when the enemy countered, the actor got buffed instead of the enemy. I set the scope to "1 ally" and "to self" just in case but both times the actor got buffed.

I've a feeling this very likely involves...

// Executes counter-attack skill.
BattleManager.invokeCounterAttack = function(subject, target) {
	skill = $dataSkills[target.counterSkillId()];
	if (target.canPaySkillCost(skill)) {
	    const action = new Game_Action(target);
		action.setCounterAttack();
		target.paySkillCost(skill);
		action.apply(subject);
		this._logWindow.displayCounter(target);
		this._logWindow.displayActionResults(target, subject);
	};
};

...this code, right here, which is an overwrite of...

BattleManager.invokeCounterAttack = function(subject, target) {
    const action = new Game_Action(target);
    action.setAttack();
    action.apply(subject);
    this._logWindow.displayCounter(target);
    this._logWindow.displayActionResults(target, subject);
};

...the default code when a counter attack is invoked. I could be wrong, but, my current thoughts are that the variables passed into either of these methods might always be the same. As in, 'subject` would be the battler triggering the counterattack, and `target` would be the battler performing the counterattack. Though, looking at the action queue/array again again again again again to research this further would be in order.
Marrend
Guardian of the Description Thread
21781
I can't say for sure if I can get the animation for the indicated skill to animate/play, nor how to indicate a side-view motion for allied battlers, other than the "attack" motion of the equipped weapon. However, at the very least, getting a counter attack skill to target the battler that is counterattacking is certainly more doable! Plugin updated!

However, I am inclined to note that the way I've set this up, only one target is viable for counter attack skills. You can choose a scope of "all allies" or "all enemies", but, skills will revert to the attacking unit in the case of a skill that targets enemies. Likewise, skills will revert to the defending unit in the case of a skill that targets allies. However, this restriction could be circumvented by use of Common Events, should such be desired.
nor how to indicate a side-view motion for allied battlers, other than the "attack" motion of the equipped weapon.


Well, I personally always use the Front-View in Battle so atleast for me that ain't a problem

I can't say for sure if I can get the animation for the indicated skill to animate/play,


Well. I gathered with my miniscule know-how that it's probably not that easy to just tell the game to replace the default counter attack with another skill(the one given in notetags) and be done with it, though I am surprised that it is still possible to atleast borrow another skills "effect".

However, I am inclined to note that the way I've set this up, only one target is viable for counter attack skills. You can choose a scope of "all allies" or "all enemies", but, skills will revert to the attacking unit in the case of a skill that targets enemies. Likewise, skills will revert to the defending unit in the case of a skill that targets allies. However, this restriction could be circumvented by use of Common Events, should such be desired.


My personal use would be a self targeted skill after getting hit that regenerates a set amount of TP so that wouldn't be a problem. And as you said, If I wanted, I could use a common event on the skill to activate another skill( which would at least definitely play the right animation.


I'm gonna test it later today and see how it works out.
Anything about the counterskill id only working for enemies and not actors? Ya didn't mention that so that's why I am asking.
Marrend
Guardian of the Description Thread
21781
I initially only checked actors, where a custom counter skill would be obtained via their equipped weapon. I did a check for enemies as well, where it's obtained via the notes field on the enemy. It seemed to work for both battler types, and checking through various scopes to ensure that what was going on is, in fact, what I thought should be going on. As far as such tests were concerned, it worked as intended.

Though, as an aside, it was kinda funny, at least for a little while, to see a healing skill used as a counter attack, even if the battle was going exactly nowhere because of that.
Okay, not sure if I just did something wrong last time but yeah, it does work now!
It still shows the default attack animation even front view and does 0 damage, though it being shown as 0 damage might also just be because of another plugin I use but atleast the actual skill is being used now and the actor actually is the one getting TP(in my case)!

Counter attacking in RPG Maker is generally just uncooperativ, if you want to the actor to not move during counter stance, guess what, apparently not possible and do anything else aside from default attacking when hit? Nah, can't change that either buddy.

Atleast until now. Thank you so much again for taking your time! If anything else comes up or stops working, I'll let you know.

Marrend
Guardian of the Description Thread
21781
Depends on the "counter stance" definition. Like, I have a game made in Ace where there's a skill called "Absorb Stance", that induces a state on the users that has it's target rate shoot through the roof, and lowers DEF/MDF values. However, incoming damage is treated as MP recovery, with, perhaps, some additional math to account for the general trend of MP values being lower than HP values when the MP recovery is applied.

Celes' [Runic] command in Final Fantasy 6 did something similar, I think? My memory is certainly more than fuzzy on this point, but, I think it was limited to absorbing MP from magical attacks, and only gained MP equal to the cost of the spell. I don't quite remember, it's been a long, long, time, and it's a command I barely personally used.
Pages: 1