MV [YEP_SkillCore] Making a skill that purges "positive states".

Hello, looking for some help with a notetag from YEP_SkillCore:

For context; I want to create a skill that purges all "positive" states from an enemy.
This is the framework I have been working with:


JavaScript:
<After Eval>
let stateList = target._states;
for (i=0; i<stateList.length; i++) {
target.removeState(stateList[i]); i-=1;
}
</After Eval>

This worked in terms of removing EVERY state.





Obviously, I need a way to filter out any states that are not "positive".
My first approach was using metadata:

JavaScript:
<After Eval>
let stateList = target._states;
for (i=0; i<stateList.length; i++) {
if (stateList[i].meta.positive === 1) {continue;} else {target.removeState(stateList[i]); i-=1;}
}
</After Eval>

Note: All my positive states would be tagged with " <positive:1> "
But for some reason, it did not detect the metadata and just proceeded to remove every state
Note2: I also tried putting the 1 in the condition in quotation marks "1".





Then I tried using inherent data of states, in this case their "priority" parameter.

JavaScript:
<After Eval>
let stateList = target._states;
for (i=0; i<stateList.length; i++) {
if (stateList[i].priority === 8) {continue;} else {target.removeState(stateList[i]); i-=1;}
}
</After Eval>

Note: All my positive states would have their priority set to 8
But this did not work either.





So, is there something I did wrong or just missed?
Also, if there is a better way to approach a skill like this, please let me know.
target._states returns a list of state IDs, not state objects. Also, if you're using plugins like YEP Auto Passive States then it won't include passives. I recommend target.states() instead! 👋

Also, the default notetag values are stored as:
  • Strings for tags in the form <tag: value>;
  • true for tags in the form <tag>

Try one of these:
  1. Use <positive> for your State notetag, and this script call:
    JavaScript:
    target.states().forEach(function(state) {
      if (state.meta.positive) {
        target.removeState(state.id);
      }
    });

  2. Use <positive: 1> for your State notetag, and something like this for the script:
    JavaScript:
    target.states().forEach(function(state) {
      if (parseInt(state.meta.positive, 10) > 0) {
        target.removeState(state.id);
      }
    });
state categories extension plugin. state notetag <Category: Buff> and then skill notetag <Remove State Category: Buff>

edit: @ScorchedGround that status under your profile name. 100% agree. blizzard failed for last time.
im done giving them extra chances.
@caethyril
Ah you've saved me once again.
With your help I was able to make the skill work as intended.

And I was able to refresh my knowledge on metadata.

Also, the reason I used "._states" instead of "states()" was because i was initially browsing the console to find the right pointer to call. And it seemed like the "_states" attribute was the right one to go for.
When I tried putting that in the console, it returned me the states array of the object. I guess I was properly fluked then 😮‍💨

@Tiamat-86
Good suggestion, however I don't own that plugin and I did not intend to spend 10 bucks for a single skill that I am using in a one-of battle.

Also, Blizzard screwed up so often lately and in such grave manner, that I decided to fully deinstall the launcher and all games and completely boycott them.

On top of that, they ruined Warcraft III along with my childhood memories of it.
ill still play the games that i payed for (once they get it working correctly) cus just a waste of money otherwise. but ill never pre-order or day1 buy any of their stuff ever again.
im not about to just stop playing starcraft just because of how much they f'ed up in the last few years.
its the same with square, not gonna stop playing FF6 and chrono trigger just because 7 out of their last 9 games were utter crap.

yanfly plugins are 1 of those thing where if going to buy any of them its better to just buy the full bundle.
honestly not actually a bad investment even if would only ever use half of them just because of the shear amount of options they add.
but ya $30 is still $30. (least not as bad as MZ plugin bundle at $100)
On top of that, they ruined Warcraft III along with my childhood memories of it.
My God, Warcraft 3 is a childhood memory for you? Way to make me feel ancient...

Original thread: https://forums.rpgmakerweb.com/threads/yep_skillcore-making-a-skill-that-purges-positive-states.140756/