Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

No Weapon = Can't Attack

I'm looking for a script (or an edit) that will disable the Attack command if the character doesn't have a weapon equipped. I don't want the command to disappear, I just want it to be unselectable, the way a skill is if the character doesn't have enough SP to cast it. Any help is appreciated.

**Edit**
Thanks, that worked great, and was easy to add. I didn't want to reply and bump this back up just to say thanks, so that other people's requests would be able to be seen.
 
Try this:
Code:
class Scene_Battle
  def update_phase3_basic_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Go to command input for previous actor
      phase3_prior_actor
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by actor command window cursor position
      case @actor_command_window.index
      when 0  # attack
        unless @active_battler.weapon_id == 0
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Set action
          @active_battler.current_action.kind = 0
          @active_battler.current_action.basic = 0
          # Start enemy selection
          start_enemy_select

        else
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        end
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 1
        # Start skill selection
        start_skill_select
      when 2  # guard
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        # Go to command input for next actor
        phase3_next_actor
      when 3  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 2
        # Start item selection
        start_item_select
      end
      return
    end
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top