RPG Maker Forums

Plugin in question: http://yanfly.moe/2016/04/03/yep-89-state-categories/


Hello everyone.


I'm trying to add to my game some skills and items that add a state from the State Category 'Elemental'. And other skills from the category 'Stance'. And I am trying to make it so, when one of these states is applied, any state from the same category is removed.


But... They either remove the added state, or don't remove any at all...


Basically, this:





But the solution on that topic doesn't want to work for me...


I didn't want to revive a months-old topic, so hope no one minds me redoing it.


[EDIT]


I'm an impatient person, so I created my own way of doing it.


I made this code to do it:


<Custom Apply Effect>
if (target.getStateCategoryAffectedCount('Elemental') > 1)
{
target.removeStateCategoryAll('Elemental');
rsid = target._result.removedStates.indexOf(state.id);
target._result.removedStates.splice(rsid, 1);
target.addState(state.id);
}
</Custom Apply Effect>


Basically, I noticed that the effects did not happen, but the state WAS added before the Custom Apply Effects started working. So I made it only remove the effects if there were two effects there already... and then added the state again.


It did not want to add again, though.


Then I found out, after lots of search, that the core plugin checks if the new added state was just removed and if it was... doesn't add again. So I had to find the state's index in the removed states array to remove it from there, and only then I was able to add it again.


It may not be the proper, maybe not even an elegant solution, but at least it works.

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top