MV Finally got dual wield skills properly hidden/visible using Yanfly's Custom Show Eval

Over 2 hours of finding postings that didn't seem to work and tinkering in the console looking at the items in the various slots but I finally have it working smoothly so that dual wield skills ONLY show if the character has a sword in their off hand.


<Custom Show Eval>
if (user.equips()[1] && user.equips()[1].wtypeId == 2) {
visible = true;
} else {
visible = false;
}
</Custom Show Eval>

This takes care of ensuring you don't crash if the off hand is empty since the system doesn't like NULL values in some instances.

The user.equips()[1] checks the second slot ([0] would be the first) and, if something is there then it checks to see if it has a weapon type of 2 which I have as the sword in my database.

Sadly the hours of searching I did came up with a lot of almost similar code snips but they had everything from missing semi colons at the end to underscores in odd places and nothing quite matched up.

I assume other people eventually got it working but never posted the actual working code so I'm doing so here in hopes someone else finds it useful 🙂

Incidentally Maliki79 has a very nice plugin for handling dual wielding and 2 handed weapons that seems to work smoothly with Yanfly's plugins. I placed it below Yanfly's stuff and it seems to like it there.

Original thread: https://forums.rpgmakerweb.com/threads/finally-got-dual-wield-skills-properly-hidden-visible-using-yanflys-custom-show-eval.126826/