TheRiotInside

Extra Ordinaire
Veteran
Joined
Sep 3, 2012
Messages
270
Reaction score
124
First Language
English
Primarily Uses
Hey guys, me again. Back with yet another hopefully simple script request! Thanks to all those who have helped me out so far with other things; hopefully this isn't much trouble to get sorted out.

In a nutshell, I want it to be so that players cannot unequip a weapon. Let me explain. I want you to be able to swap weapons for other weapons and all that, but I want to remove the option to unequip a weapon (leaving you holding nothing). My character starts out with no weapon, but equips one during a cutscene before any battles take place. Basically I want it so that you can only swap weapons for other weapons, and not leave yourself weaponless. From my damage formulas to weapon unleash scripts, the whole system relies on you having a weapon and an ATK stat, so I figured reworking all of those for weaponless situations was much harder than just preventing unequipping in the first place.

Can anyone help out a hopeless scripting neanderthal like myself? It would be greatly appreciated!
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
398
Reaction score
99
First Language
English
Primarily Uses
Hey, me again. lol. So this is actually pretty easy to fix as well.

NOTE: This only prevents the player from unequipping a weapon once they have one. Also, you can still remove weapons via events.

Code:
# Code by Mobius XVI# Requested by TheRiotInside# Prevents players from unequipping weapons once they've equipped oneclass Scene_Equip    #--------------------------------------------------------------------------  # * Frame Update (when item window is active)  #--------------------------------------------------------------------------  def update_item    # If B button was pressed    if Input.trigger?(Input::      # 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 item == nil and @item_window1.visible        # Play buzzer SE        $game_system.se_play($data_system.buzzer_se)      else        # Play equip SE        $game_system.se_play($data_system.equip_se)        # Change equipment        @actor.equip(@right_window.index, item == nil ? 0 : 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  endend # Class end
 

TheRiotInside

Extra Ordinaire
Veteran
Joined
Sep 3, 2012
Messages
270
Reaction score
124
First Language
English
Primarily Uses
This works flawlessly! Thanks for your continued help haha, this is awesome. Wish I had the ability to do little edits and polishing like this, but thankfully there are cool cats like yourself around to pitch in.
 

Latest Threads

Latest Posts

Latest Profile Posts

Too bad the Boss Battle Build Bout isn't also for VXAce.
I might not participate in the Boss Battle contest after all... I have more important things to do, like Wishful Wanda. And of course the Dark Deception spinoff I plan to pitch, Demon Slayer.
Changed my avatar, goodbye Alan Sugar, hello George Carlin (one of my favorite human beings ever)
If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.

Forum statistics

Threads
115,172
Messages
1,087,828
Members
149,726
Latest member
darnitwit
Top