Scripting question

Is there a script that allows a specific attack to deal additional damage when the target is under a specific ailment?

Ex: a party member attacks the enemy while the target is poisoned, then that party member attacks with an ability that doubles in power when it hits a poisoned target.
you can do that in the skill /item formula box..

b::state?(state_id) ? 200 : 100This will check if the target has state 'state_id' and if so, the base damage wil be 200, otherwise 100. 🙂
you don't need a script for that, you can use the damage formula to condition the result on a state.

There is a topic about that, search for how to use the damage formula - I don't have the link ready.
It can be done within the damage formula using: b.state?(state_id), which checks if the target has the state id.

For example:

Code:
b.state?(4) ? a.atk * 8 - b.def * 2 : a.atk * 4 - b.def * 2
Y'all peeps are too slow ^_^
@Dekita

A question arising from ignorance.

I would have done as Rinobi did and used b.state?(state_id) ?

You, however, used b::state?(state_id) ?

What is the advantage of your formulation?
What's the ID for each state?
Look on the States tab of your data base.  It's the number before the name of the state.  So poison is 2.
No real advantage, both are means of scoping into the object in search of a method. I prefer to use '::' as that is the required scope procedure for obtaining constants fro a module, which means I can always use the same scope operator for both constants and methods, which in turn, makes me write the code faster 🙂

Realistically, they both do the exact same thing. One may be VERY slightly faster though (if I had to guess which would be faster I say the '.'). 🙂
Thank you for the explanation.
No worries dude 🙂
Do I put the number between the parentheses? May someone show an example of a complete formula?
Yes... Put the ID in the parenthesis
We can't give you an exact formula because you asked for one which gives double damage - but we don't know how you are calculating your base damage.

If you are using the default a.atk * 4 - b.def * 2, then it would look like this

b::state?(2) ? a.atk * 8 - b.def * 2 : a.atk * 4 - b.def * 2

If you are using a specific number, then it would look like this (the actual figures being whatever you wanted).

b::state?(2) ? 200 : 100

That's if you want poison, which is what you mentioned in your OP.  If you want any other state, take the number from the States tab and put it where the 2 is.
Okay thanks, just needed a general idea how it should look
 or perhaps even better..

form = (a::atk * 4 - b::def * 2) ;b::state?(2) ? form*2 : formThen you can easily alter the formula within the parenthesis and copy and paste from skill to skill. 🙂
Awesome, thanks. 🙂
No worries ^_^

Original thread: https://forums.rpgmakerweb.com/threads/scripting-question.42083/