Attacking with a secondary effect

Its my first time making a game and i cant seem to wrap my head around switches and events when it comes to linking them to attacks.

I'm trying to make an attack that damages that has a secondary effect that is positive for the attacker, the effects that I put in attach to the target, not the attacker.

How do I do both?

1749737449116.png
it depends on what you want to do.

you can use script calls inside of damage formulas to run effects on the user on hit, but imo its better to use a plugin like yanflys skill core and have one of its skill notetags to carry out the effect. You can use a common event too, but youll need to use script to get the correct user if this skill doesnt belong to a specific actor, and common events are one of the last things to process when a skill is used.

in any case, I cant tell you more without you saying what you want done.
my attack deals damage but then removes all strength buffs from the user. I'm implementing a Rage system (different from the status condition) into one of my characters. While his other attacks raise a rage counter which is represented by how much his attack stat is raised in battle.

This final attack is a strong finishing move, but wipes all stat buffs in turn to make it balanced.

Only this one actor uses this move, its his special ability, so i can tie it directly to him if that makes things easier
my attack deals damage but then removes all strength buffs from the user
ill use a damage formula for this, but a thing to note is that if an actor has a way to get an autobattle trait on them, youll want to use the skill core plugin. auto battlers run the code for all their skills as a part of choosing which to use, and this will cause them to remove all their atk buffs without needing to use the skill. try this as your formula

im assuming that even though it removes the buffs, this skill's formula should factor them before removing them, right?
Code:
var dmg = a.atk + a.luk * 2; a.eraseBuff(2); dmg

Edit:
realized that it would also clear debuffs. if you dont want that try
Code:
var dmg = a.atk + a.luk * 2; if (a.isBuffAffected(2)) a.eraseBuff(2); dmg
ok ill try that bottom one. This goes in the code for that skill, right?
This goes in the code for that skill, right?
yup
it didnt work, the atk buff didn't clear after using the spell
nvm, it worked, im dumb lmao, i put it in notes instead of actually in the formula.

THANK YOU!!!
when you asked
This goes in the code for that skill, right?
I thought you meant the formula box.

stuff in the notebox does nothing unless you have a plugin to make it do something
when you asked

I thought you meant the formula box.

stuff in the notebox does nothing unless you have a plugin to make it do something
ur the goat, wouldve never figured that out by myself.
@Robro33 DO you know how to calculate a critical hit formula?

I want to make a different move only work on a crit.
a little unclear what you want here. you mean the skill should only do some secondary effect if it crits, or the skill should only do anything at all (i.e. not miss entirely) only if it crits?
a little unclear what you want here. you mean the skill should only do some secondary effect if it crits, or the skill should only do anything at all (i.e. not miss entirely) only if it crits?
anything at all
well, you kinda have to choose one or the other but ill choose the first one cause its easier 🤣
something like...
Code:
var dmg = a.atk + a.luk * 2; if (b.result().critical) b.addState(5); dmg
would make it so that the skillcalculated its damage, performs an effect if it crits, and then deals the damage. in this case, itll add state 5 if the skill crit
It worked! THANK YOU AGAIN. I have more ideas for things i don't know how to do but I'm gonna make a new thread for them, you've been super helpful and i don't wanna berate you with all my nonsense lol.
well, you kinda have to choose one or the other but ill choose the first one cause its easier 🤣
something like...
Code:
var dmg = a.atk + a.luk * 2; if (b.result().critical) b.addState(5); dmg
would make it so that the skillcalculated its damage, performs an effect if it crits, and then deals the damage. in this case, itll add state 5 if the skill crit

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/attacking-with-a-secondary-effect.178274/