Custom Skill Requirements Requiring a Weapon

<Custom Requirement>
value = false;
for (i = 0; i < user._equips.length; i++) {
if (user._equips._dataClass == 'weapon' && user._equips._itemId === 2) {
value = true;
}
}
</Custom Requirement>




Hi there,


I am currently using a variety of plugins, but what I am dealing with currently is Yanfly's Skill Core and Yanfly's Item Core.


As you can see from the code above, I have a skill which requires the actor using it to have the weapon ID #2 in the database to be equipped before the skill is available for use. However, this isn't working as expected due to the weapon the actor has equipped is unique due to Yanfly's Item Core. I may be making the wrong assumption that this is in fact from Yanfly's Item Core causing the issue, but if I were to require the actor have 'armor' #2 equipped instead, the skill would be enabled just fine.


What I need assistance with is figuring out the right course of action here to make it so whenever the actor has the base weapon ID equipped, the skill will be enabled.


I have tried a variety of methods, but I seem to be doing it all wrong. Some assistance would be greatly appreciated.


Thank you
Why don't you simply have the weapon add the skill? then it is only usable if the weapon is equipped.


If it needs to be done level-based by the class list, you could either try to use the level as custom condition instead, that should be easier...
Alternatively, if you're not planning on using this concept often (its doable if you do do it often as well, but a bit messy), you could set up a new weapon type, change the weapon in question to that type, and set that weapon type in the skill's "Required Weapon" section. That should make the skill usable with all the instanced weapons created by Yanfly's plugin.
Why don't you simply have the weapon add the skill? then it is only usable if the weapon is equipped.


If it needs to be done level-based by the class list, you could either try to use the level as custom condition instead, that should be easier...

I have a system in place where characters must use a skill shop to learn skills. The game uses a ranks system of sorts. Items, weapons, skills, armors are all part of this rank system. I want to create a system where you can't use skills of a lower or higher rank if you are not using the same ranked weapons or armor. Though typing this out has made me think, I can probably add a custom execution of sorts on the weapon that turns on a switch or defines a variable which I could then check against with the skill, I believe.

Alternatively, if you're not planning on using this concept often (its doable if you do do it often as well, but a bit messy), you could set up a new weapon type, change the weapon in question to that type, and set that weapon type in the skill's "Required Weapon" section. That should make the skill usable with all the instanced weapons created by Yanfly's plugin.



I like this idea as well. I'll see about doing that.


Thank you both for your replies.
@residntevl


Another alternative would be to use the skill type as rank and have each weapon add the skill type of that rank only, having no skill type added directly to the actor.


That way equipping the weapon will give the rank-skill type and allow the use of those skills only.


That is normally not done because most games would use skills independently of the equipped weapon, but for such a case as you describe it would be the perfect solution (unless there is something else you haven't mentioned yet that prevents this)
That does sound like a good idea. I do use Bobstah's Battle Commands, which would probably mean I have to then define all the STypes into those notetags as well, but if it helps the design it's not a problem.


One thing I tried was to figure out if it were possible to check the baseItemId of the weapon equipped, but that doesn't work except in a regular evented Conditional Branch and I don't believe adding a common event would be helpful due to the amount of weapons that are in the game currently and the ones I am adding.
you might wish to read this extremely old tutorial:




The idea behind that tutorial is a bit different than your setup, but I think it shows how you can use the skilltype/skill combination for other options.
Awesome, this works out. It does however clutter the Skills Menu outside of battle with a bunch of menus per skill, but it's not a big deal.


Time to spend more hours editing the database (and hoping I don't come across a better answer ;o)


Thank you so much for this.
I tried addapting Hime's Skill Type Group script as a plugin... it is MUCH worse than her work, but could be useful to you?


The idea is that a skill from a skill type would also appear in another. This way since I split my skills in many types my main character could still use just two in the battle menu.

Original thread: https://forums.rpgmakerweb.com/threads/custom-skill-requirements-requiring-a-weapon.68713/