A skill that applies a buff used on the party, but deals damage otherwise

hey all o/ so like... im back with another inquiry (which is probably silly LOL)

Context: basically, it's... a skill that applies a buff when I use it on my party, but when used on enemies, it hurts them instead.

I figured I could do this with a simple enough formula, but I can only get the buff part going. Heres what i used:

b.actorId(2) ? b.addState(20) : 120 + a.mat * 4 - b.mdf * 2

(idk if I wrote it correctly here... but I did check out the Formulae post and I did back then. its prob just uppercases missing or something LOL)

Since the id of the actor using the skill is 2, then... of course I set it to 2. LOL. The scope of the skill is "All Enemies" but I used a Selection Control Plugin (Victor's) so it allows me to toggle between foe and friend.

I'm pretty sure the mistake might be in the "if" statement, but I'm a fool so... yeah... thanks in advance for your help and patience 😅
If you use this statement, only the actor with ID #2 will not get hurt, but anyone else will suffer the damage. That's why your party still takes damage from this skill.
And i guess it should be b.actorId() === 2 ? b.addState(20) : 120 + a.mat * 4 - b.mdf * 2
If you use this statement, only the actor with ID #2 will not get hurt, but anyone else will suffer the damage. That's why your party still takes damage from this skill.
And i guess it should be b.actorId() === 2 ? b.addState(20) : 120 + a.mat * 4 - b.mdf * 2

hello o/

well, the original formula has it so that the actors dont take any damage, they just have the state applied. but whenever i use it on enemies, it deals 0 damage and creates an error message.

and im afraid it works just about the same with the formula you provided 😅 unless i gotta fill in some blanks or something and im just dumb LOL
Well, using formula box in database to create some complex formulas is so painful.
I recommend you to use Yanfly's Damage Core plugin to create complex damage formulas by using note tags with some knowledge about Javascript. You can grab it here: http://yanfly.moe/2015/11/07/yep-25-damage-core/
If you use it, just replace a with user and b with target
It's throwing an error because actorId is not defined for enemies. Try isActor instead?
Code:
b.isActor() ? b.addState(20) : 120 + a.mat * 4 - b.mdf * 2
hey guys o/

caeth's method turned out to be the solution LOL im sorry im so terrible at this

but thank you both for your help! ♥

Original thread: https://forums.rpgmakerweb.com/threads/a-skill-that-applies-a-buff-used-on-the-party-but-deals-damage-otherwise.94997/