Conditional Branch based on item TYPE

I am trying to create a conditional branch branch, via events (preferably) but scripts or plugins will do if needed, that checks to see if a player as an item of a specific type equipped, not a specific item itself. 


For example I want to check if a player has a sword equipped but I have 50 individual swords in the database(assigned as type sword in the database). Since events only let you check individual items and not types, the best solution i could come up with is create a common event brute force checking if i have any swords equipped and setting a switch i could then use to check in other events. 


While this would work i have a hard time believing there isn't a better way to go about this. For starters this would take a ton of time and also is not robust enough to handle changes to the item database should I add or remove swords.


Any help would be appreciated, thanks 🙂
@Voidlust


The default code comes with support for checking whether an actor currently has a weapon of a certain type equipped.


For example, to check if actor 3 has a "sword" type weapon equipped, assuming it's weapon type 1 in your Types database, you can use this condition as a script in your conditional branch:


$gameActors.actor(3).isWtypeEquipped(1)


Which returns true if weapon type 1 is equipped.
Thank you for such a quick response 🙂  I had actually just found this in the rpg_objects.js was going to give it a try I didn't see it on 


https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0


so I didn't realized it existed. 


Exactly what i needed, thank you  😀

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-based-on-item-type.65918/