Kain Nobel
Member
Good day everybody!
Before I post the script in question, I'll give you a quick rundown on what it does. When the player goes to equip nothing for certain actors, instead of equipping nothing they equip a 'dummy' weapon/armor based off of user-defined settings in the UnarmedEquipment module so that they'll still have ATK and PDEF 'n stuff instead of being useless.
I have everything down pact for weapons, but once again I'm having an armor issue, I can't get the armors to change or do anything. When an actor goes to equip no armor, instead of equipping the 'unarmed' armor (or simply equipping nothing), the armor just won't change I'm not sure whats going on with it.
Before I post the script in question, I'll give you a quick rundown on what it does. When the player goes to equip nothing for certain actors, instead of equipping nothing they equip a 'dummy' weapon/armor based off of user-defined settings in the UnarmedEquipment module so that they'll still have ATK and PDEF 'n stuff instead of being useless.
I have everything down pact for weapons, but once again I'm having an armor issue, I can't get the armors to change or do anything. When an actor goes to equip no armor, instead of equipping the 'unarmed' armor (or simply equipping nothing), the armor just won't change I'm not sure whats going on with it.
Code:
#===============================================================================
# ** Unarmed Equipment
#-------------------------------------------------------------------------------
# Written by : Kain Nobel
# Version : 0.0
# Last Update : 11.08.2008
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Equip.UnarmedEquipment', 'Kain Nobel', 0.0, '11.08.2008')
#-------------------------------------------------------------------------------
# * SDK Enabled Test - BEGIN
#-------------------------------------------------------------------------------
if SDK.enabled?('Equip.UnarmedEquipment')
#===============================================================================
# ** UnarmedEquipment
#-------------------------------------------------------------------------------
# This module handles data related to actors "unarmed" equipment settings.
#===============================================================================
module UnarmedEquipment
#-----------------------------------------------------------------------------
# * Weapons = {actor_id => [ [level_range, weapon_id], ...]}
#-----------------------------------------------------------------------------
Weapons = {
# Actor 1 Weapons
1 => [
[(1...4), 33],
[(5...9), 34],
[(10..15), 35]
],
# Actor 2 Weapons
2 => [
[(1...4), 36],
[(5...9), 37],
[(10...15), 38]
]
}
#-----------------------------------------------------------------------------
# * Armors = {actor_id => kind => [ [level_range, armor_id], ...]}
#-----------------------------------------------------------------------------
Armors = {
# Actor 1 Armors
1 => {
# Actor 1 : Shields
1 => [
[(1...4), 1],
[(5...9), 2],
[(10...15), 3]
],
# Actor 1 : Helmets
2 => [
[(1...4), 4],
[(5...9), 5],
[(10...15), 6]
]
},
# Actor 2
2 => {}
}
#-----------------------------------------------------------------------------
# * List of Weapon IDs that should be hidden.
#-----------------------------------------------------------------------------
Hide_Weapon_IDs = [33, 34, 35, 36, 37, 38]
#-----------------------------------------------------------------------------
# * Name used for all hidden Weapons.
#-----------------------------------------------------------------------------
Hide_Weapon_Name = "Nothing Equipped"
#-----------------------------------------------------------------------------
# * Icon used for all hidden Weapons.
#-----------------------------------------------------------------------------
Hide_Weapon_Icon = nil
#-----------------------------------------------------------------------------
# * List of Armor IDs that should be hidden.
#-----------------------------------------------------------------------------
Hide_Armor_IDs = [1, 2, 3]
#-----------------------------------------------------------------------------
# * Name used for all hidden Armors.
#-----------------------------------------------------------------------------
Hide_Armor_Name = "Nothing Equipped"
#-----------------------------------------------------------------------------
# * Icon used for all hidden Armors.
#-----------------------------------------------------------------------------
Hide_Armor_Icon = nil
end
#===============================================================================
# ** RPG::Weapon
#-------------------------------------------------------------------------------
# ...
#===============================================================================
class RPG::Weapon
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :unarmed_equip_rpg_weapon_name, :name
alias_method :unarmed_equip_rpg_weapon_icon, :icon_name
#-----------------------------------------------------------------------------
# * Name
#-----------------------------------------------------------------------------
def name
if UnarmedEquipment::Hide_Weapon_IDs.include?(@id)
if UnarmedEquipment::Hide_Weapon_Name.is_a?(String)
return UnarmedEquipment::Hide_Weapon_Name
end
return ""
end
return unarmed_equip_rpg_weapon_name
end
#-----------------------------------------------------------------------------
# * Icon
#-----------------------------------------------------------------------------
def icon_name
if UnarmedEquipment::Hide_Weapon_IDs.include?(@id)
if UnarmedEquipment::Hide_Weapon_Icon.is_a?(String)
return UnarmedEquipment::Hide_Weapon_Icon
end
return ""
end
return unarmed_equip_rpg_weapon_icon
end
end
#===============================================================================
# ** RPG::Armor
#-------------------------------------------------------------------------------
# ...
#===============================================================================
class RPG::Armor
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :unarmed_equip_rpg_armor_name, :name
alias_method :unarmed_equip_rpg_armor_icon, :icon_name
#-----------------------------------------------------------------------------
# * Name
#-----------------------------------------------------------------------------
def name
if UnarmedEquipment::Hide_Armor_IDs.include?(@id)
if UnarmedEquipment::Hide_Armor_Name.is_a?(String)
return UnarmedEquipment::Hide_Armor_Name
end
return ""
end
return unarmed_equip_rpg_armor_name
end
#-----------------------------------------------------------------------------
# * Icon
#-----------------------------------------------------------------------------
def icon_name
if UnarmedEquipment::Hide_Armor_IDs.include?(@id)
if UnarmedEquipment::Hide_Armor_Icon.is_a?(String)
return UnarmedEquipment::Hide_Armor_Icon
end
return ""
end
return unarmed_equip_rpg_armor_icon
end
end
#===============================================================================
# ** Game_Actor
#-------------------------------------------------------------------------------
# ...
#===============================================================================
class Game_Actor < Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :unarmed_equip_game_actor_equip, :equip
alias_method :unarmed_equip_game_actor_lvlup, :level_up
alias_method :unarmed_equip_game_actor_lvldn, :level_down
#-----------------------------------------------------------------------------
# * Unarmed Weapon
#-----------------------------------------------------------------------------
def unarmed_weapon
return 0 unless UnarmedEquipment::Weapons.has_key?(self.id)
UnarmedEquipment::Weapons[self.id].each do |obj|
if obj[0].is_a?(Range)
if self.level.between?(obj[0].first, obj[0].last)
if obj[1].kind_of?(Numeric)
return obj[1]
end
end
end
end
end
#-----------------------------------------------------------------------------
# * Unarmed Armor
#-----------------------------------------------------------------------------
def unarmed_armor(kind)
return 0 unless UnarmedEquipment::Armors.has_key?(self.id)
return 0 unless UnarmedEquipment::Armors[self.id].has_key?(kind)
UnarmedEquipment::Armors[self.id][kind].each do |obj|
if obj[0].is_a?(Range)
if self.level.between?(obj[0].first, obj[0].last)
if obj[1].kind_of?(Numeric)
return obj[1]
end
end
end
end
end
#-----------------------------------------------------------------------------
# * Unarmed Weapon?
#-----------------------------------------------------------------------------
def unarmed_weapon?
if UnarmedEquipment::Weapons.has_key?(self.id)
UnarmedEquipment::Weapons[self.id].each do |obj|
return true if obj[1] == @weapon_id
end
end
return @weapon_id == 0
end
#-----------------------------------------------------------------------------
# * Equip
#-----------------------------------------------------------------------------
def equip(equip_type, id)
unless id == 0
unarmed_equip_game_actor_equip(equip_type, id)
else
case kind
when 0
unless UnarmedEquipment::Hide_Weapon_IDs.include?(id)
$game_party.gain_weapon(@weapon_id, 1)
end
@weapon_id = unarmed_weapon
when 1
unless UnarmedEquipment::Hide_Armor_IDs.include?(id)
$game_party.gain_armor(@armor1_id, 1)
end
@armor1_id = unarmed_armor(1)
when 2
unless UnarmedEquipment::Hide_Armor_IDs.include?(id)
$game_party.gain_armor(@armor2_id, 1)
end
@armor2_id = unarmed_armor(2)
when 3
unless UnarmedEquipment::Hide_Armor_IDs.include?(id)
$game_party.gain_armor(@armor3_id, 1)
end
@armor3_id = unarmed_armor(3)
when 4
unless UnarmedEquipment::Hide_Armor_IDs.include?(id)
$game_party.gain_armor(@armor4_id, 1)
end
@armor4_id = unarmed_armor(4)
end
end
UnarmedEquipment::Hide_Weapon_IDs.each do |id|
if $game_party.weapon_number(id) > 0
$game_party.lose_weapon(id, 99)
end
end
UnarmedEquipment::Hide_Armor_IDs.each do |id|
if $game_party.armor_number(id) > 0
$game_party.lose_armor(id, 99)
end
end
end
#-----------------------------------------------------------------------------
# * Level Up
#-----------------------------------------------------------------------------
def level_up
unarmed_equip_game_actor_lvlup
if self.unarmed_weapon?
self.equip(0, 0)
end
end
#-----------------------------------------------------------------------------
# * Level Down
#-----------------------------------------------------------------------------
def level_down
unarmed_equip_game_actor_lvldn
if self.unarmed_weapon?
self.equip(0, 0)
end
end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test - END
#-------------------------------------------------------------------------------
end