MV [Solved]Limit skills in a catagory like buffs

Yep me again lol

Sorry if title is confusing didn't know how to really say it. What I'm looking for is a way to not put a skill usage limit like yanfly plugins do. But a way to limit say only 2 skills being used in a category at time like buffs for example. Only 2 buffs from say Buff category can be used at a time. To use anymore you have to remove 1 or both of the other buffs to cast another

I'm pretty sure eventing this in a common event would do it but. There are over 120 spells in the category and I'm not 100% sure how to event that many out lol. I guess since they place a state on the player it would be to check for x state. But that be fine for checking for 1 spell but then to check for 2 of any one of 120 to do it this way seems rather difficult xD

I know not everyone knows this but best example of what im trying to do is Final Fantasy 11 Bard - where they can only cast 2 songs on the party at a time unless they have the mythic weapon equipped which allows 4 songs to be cast on the party. Id also like to do something simuler to monsters where only 1 or 2 debuffs in some categories can be placed at a time
Easiest way I can think of, which wouldn't be exactly what you describe, but similar would be having a note tag in every state that gives a +1 to a variable and then have a troop event that checks if that variable is bigger than 2 every turn. If it is bigger than 2, remove all states.

Not quite the same, but a whole lot less work than the other option of making a huge conditional branch checking each and every state.
Easiest way I can think of, which wouldn't be exactly what you describe, but similar would be having a note tag in every state that gives a +1 to a variable and then have a troop event that checks if that variable is bigger than 2 every turn. If it is bigger than 2, remove all states.

Not quite the same, but a whole lot less work than the other option of making a huge conditional branch checking each and every state.
not gonna lie i never even thought of tracking the skill/spells by a var lol that might actully work just the way i want. Maybe have it set to multi by 1 then once it hits 2 dont allow anymore but then removal of the buff would then decress by 1 allowing a new one to be cast
not gonna lie i never even thought of tracking the skill/spells by a var lol that might actully work just the way i want. Maybe have it set to multi by 1 then once it hits 2 dont allow anymore but then removal of the buff would then decress by 1 allowing a new one to be cast
Yep something like that can work. I just didn't have enough info. I didn't know how your player is able to remove the buffs/debuffs or if you want to seal the skills whenever the max amount of states has been reached so I could only suggest what I did. ^^ Glad I could help out.
<Custom Apply Effect> if ($gameVariables.value(10) === undefined) { $gameVariables.setValue(10, 0); } $gameVariables.setValue(10, $gameVariables.value(10) + 1); if ($gameVariables.value(10) > 2) { $gameVariables.setValue(10, 2); user.addState(10); } </Custom Apply Effect> <Custom Remove Effect> if ($gameVariables.value(10) === undefined) { $gameVariables.setValue(10, 0); } $gameVariables.setValue(10, $gameVariables.value(10) - 1); if ($gameVariables.value(10) < 0) { $gameVariables.setValue(10, 0); } </Custom Remove Effect>

Ok soo this is what ive got lol and it does work to the point it incresses and decresses var 10 and then applys state 10 on the player. Now how to lock out skills once the state 10 is applyed xD

NVM im an idiot... forgot you can just set seal skill type right on the state lol..........
If I correctly understand what you're describing, I think an easier method is to use Yanfly's State Categories.

Then you can simply check for:
Code:
if (user.getStateCategoryAffectedCount("song")==2)
or whatever comparison you want at the time.

For example, you can use the Skill Core to make a skill unavailable to use if there are already two states on:
Code:
<Custom Requirement>
value=user.getStateCategoryAffectedCount("song")<2;
</Custom Requirement>
If I correctly understand what you're describing, I think an easier method is to use Yanfly's State Categories.

Then you can simply check for:
Code:
if (user.getStateCategoryAffectedCount("song")==2)
or whatever comparison you want at the time.

For example, you can use the Skill Core to make a skill unavailable to use if there are already two states on:
Code:
<Custom Requirement>
value=user.getStateCategoryAffectedCount("song")<2;
</Custom Requirement>
Once again thank you turan. This does infect do what i was looking for lol. Aswell makes this whole think much simpler. I know most of the main plugins from yanfly but i keep forgetting a lot of his extension ones and this is one i forgot about xD

Really though i cant thank you enough lol... That plugin does 100% what i was looking for and i can set as many catagories as i want to break down the spell usages sooo Thank you!

---------------------------------------------------------------------------------------------------------

Ok so heres what i came up with using what you said and then playing with the plugins

<Custom Requirement> if (user.isActor()) { var weaponId = user.equips()[2].id; if (weaponId === 10) { value = user.getStateCategoryAffectedCount("Songs") < 4; } else { value = user.getStateCategoryAffectedCount("Songs") < 2; } } </Custom Requirement>

Although it seys weaponid its actully checking equip slot 3 on the actor which is an armor slot (since the engine doesnt allow more then 1 weapon or 2 if dual weild is set) in my game theres a 3rd weapon slot "Ranged" but since armor and weapons honestly work idinitcly to each other and i can set animations via tags or javascript to the armors to mimic weapons its not an issue lol

For those wondering change the following to the equipslot you want to check for index starts at 0 so slot 1 of the actor equipment would be 0

var weaponId = user.equips()[2].id;

Then change this to the ID of the armor in you database you want it to check for

if (weaponId === 10) {

if you want it to check for a weapon then set the first one above the "user.equip()[2]" to 0 or if you have dual wield active you can use either 0 or 1 or make a 2nd if statement to check for both

as for the catagorys as Turan suggested this is using yanflys State Catagorys. Check there for info on them but just change the section in the "" to w/e catagory you have and want to track

like mine for example is tracking a catagory named "Songs" which is on the note tag section of the state and if 2 states with this tag is apllyed any skills that add these states are then blacked out and not able to be used.

But if Equipment 10 is equiped i can add 4 states with that tag

also to note the <Custom Requirement> goes on the skill not state and requires a 2nd plugin by yanfly "Skill Core"

Original thread: https://forums.rpgmakerweb.com/threads/solved-limit-skills-in-a-catagory-like-buffs.157989/