The other issue I have is that this state can also be applied to allies, so far when in battle the custom variable seems to be created on its own for each character(if a character gets hit only that character counter is decreased instead of lowering all of them)
Yes, there's nothing in this code that could allow you to change the counters on multiple people at the same time. You would have to intentionally loop through the party members and adjust each one.
So that makes me a bit weary of the user. should I leave it like that or add target.
Somewhat unintuitively, they are the same. There's no difference between using user or target, the only difference is origin.
Edit: Test your code, without changing it at all and putting it in the Custom Apply Effect, the skill stacks now but it goes past 3, so the clamp is not working
I misunderstood from the documentation how the clamp worked. I thought it was a setting the state would remember, but it's something that is done when you execute it.
So you can change the Custom Apply Effect to:
Code:if (!user.getStateCounter(10))
user.setStateCounter(10, 0);
user.addStateCounter(10, 1);
user.clampStateCounter(10, 1, 3);
also I changed the Custom react to this...And is not lowering the counter when hit. I'm sure I'm doing something wrong but I don't know where
You're doing at least a bit of logic wrong, although it should still result in things happening.
I also suggest you try to get into good indenting habits with your code, it makes it easier to read and see where things go.
Code:defender.addStatecounter(10, -1);
defender.setStateCounter(10, 0);
Right here, why are you counting down the counters by one just to blow all the stacks and set it to 0?
And in your first conditional, do you really want it to waste a charge if they get hit for 0? I'm not changing it, but it's a logic question.
Anyhow, making that change:
<Custom React Effect>
if (!this.isRecover() && value >= 0) {
value = 0;
defender.addStatecounter(10, -1);
if (defender.getStateCounter(10) < 1) {
defender.removeState(10);
}
}
</Custom React Effect>
This looks like it should work. Is the damage getting correctly set to 0?
If it doesn't work at all, you should check that your plugins are in the correct order and such.