Preventing Unarmed Combat

Status
Not open for further replies.

Redeye

Chronicles Creator
Veteran
Joined
Jun 21, 2013
Messages
441
Reaction score
261
First Language
English
Primarily Uses
I'd like a script that removes that ability to fight with no weapons.

Basically, I want weapons to be not unequipable and only allow the players to change their weapons, so they can't fight with nothing.

Ex. Hero has a Sword and an Axe. Hero can only switch between the two weapons but is unable to unequip his weapon.

Before you say, this CANNOT be done through default. Choosing the "Seal Equip" option makes it so that your weapon can't be changed OR unequiped, which does not help since I have multiple weapons.

If the player chooses the option "Remove All", everything EXCEPT the weapon will be wiped from the slots, too.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I THINK you just need to go through your Window_EquipItem script and change the def include?(item) method to return false on nil item.

So change this:

#-------------------------------------------------------------------------- # * Include in Item List? #-------------------------------------------------------------------------- def include?(item) return true if item == nil return false unless item.is_a?(RPG::EquipItem) return false if @slot_id < 0 return false if item.etype_id != @actor.equip_slots[@slot_id] return @actor.equippable?(item) endto this:
Code:
  #--------------------------------------------------------------------------  # * Include in Item List?  #--------------------------------------------------------------------------  def include?(item)    return false if item == nil # <-- change this line    return false unless item.is_a?(RPG::EquipItem)    return false if @slot_id < 0    return false if item.etype_id != @actor.equip_slots[@slot_id]    return @actor.equippable?(item)  end
Untested, but I think it'll work.
 

Uzuki

Kawaii on the streets, Senpai in the sheets
Veteran
Joined
Aug 18, 2012
Messages
1,933
Reaction score
1,326
First Language
English
Primarily Uses
RMMV
If that doesn't work you can use Yanfly's equip engine. I don't know if it's a bug or it's just me, but once you equip something on a actor they can't be weaponless.
 

Redeye

Chronicles Creator
Veteran
Joined
Jun 21, 2013
Messages
441
Reaction score
261
First Language
English
Primarily Uses
I THINK you just need to go through your Window_EquipItem script and change the def include?(item) method to return false on nil item.

So change this:

#-------------------------------------------------------------------------- # * Include in Item List? #-------------------------------------------------------------------------- def include?(item) return true if item == nil return false unless item.is_a?(RPG::EquipItem) return false if @slot_id < 0 return false if item.etype_id != @actor.equip_slots[@slot_id] return @actor.equippable?(item) endto this:
Code:
  #--------------------------------------------------------------------------  # * Include in Item List?  #--------------------------------------------------------------------------  def include?(item)    return false if item == nil # <-- change this line    return false unless item.is_a?(RPG::EquipItem)    return false if @slot_id < 0    return false if item.etype_id != @actor.equip_slots[@slot_id]    return @actor.equippable?(item)  end
Untested, but I think it'll work.
I did as you said but it still let me unequip my weapon. I'll try Yanfly's script and see if it works.

EDIT: I already have Yanfly's equip engine and I never bothered to look at the customizable options... Whoops. Oh well, I got the problem fixed. Thanks!
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,062
Members
137,575
Latest member
akekaphol101
Top