Can't make a skill that damages an Actor through the menu?

Hello, I've found the weirdest (bug)? So I want to create a skill that when used from the menu it damages the target actor, but for some reason it just doesn't work. If I set it to HP Recover it works just fine and heals the actor, but if I set it to HP Damage, nothing happens.

Could someone help me with this? It's driving me nuts.

Here's how the skill is set up, I basically just changed it from HP Recover to HP Damage and just stops working.
I have no plugins, and tried this in an empty project.

1677900900595.png
I replicated this in MV and I think the engine's default code is coded for damage skills to not have any effect on ally's in the field menus. However the skill seems to deal damage when in Battle.

This might have to be overwritten with a plugin to treat the target as an unconditional scope and force the target to take damage.
As an alternative to plugins and re-writes, the simplest method might be to just have the skill call a common event.
In that event use the event menu command 'Change HP' and decrease by 100.

EDIT
Just thought that you, or someone reading this thread, might not know how to tell the common event which actor to target.

Set a variable and name it something obvious. I use "Actor ID for item"
For the Operand select Game Data -> Last -> Last Target Actor ID
Select Change HP
To choose the Actor, select Variable
You end up with commands looking like this:
1677917830515.png


The fact that my variable is named "...for item" makes no difference to you. It works like that if it is a skill and not an item that is calling a common event.
Hello my friend,

I looked a little bit around in the code and found a solution for you.

Make a new plugin and place it below all other plugins you use.
Now add this to the new plugin file:

Code:
Game_Action.prototype.testApply = function(target) {
    return (this.isForDeadFriend() === target.isDead() &&
            ($gameParty.inBattle() || this.isForOpponent() ||
            (this.isHpRecover() && target.hp < target.mhp) ||
            (this.isMpRecover() && target.mp < target.mmp) ||
            (this.isDamage() && !$gameParty.inBattle()) ||
            (this.hasItemAnyValidEffects(target))));
};

Line 6 is what I added.
Normally, the game won't allow to use damage items or skills while you are not infight.
The added line will allow you to use items and skills that has the damage type while you are on the map.

Best regards,
Masajatsu
Hey guys thank you for the replies, I appreciate your willingness to help 🙂
Unfortunately using common events wouldn't be enough for me, as I will have more than one ability and I like to keep the game clean, so having a plugin or overwrite that fixes it is the best for me. But it's great to see that I could have an alternative even if I couldn't get a correction the code. I really appreciate you taking the time to test that out and try to help me with this problem @Kes !


@Masajatsu This fix worked perfectly, thank you so much!
Oh dang someone else already answered. I was going to reply that I bypassed this oversight in the code by setting a "HP Recover 0" effect so it can still damage you with the formula.
As an alternative to plugins and re-writes, the simplest method might be to just have the skill call a common event.
In that event use the event menu command 'Change HP' and decrease by 100.

EDIT
Just thought that you, or someone reading this thread, might not know how to tell the common event which actor to target.

Set a variable and name it something obvious. I use "Actor ID for item"
For the Operand select Game Data -> Last -> Last Target Actor ID
Select Change HP
To choose the Actor, select Variable
You end up with commands looking like this:
View attachment 254898

The fact that my variable is named "...for item" makes no difference to you. It works like that if it is a skill and not an item that is calling a common event.
That actually only works in MZ, because MV doesn't have any of the "Last" options available. MV users have to jump through some extra (albeit minor) hoops to make post-skill common events viable.
@Arthran Thanks for the heads up on that. As I skipped straight from VX Ace to MZ without ever going via MV, I didn't realise that 'Last' was a new option.

Original thread: https://forums.rpgmakerweb.com/threads/cant-make-a-skill-that-damages-an-actor-through-the-menu.155496/