Hi! I was wondering if there's a way to make a skill do damage based on the amount of turns left in a certain status on the actor using that skill. My first thought is there might be a way to do it with Yanfly's Skill Core, but I wouldn't know how to retrieve the number of turns left on a status. Do any of you know how? Thank you!
MV How can I make an skill do damage based on the turns left in a state
Javascript/Plugin Supportshort answer, yes, it's possible.
you have to grab everything before processing it and returning the damage, which is done at the damage formula by default, but I doubt the formula box is large enough to fit all that.
my solution would be, make a new module, add a function there that deals with the processing, and call that from the damage formula with a much shorter instruction.
it all depends on how versed you are with the coding.
you have to grab everything before processing it and returning the damage, which is done at the damage formula by default, but I doubt the formula box is large enough to fit all that.
my solution would be, make a new module, add a function there that deals with the processing, and call that from the damage formula with a much shorter instruction.
it all depends on how versed you are with the coding.
Well, I don't know as much in JS as I do in some other languages, but I feel I could probably just accomplish something similar with Yanfly's Skill Core's notetags, I think...? I imagine it would look something like this:
JavaScript:
<Pre-Damage Eval>
// The damage function's result is the variable "value" in this plugin.
if (user.hasStatus(42)) {
turns = "Whatever function would return the number of turns left on a status";
value = value*turns;
} else {
value = 0;
}
</Pre-Damage Eval>
You can fetch the remaining turns for state ID 123 on
So I suggest a damage formula like this (no plugins necessary):
I.e. "
Technical:
developer.mozilla.org
battler like this:
JavaScript:
battler._stateTurns[123]
JavaScript:
(a.mat + 50) * (a._stateTurns[123] || 0)
a.mat + 50 multiplied by the remaining turns of state 123 on the action user (or zero if they don't have that state)". Change each part as needed for your situation~Technical:
_stateTurns[123] will be undefined (a "falsy", but non-numeric, value) if the bearer does not have that state. That's why I've included the || 0 to make sure the multiplier is always a number. More info here:
Logical OR (||) - JavaScript | MDN
The logical OR (||) operator (logical disjunction) for a set of operands is true if and only if one or more of its operands is true. It is typically used with boolean (logical) values. When it is, it returns a Boolean value. However, the || operator actually returns the value of one of the...
Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-make-an-skill-do-damage-based-on-the-turns-left-in-a-state.138488/