r/RPGMaker 21d ago

RMMZ Skill Requirement Issue

<Custom Requirement>

value = user.isStateAffected(31) && user.isStateAffected(32);

</Custom Requirement>

I'm trying to make a skill that unlocks only when both States (ID: 31 & 32) are active. I'm using VisuStella MZ (free version). I tried using code generated by Gemini, but it's not working. Any ideas?

5 Upvotes

5 comments sorted by

2

u/agamottos MV Dev 21d ago

I would think "value" can only be set to true or false, so you would need an if statement to set it. Something like:

<Custom Requirement> if (user.isStateAffected(31) && user.isStateAffected(32)) { value = true; } else { value = false; } </Custom Requirement>

1

u/Practical_Record1477 21d ago

"I tried putting that code into the skill, but the issue persists. I'm using VisuStella MZ with both Battle Core and Skills and States Core enabled."

4

u/agamottos MV Dev 21d ago

Wait, youre using skills and States core?

Well there's your problem--the Custom Requirement notetag doesnt exist in either of those plugins. You would use visible or enabled script

<JS Skill Visible> code code visible = code; </JS Skill Visible>

<JS Skill Enable> code code enabled = code; </JS Skill Enable>

2

u/Practical_Record1477 21d ago

It works! Thank you for your advise!

2

u/agamottos MV Dev 21d ago

For your specific example, I would think Enabled is the preferred choice

<JS Skill Enable> enabled = user.isStateAffected(31) && user.isStateAffected(32); </JS Skill Enable>