Help needed with making a skill

Ok the title doesn't really explain much because i don't really know what to title it and i've been trying things out the entire day but i cannot for the life of me figure this out

So. I have a pretty much pokemon-like ability thing using passive states. I wanted to make an ability which dealt double damage if an attack is a super effective hit/weakness. I've tried a ton of different things to make this ability possible but I can't wrap my head around it no matter how hard i try. Is there any way of achieving this? If it helps, I use passive states to assign actors typings/elements like pokemon which determine weaknesses and such. I also can't target specific actors due to a plugin that i use and the only way to reference actors is using scripts, if that's something that's important

I am praying someone smarter than me can figure this out because i'm about near to give up with it.
so your enemies/actors have types and your skills have types too? If the skill themselves only check the *target's* types, doesnt care for the user's types, and your types exist as passives then you can use target.isStateAffected(passive ID) inside of a pre-damage eval tag from yanfly's skill core plugin . that way, you could have your flying type skill automatically check if its targetting something with the bug type passive and double the damage or if against a rock halve it. If that sounds like it could work and you need help putting it together, feel free to ask.
Isn't this what the Element Rate thing is for that you can assign to battlers? You don't need to use passive states to make this work.
Isn't this what the Element Rate thing is for that you can assign to battlers? You don't need to use passive states to make this work.
No, that would make that element ALWAYS deal double damage, i want it to only deal double damage if it's a weakness/super effective hit, sorry if I wasn't more specific
Assuming you use element rates for weakness/resistance, you can use b.result().elementRate > 1 to check if the hit was effective (i.e. the element rate is more than 100%)

So in the damage formula box you can type something like b.result().elementRate > 1 ? (default formula) * 2 : (default formula) (replace the (default formula) with your default formula)
Assuming you use element rates for weakness/resistance, you can use b.result().elementRate > 1 to check if the hit was effective (i.e. the element rate is more than 100%)

So in the damage formula box you can type something like b.result().elementRate > 1 ? (default formula) * 2 : (default formula) (replace the (default formula) with your default formula)
Is there any way to make this specific to if an actor has a certain state?
Is there any way to make this specific to if an actor has a certain state?
Yes, you can use a.isStateAffected(n) in your damage formula, along with && to specify that both conditions must be met, so you can do a.isStateAffected(n) && b.result().elementRate > 1 ? (default formula) * 2 : (default formula), where n is the state ID. Or if you want the state to double the damage of all effective attacks, you can use yanfly's buff and states core and the <Custom Confirm Effect> notetag in the state like so:

JavaScript:
<Custom Confirm Effect>
if(b.result().elementRate > 1)value *=2;
</Custom Confirm Effect>
Yes, you can use a.isStateAffected(n) in your damage formula, along with && to specify that both conditions must be met, so you can do a.isStateAffected(n) && b.result().elementRate > 1 ? (default formula) * 2 : (default formula), where n is the state name. Or if you want the state to double the damage of all effective attacks, you can use yanfly's buff and states core and the <Custom Confirm Effect> notetag in the state like so:

JavaScript:
<Custom Confirm Effect>
if(b.result().elementRate > 1)value *=2;
</Custom Confirm Effect>
Just to be clear as i am very unfamiliar with skill damage formulas, "a" is referring to the actor using the skill and what does "b.result()" do, i get it's referring to the enemy but what is it checking?
Yes, you can use a.isStateAffected(n) in your damage formula, along with && to specify that both conditions must be met, so you can do a.isStateAffected(n) && b.result().elementRate > 1 ? (default formula) * 2 : (default formula), where n is the state name. Or if you want the state to double the damage of all effective attacks, you can use yanfly's buff and states core and the <Custom Confirm Effect> notetag in the state like so:

JavaScript:
<Custom Confirm Effect>
if(b.result().elementRate > 1)value *=2;
</Custom Confirm Effect>
It may be because I've never dabbled into damage formulas much but i inputed
Code:
a.isStateAffected(War Machine) && b.result().elementRate > 1 ? (100) * 2 : (100)
With "War Machine" being the name of the state
Spoiler: State
1697992748138.png
but despite that it deals 0 damage whenever i use it? Have I used it wrong or is it something else that could be the problem?
n should be the ID of the state, sorry.
n should be the ID of the state, sorry.
Haha, no worries, i should've checked to see if it was ID and not name

However though now it does deal damage, but it doesn't seem to deal the double damage, it only deals 200 it doesn't seem to see that the actor has the state because when i change the "(100) * 2" it doesn't change the damage but changes when i change the other 100 value. I have double checked that the actor has the right state and the enemy is weak to the attack
Action results dont have element rates in them by default i think. try changing
Code:
&& b.result().elementRate > 1
to
Code:
&& b.elementRate(the skill's element id) > 1

EDIT: but also, just making sure since you compared it to pokemon. did you intend for warmachine to be on the user, and the skill deals more damage is the user is a warmachine (STAB )? or did you want that if the target is a warmachine, the skill should do more damage(Super Effective)? because going off of what you checked earlier, its checking if the user is a warmachine and if the target is weak to the element of the skill
Action results dont have element rates in them by default i think. try changing
Code:
&& b.result().elementRate > 1
to
Code:
&& b.elementRate(the skill's element id) > 1

EDIT: but also, just making sure since you compared it to pokemon. did you intend for warmachine to be on the user, and the skill deals more damage is the user is a warmachine (STAB )? or did you want that if the target is a warmachine, the skill should do more damage(Super Effective)? because going off of what you checked earlier, its checking if the user is a warmachine and if the target is weak to the element of the skill
This did indeed fix it, thank you so much

I will say i'm kinda mad at the hours and hours i've lost today trying everything i could think off and in the end it was all for naught, but at the very least, I did get what i wanted in the end
Just since no one else linked to it:

Original thread: https://forums.rpgmakerweb.com/threads/help-needed-with-making-a-skill.162268/