Prevent closing equip scene if no weapon's equipped? [XP]

Hi, could anyone tell me what do with this?
I wanted to add an " if " to prevent closing the equip menu in case no weapon is equipped.
I guess I should insert some kind of "if no weapon is equipped..." before the $scene = Scene_Menu.new(2) in scene equip, after the Input.trigger?(Input::b), but I don't know how to write it. Is it possible and that easy?
Thanks
Add this small script
Code:
class Scene_Equip
  alias original_update_right update_right
  def update_right
    if Input.trigger?(Input::B)
      if $game_party.actors.any? { |a| a.weapon_id <= 0 }
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    end
    original_update_right
  end
end
OK, it works, but I didn't point out that this should be focused to just one hero's equipment, by bad.
This way, the equipment menu won't close even if another hero in the party doesn't have a weapon!! Should have specified that from the beginning, sorry.
Specifically for one actor? In that case
Code:
class Scene_Equip
  alias original_update_right update_right
  def update_right
    if Input.trigger?(Input::B)
      if $game_actors[1].weapon_id <= 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    end
    original_update_right
  end
end
replace the 1 with whatever the actor ID is.
Specifically for the actor's equip menu opened in that moment!
Something like:
*Open Aluxes Menu -> Can't close if no weap is equipped (ignoring the other actors equipped weap)
*Open Arshes Menu -> Can't close if no weap is equipped (ignoring the other actors equipped weap)

The first script would consider the whole party as one, and that's not it
Also the second script, if I'm not wrong, would consider just one specific actor through the whole game
If you replace $game_actors[1] with @actor in KK20's script you should get the current menu actor instead. However, normally the player can also swap between actors using the L/R-keys, so you would probably have to block that feature too respectively. (I can't see the original scripts right now but I think the actor swap is also handled similarly somewhere in Scene_Equip).

Alternatively you could maybe prevent the player from equipping no weapon in the first place (equipping the selected weapon should also be handled somewhere in Scene_Equip if you search for "Input.trigger?(Input::C)")

Sorry for the vagueness.
The first script would consider the whole party as one, and that's not it
I disagree. It sounds like you do mean everyone. But you referring to only the one your looking at.
You can switch actors while in the scene.

So the question still is do you want to prevent the exit for any actor you are looking at when in the scene.
well, that was dumb of me
I was using a script call to open a specific actor's menu, so it never occured to me that with L/R I could switch actor. Now I also have to prevent that and that complicates everything!!
So, considering all this, what I'm asking is first of all a way to prevent switching the menu, then add this obligatory weapon thing to just two specific actors (that's what I needed in reality, but I didn't want to complicate the situation to you, just actor 2 and actor 6 should have no possibility to equip no weapon, and I stupidly thought I could avoid that by opening a specific hero equip via script call... Turns out I was wrong)
Sorry for the bother!!! You're all very patient, appreciate it
Based on KK20's solution, you could use the following scriptlet:

Ruby:
class Scene_Equip
  EXCLUDE_ACTOR_IDS = [] # Enter as many Actor ID's as needed.
  alias original_update_right update_right
  def update_right
    if Input.trigger?(Input::B) or Input.trigger?(Input::L) or Input.trigger?(Input::R)
      if @actor.weapon_id == 0 and !EXCLUDE_ACTOR_IDS.include?(@actor.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    end
    original_update_right
  end
end

This modified version will take care of L and R buttons as well. It will automatically let the excluded actors leave the scene even if they've got no weapon equipped at all.
Done!! I've also removed the possibility to use L and R during the equip menu, I decided I'm better off without that option!
Thanks a lot to everyone, for real !!

Original thread: https://forums.rpgmakerweb.com/threads/prevent-closing-equip-scene-if-no-weapons-equipped-xp.148312/