MZ Help making an actor who only APPEARS to assist in combat?

TL;DR: Is there a way to make it so that during a battle, one actor who runs automatically (not controlled by the player) gives the appearance of fighting/displays the animations of fighting but does not actually detract from the enemy's HP? Essentially: it looks like the actor hits the enemy, it says the enemy takes damage, but the enemy does not actually lose any HP or get closer to defeat. The player only thinks that this actor is helping them. How would one do this?

Hello! I'm an Experimental Psychology graduate student in the process of developing a brief Fantasy RPG for a capstone research project I am conducting. There is a certain element of gameplay that I would like to implement, but do not know how.

For context, I am essentially developing two versions of the same video game. In one version of the game, the player will complete the main quest completely alone in a party of one (Alone Condition). They customize the Actor to reflect their own physical appearance, who will be a basic Swordsman class character every time. Once they've made their character, they complete a brief tutorial, before following a simple storyline in which they are hired to find a thief that has stolen a powerful magical artifact from an institute of magic. There will be some puzzles and a few brief combat encounters in the game, as well as a more difficult boss fight in the final dungeon.

The second version of the game (NPC Condition) is nearly identical to the first one in every way, except for one key difference: the player-character will be accompanied by an Actor named Markus, who is a sorcerer of the same starting level as the player. In this version of the game, Markus will explain parts of the game that would normally be explained by disembodied text in the Alone condition. He will help the player in combat, offer healing, and even show approval when the player progresses the game. My goal here is essentially to measure differences in a certain set of self-report variables in participants depending on which version of the game they played, with Markus being the Independent Variable that makes the difference.

Originally, I intended to double the HP of all the enemy troops in the game for the condition where Markus is present, as I assumed this would help to balance the difficulty of combat between the two games. Combat was going by faster in the NPC Condition than the Alone Condition, essentially. However, this of course introduces an unwanted confound to my study if I make one condition more difficult than the other, even if there's only a slight difference. One of the professors on my thesis committee proposed making it so that Markus does not actually deal any damage at all, but only APPEARS to do so, and then I keep the HP of the enemies consistent across conditions. I thought this was an excellent idea, so this is what I'd like to do.

I've been working with RPG Maker MZ for a while now, so I understand the interface itself fairly well. However, I am EXTREMELY new to programming, and as of right now, I only have experience with R Studio... no experience with JavaScript. My advisor for my thesis does thankfully have experience with JavaScript, BUT he does not have experience with RPG Maker.

I essentially would like to know if there is a way to make it so that during combat, Markus still uses the animations of fighting alongside the player and using his skills, but nothing actually happens? Essentially, it looks like he hits the enemy, it says the enemy takes a random amount of damage, but there is nothing that actually changes behind the scenes, and the player is none the wiser. I should note, I do have a combat event set up where Markus will heal the player if they drop below a certain amount of HP, and this is something I would still like to actually take effect! This "fake aid" would only apply to fighting the enemy troops.

Hopefully that all made sense, and thank anyone for their help in advance!
One approach that doesn't require any coding would be using action sequencing. With them, you could simply make the enemy immortal during the skill execution, let the damage happen, and then immediately after simply recover the same amount of HP before removing the immortal flag.
Assuming no plugins, MZ'z combat process (including effects and popups) is regulated by the battle log. So, if you just want to spoof an attack once per turn, you could do it via a troop event with the right combination of script calls to directly manipulate the battle log.
There is a reeaaaally simple solution to this...
If Markus doesn't already have an attack skill that's different from the default. Copy and paste the default attack skill (the first one in the skill database) and change the formula to this:
Code:
c = a.atk - b.def; b.gainHp(c); c
Then go into Markus in the actor database and set his attack skill to the one you just made. This works because the enemy gains the same amount of health as damage they are dealt BEFORE they are refreshed and checked for death (0 health). Resulting in a net damage worth of zero while still showing damage results corresponding to the original formula damage. It can't even kill an enemy with a max hp of 1. I thought it wouldn't work initially because I tried the same thing but instead of gaining health I gave the enemy a 0%* physical damage state and it didn't work. RPGM is weird under the hood.

im-not-smart-ultrakill.gif


Although I do have to question your intentions with Markus healing you on an occasion. I thought you would be trying to minimize all gameplay differences versions to record only the psychological differences between versions, and having an actual worthwhile difference would be problematic. I would suggest just having Markus apply a fake buff state instead.

Edit: Yeah I was HELLA wrong lmao. The formula thing doesn't work at all. The reason I thought I did was because I made a mini plugin that solves your problem and forgot about it before coming up with the formula thing. But at least I know it works lol.
JavaScript:
/*:
 *
 * @target MZ
 * @plugindesc For actors whose attacks are only visual.
 * @author Lowrell Lovelace
 *
 */

