Plugin: VisuMZ SkillsStatesCore
What i wanna create:
- A burn state who is stackable.
- when the targets turn starts it should deal x fire dmg * x stacks.
- it should then remove all stacks.
- the stacks should be visable like the barriers. (With a icon for the state and the number of stacks).
I really dont even know where to start, can anybody help me with the notetags and JS commands?
Put something like this in there (replace stateIds). The last notetag is from VS Battle Core. Oh and you might wanna add animation script and some other stuff there too:
<JS On Add State>
const number = (target.getStateDisplay(stateId) || 0) + 1;
target.setStateDisplay(stateId, number);
</JS On Add State>
<JS On Erase State>
const damageModifier = target.getStateDisplay(stateId);
if (damageModifier) {
target.gainHp(-1 * damageModifier * 100);
}
target.clearStateDisplay(stateId);
</JS On Erase State>
<JS Pre-Start Turn>
user.removeState(stateId);
</JS Pre-Start Turn>
Thank you very much.
I will try this out and try to add the animatins by myself. I will post the result qnd if it worked.
Well put in the add state notetag to remove the state if they are affected with the absorb barrier state and then make a tag to check that it doesn't use the remove state codes then. Or something. (edit: though it can happen that you first have this fire state, then get absorption barrier and then get more stacks of the fire state, so if you want to account for that, you need to build it more complex)
Then in the damage dealing part you need to check the state and the remaining points. I think in MZ the points is just the state display counter. So you modify it something like this:
if (damageModifier) {
let barrierPoints = 0;
if (target.isStateAffected(barrierStateId))
barrierPoints = target.getStateDisplay(barrierStateId);
let damage = 100 * damageModifier - barrierPoints;
if (damage < 0)
damage = 0;
target.gainHp(-1 * damage);
if (target.isStateAffected(barrierStateId)) {
let remainingBarrier = barrierPoints - 100 * damageModifier;
if (remainingBarrier < 0)
remainingBarrier = 0;
target.setStateDisplay(barrierStateId, remainingBarrier);
}
}
EDIT: Added the change in the barrier after damage
Cant wait to try it out tomorrow, i tryed it way different from your solution, im still new to java script but like to try it by myself first.
Anyway thank you for your time and i gonna add you in the credits when im done.