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.

I want to stop people from being able to remove equipment.

Ok so, I'm just wondering is there anyway in the scripting (or any other way) to make it so you cannot remove your equiptment, like if you start with a shield you HAVE to either keep that shield on or switch it with another? And this applys for all equipment.
 

khmp

Sponsor

When choosing a topic icon for a support topic please use either XP or the VX icons. We assume the topic is for help so it's kind of redundant and uninformative to use the generic "Help" icon. Although very much fitting to the situation. It's ambiguous. Using either of the VX/XP icons enables us to immediately start to think or work on a solution to your problem. I apologize for harping on you about it because it isn't just you. You just happened to not make mention of which program you were using as well as the lack of the icon. :wink:

Anyway... Do you mean to ask how to remove the ability to un-equip equipment? Not necessarily lock the user to one piece of equipment but prevent them from running around unarmed, unclothed etc. Am I understanding that correctly? And of course, is this for XP or VX?
 
Assuming it's for XP, in the Database->Actors section, you can select starting equipment. Beside it, there's a checkbox called "Fixed", which might be what you're asking.

That option's probably in VX, too, but I'm not really sure.
 
Okay to "Khmp", thank you and I will remember that in the future. This is for XP, and to both of you no I am not a COMPLETE noob at this and I know how to fix their equipment, but like "Khmp" said I want to stop them from being able to run around unarmed (clothed).

Ps. I'll change that help thing to the XP sign
 

khmp

Sponsor

Alright this is actually pretty simple to do. Mainly because we only need to visit one class and change one method. The class being Scene_Equip and the method being update_item. We need to alter what happens inside the if statement testing for the C button. The first thing we'll do within the if statement is get the item. There's already a line that does this below just cut it and place it right below the if line. Whether or not the item exists is very important. Now on the next line below the item gathering line we need to test its validity. If it's not existent or nil then we return. No need to continue if there isn't an item. We can also change the actor equip line and remove the ternary operation and just slap in the item id after all the item must exist if we reached this far yes?

The below code is the demonstration of what is described above. For script installation instructions refer to the RGSS FAQ.
Code:
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs equipment screen processing.
#==============================================================================

class Scene_Equip
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)                    !OVERRIDE!
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      item = @item_window.item

      # If the item doesn't exist, meaning trying to unequip, return.
      return if item.nil?

      # Play equip SE
      $game_system.se_play($data_system.equip_se)

      # Change equipment
      @actor.equip(@right_window.index, item.id)

      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      # Remake right window and item window contents
      @right_window.refresh
      @item_window.refresh
      return
    end
  end
end

Good luck with it Chrome Dragon! :thumb:
 

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