Event know if character has no weapon equipped

Hello in a project that I'm working on I'm trying to have it so the NPC runs away if the character is wielding a weapon and stay and chat with the character if they are unarmed. I plan on this being a semi regular occurrence between character and some npc's

It works when I have the character wielding a weapon but it seems there is no way to make a conditional branch Actor/weapon/none is equipped I'm curious if anyone can think of a workaround
Try one of these in Conditional Branch -> Script:

$gameParty.leader().hasNoWeapons()
$gameParty.leader().weapons().length === 0
They should check the same thing, i.e. "does the party leader has 0 weapons equipped?".
Try one of these in Conditional Branch -> Script:

$gameParty.leader().hasNoWeapons()

$gameParty.leader().weapons().length === 0

They should check the same thing, i.e. "does the party leader has 0 weapons equipped?".
The first script did not work for me but the second worked a treat thank you!
Great, happy RPG Making!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/event-know-if-character-has-no-weapon-equipped.144971/