ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
898
First Language
German
Primarily Uses
RMMV
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.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,846
Reaction score
2,182
First Language
EN
Primarily Uses
RMMZ
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! :kaohi:

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);
      }
    });
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
970
Reaction score
432
First Language
english
Primarily Uses
RMMV
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.
 

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
647
Reaction score
898
First Language
German
Primarily Uses
RMMV
@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 :kaophew:

@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.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
970
Reaction score
432
First Language
english
Primarily Uses
RMMV
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)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,250
Reaction score
1,208
First Language
English
Primarily Uses
RMMV
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...
 

Latest Threads

Latest Posts

Latest Profile Posts

Something might be coming...
Hallo.png
A new day for creating :)
2021 has been the runner-up for the worst year of my life. 2015 may take that title, but '21 is pushing it. Excuses really don't justify how much of a jerk I've been this year to a lot of people.

I'm sorry. I don't intend to be a jerk forever, but I'd rather back up my intent with actions, not words.
"Another hundred habaneros... a teaspoon of tumeric... and a heaping helping of nitroglycerin!" The kitten in a chef's hat laughed maniacally as the pot he was stirring promptly exploded.

Forum statistics

Threads
116,019
Messages
1,094,956
Members
151,333
Latest member
QpQp
Top