ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
644
Reaction score
888
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,837
Reaction score
2,176
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
644
Reaction score
888
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,231
Reaction score
1,195
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

Even though I spent 100's of dollars on my game already. I think I might just have to give it away for free. Since I haven't heard back from people if I could use some of their graphics. Even from a global mod here. Maybe I can make a donation thing.
you know, some days you get resentful that game dev is even considered a "fun job" and other days it's like, welp, time to roll up my sleeves and code these molotov cocktails
If you suck at playing trumpets, that is probably why.
Been sick with a stomach virus for seven days now. Not going to work tomorrow because I'm still contagious according to my doctor.
Much as I love my job, I really hate playing "office politics". It would be nice if I didn't have to pretend to be someone else all day long.

Forum statistics

Threads
115,960
Messages
1,094,409
Members
151,231
Latest member
DadOfSpaceMonkey
Top