Skill doesn't work properly

Hi, I have that "Charge" skill for my character that's supposed to give him +1 unit of charge, up to 3 units (represented by a series of 3 states). It's supposed to be charging like this:
  1. After one use, it's one unit.
  2. After the second use, two units.
  3. Third use - three units
  4. As the charge perishes after 3 actions, it can be at this point refreshed by another, slightly cheaper skill.
But it works like this:
  1. After one use, it's one unit.
  2. Second use, still one unit.
  3. Third use, two units.
  4. Fourth use, three units.
  5. Refreshing works like it should.
Here's the code:
${Title} - RPG Maker MZ 12.03.2023 18_48_29.png

Some things to note:
  1. I want the Charge to be perishable - the states disappear after 3 actions (technically 4, but RPGMMZ counts this skill as an action).
  2. "Nishi" is the shapeshifter character attained later in the game (see the dead post in my sig) that I wanted to account for, and "Genjiro" is the character I'm programming this for.
  3. That doubled "Add State" is my foolish and not working way of fixing this glitch.
  4. That code list is that long because I stitched it in Paint 3D from 3 screenshots.
It shouldn't necessarily stop you from having charge 2 but I see that you're not removing charge 1 after added charge 2, instead you're adding the state again
Screenshot_20230313-091213_Chrome.jpg
I fixed it, and it doesn't fix the issue. I even tested on some true enemies rather than a test enemy, and it's still not working as I intended.
How is the code being called? Can you add a debug statement to make sure that its making it to the state block each time?
This method helped! Thanks to it, I noticed that I set the operation on the variable to ADD instead of SET, and as Nishi's Actor ID is coincidentally 8, while Genjiro's is 4, it caused this exact problem on the second cast. Thank you!
Oh yeah I totally missed that it's a += operation, glad you were able to catch it!

Original thread: https://forums.rpgmakerweb.com/threads/skill-doesnt-work-properly.155748/