(() => {

let targetActorId = 5;

const _Game_Action_prototype_executeDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.executeDamage = function(target, value) {

    let subject = this.subject();

    if (subject.isActor() && subject._actorId === targetActorId && target.isEnemy()) {
        target._hp += value;
    }
    _Game_Action_prototype_executeDamage.call(this, target, value);
};

})();
Since you never worked with Javascript I'm gonna give you a quick tutorial. Just copy and paste the code snippet into notepad and change the 5 in "let targetActorId = 5;" to Markus' actor id which you can see left to his name in the actors database. Save it as "whatevernameyouwant.js" the .js part is really important. And save it in the \js\plugins folder of your game. Then open RPG Maker MZ and then click on the plugin manager, click on a column, click under "Name:" and find the plugin you just saved. Click okay on everything and save. No matter how much damage Markus deals he can never kill an enemy.

I know it sounds complicated at first but this is probably the easiest and least troublesome option I can offer you.
Yeah I was HELLA wrong lmao. The formula thing doesn't work at all
I was about to comment on it, but the plugin should do pretty well if Marcus is meant to be an actor and not something like a fancy animation pretending to be an ally 🤣
I was about to comment on it
Was about to close my laptop too before I checked my plugins too.;_;
There is a reeaaaally simple solution to this...
If Markus doesn't already have an attack skill that's different from the default. Copy and paste the default attack skill (the first one in the skill database) and change the formula to this:
Code:
c = a.atk - b.def; b.gainHp(c); c
Then go into Markus in the actor database and set his attack skill to the one you just made. This works because the enemy gains the same amount of health as damage they are dealt BEFORE they are refreshed and checked for death (0 health). Resulting in a net damage worth of zero while still showing damage results corresponding to the original formula damage. It can't even kill an enemy with a max hp of 1. I thought it wouldn't work initially because I tried the same thing but instead of gaining health I gave the enemy a 0%* physical damage state and it didn't work. RPGM is weird under the hood.

View attachment 363991


Although I do have to question your intentions with Markus healing you on an occasion. I thought you would be trying to minimize all gameplay differences versions to record only the psychological differences between versions, and having an actual worthwhile difference would be problematic. I would suggest just having Markus apply a fake buff state instead.

Edit: Yeah I was HELLA wrong lmao. The formula thing doesn't work at all. The reason I thought I did was because I made a mini plugin that solves your problem and forgot about it before coming up with the formula thing. But at least I know it works lol.
JavaScript:
/*:
 *
 * @target MZ
 * @plugindesc For actors whose attacks are only visual.
 * @author Lowrell Lovelace
 *
 */

(() => {

let targetActorId = 5;

const _Game_Action_prototype_executeDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.executeDamage = function(target, value) {

    let subject = this.subject();

    if (subject.isActor() && subject._actorId === targetActorId && target.isEnemy()) {
        target._hp += value;
    }
    _Game_Action_prototype_executeDamage.call(this, target, value);
};

})();
Since you never worked with Javascript I'm gonna give you a quick tutorial. Just copy and paste the code snippet into notepad and change the 5 in "let targetActorId = 5;" to Markus' actor id which you can see left to his name in the actors database. Save it as "whatevernameyouwant.js" the .js part is really important. And save it in the \js\plugins folder of your game. Then open RPG Maker MZ and then click on the plugin manager, click on a column, click under "Name:" and find the plugin you just saved. Click okay on everything and save. No matter how much damage Markus deals he can never kill an enemy.

I know it sounds complicated at first but this is probably the easiest and least troublesome option I can offer you.
I am extremely late getting back to you as these final few weeks of the semester have been so hectic, but you saved my life! Implemented in the game, this looked phenomenal. Participants have had no idea whatsoever that he wasn't dealing real damage!

The plugin was very easy to implement with your advice and I feel more confident to do it in the future. I even was able to tinker around and, with a little trial and error, make it so that this effect only applied to specific spells that he would cast, too.

Your comment about creating too much of a difference between conditions by having Markus heal the player was also incredibly insightful. I talked about it to my advisor, and we ended up changing it so that in the alone condition, players would still receive this healing, but the message would read that they get "a sudden burst of resolve" and restore the HP instead, and Markus simply does the healing in the NPC condition.

Overall, it turned out great, and this thread was a tremendous help.

Original thread: https://forums.rpgmakerweb.com/threads/help-making-an-actor-who-only-appears-to-assist-in-combat.183128/