Conditional Branch: Weapon Type

With the engine, it's possible to set a conditional branch in this way: Actor1/Conditional Branch: "Weapon Greatsword of Ely" equipped.
However, this is not what I would need. I would need the conditional branch to work based on a weapon type, instead of a single weapon.

To explain this, it should be like this: Actor1/Conditional Branch: "Weapon type Sword" equipped. Or "Weapon type Axe" equipped.
In this way, the conditional branch would take all the weapons in one type into account.

To make it more clear, I'll explain a certain mechanic in my game. If the player were to use a mace as a weapon and encounters an enemy that uses mace, he would obtain a mace skill after defeating the enemy. However, if the player would use an axe, and his enemy would use a sword for example, no skill would not be learned. This is why I'd need help to solve this problem with the conditional branches.

Here's an example of how the conditional branch would work in the battle event after the player has won. The enemy would have a skill called Smash in this example, and uses a mace.

@Conditional Branch/ Player is [Weapon TYPE Mace equipped] (so this could be any mace instead of a particular weapon)
@Conditional Branch/ Player is [Smash Skill] Learned
@ (nothing)
@Else: Learned the mace skill: [Smash]

It's put like that so that the player can't learn the same skill multiple times. Hopefully my explanation is clear enough... it might contain some mistakes. But this is one of the main mechanics of my game and I would be incredibly thankful if someone could solve this problem.
Use "script" as the branch type and then do

Code:
$gameParty.leader().weapons().some(function(weapon) { return weapon.wtypeId === {number for type you're checking}; });
Thanks, it works perfectly now 🙂
I guess, you both got lost in forum sections? 😀

I read Trihan's answer and think "another JS solution in RGSS section", but than read that it works for the requester, and think "what the fruit? O_O". 😀
Actually, the script I ended up using in the conditional branch was this
$game_actors[ACTOR_ID].weapons.any? { |w| w.wtype_id == YOUR_WEAPON_ID }

It works well in the first battle, where I fight with enemies using maces (I too have a mace in that battle) If I proceed to the second battle with mace-wielding enemies, it still works. However, if I enter a battle with sword- wielding (or any other type) of enemy after the first match, the battle screen suddenly has two invisible enemies with no names. I can just see their health bars (I'm using Yanfly's Enemy Health Bar script). It's like it was duplicating the enemy on the troop which I've checked- there's just one enemy.
Anyone know what's going on? I've tried removing scripts and stuff, but it would seem the culprit is this code somehow. Of course I understand to change the number of YOUR WEAPON id to the one the enemy uses. But it's just duplicating. If I were to fight against 2 enemies after the first match, then there would be 2 invisible enemies in the second fight.

Edit on another thought I tried removing the entire conditional branch with the snippet after battles from the enemies. The duplication thing still persists. So, it's not about that code then?

Edit 2. Ok, it seems that it's working now. I erased the troop events and recreated exactly as they were, and somehow it's just working now. I'll be reporting again if the problem returns.
Dekita's script may be like what you were looking for.

You could try it in case you run into problems again (hopefully not).

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-weapon-type.91726/