RPG Maker Forums

Hi everyone. Apologies for *another* request, and I'm unsure how difficult it is but here you go.

The script in question that I need an edit of is Kread Ex's Runic Enchantment. With it, you can apply items to weapons to add certain traits to them, and take them off and add them as you want. What I would like is the option, or just default to have the runes *permanently* be applied to a weapon, rather than being able to take them off at all. The script is being used in tandem with another two, Fomar's individual equipment and a patch for that script. Here are the three.

Runic Script -

Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  ▼ Runic Enchantment
#  Author: Kread-EX
#  Version 1.06
#  Release date: 11/03/2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#-------------------------------------------------------------------------------------------------
#  ▼ UPDATES
#-------------------------------------------------------------------------------------------------
# # 02/06/2012. Now lists equipped items.
# # 19/03/2012. Fixed a crashing bug.
# # 17/03/2012. Added the option to limit runes to either the weapon or the
# # armor. Runes can also be set as impossible to double up on the same
# # equipment piece.
# # Also, bugfixes.
#-------------------------------------------------------------------------------------------------
#  ▼ TERMS OF USAGE
#-------------------------------------------------------------------------------------------------
# #  You are free to adapt this work to suit your needs.
# #  You can use this work for commercial purposes if you like it.
# #  Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
# # rpgrevolution.com
#-------------------------------------------------------------------------------------------------
#  ▼ INTRODUCTION
#-------------------------------------------------------------------------------------------------
# # An enchantment system inspired from Dragon's Age. Recommended to use only
# # for unique weapons and armors.
#-------------------------------------------------------------------------------------------------
#  ▼ INSTRUCTIONS
#-------------------------------------------------------------------------------------------------
# # REQUIRES THE TRAITS NAMER:
# # http://grimoirecastle.wordpress.com/rgss3-scripts/core-scripts/traits-namer/
# #
# # Tag enchant-able weapons with <enchant> in their notebox.
# # Modify rune slots with <rune_slots: x>
# #
# # Runes are armors with the <rune> notetag and None as an armor type.
# # <weapon_rune> Limits the rune to a weapon.
# # <armor_rune> Limits the rune to an armor.
# # <unique_rune> Only one of those on the same piece.
# #
# # Use SceneManager.call(Scene_Enchant) to enter the scene or use Yanfly's
# # Ace Menu Engine.
#-------------------------------------------------------------------------------------------------
#  ▼ COMPATIBILITY
#-------------------------------------------------------------------------------------------------
# # List of aliases and overwrites:
# #
# # DataManager
# # load_database (alias)
# # load_sandal_notetags (new method)
# #
# # RPG::EquipItem
# # can_enchant (new attr method)
# # rune_slots (new attr method)
# # rune_type (new attr method)
# # rune_unique (new attr method)
# # load_sandal_notetags (new method)
# # is_rune? (new method)
# # static_rune_params (new method)
# #
# # Game_Actor
# # feature_objects (alias)
# #
# # Game_Party
# # enchants_w (new method)
# # enchants_a (new method)
# # equipped_items (new method)
# #
# # Scene_Enchant (new class)
# # Window_EnchantList (new class)
# # Window_RuneList (new class)
# # Window_ViewRunes (new class)
# # Window_ViewRunesTraits (new class)
#-------------------------------------------------------------------------------------------------

# Quits if the Traits Namer isn't found

if $imported.nil? || $imported['KRX-TraitsNamer'].nil?

msgbox('You need the Traits Namer in order to use Runic Enchantment. Loading aborted.')

else

$imported['KRX-Enchantment'] = true

puts 'Load: Enchantment v1.06 by Kread-EX'

#===========================================================================
# ■ CONFIGURATION
#===========================================================================

module KRX

  # The max rune slots by default.
  RUNE_SLOTS_MAX = 5

  module VOCAB
	# Runes name in menus.
	RUNE_NAME = 'Runes'
	# Runes traits name
	RUNE_TRAITS_NAME = 'Traits'
  end
#===========================================================================
# ■ CONFIGURATION ENDS HERE
#===========================================================================
  module REGEXP
	ALLOW_ENCHANT = /<enchant>/i
	RUNE = /<rune>/i
	RUNE_SLOTS = /<rune_slots:[ ]*(\d+)>/i
	RUNE_WEAPON = /<weapon_rune>/i
	RUNE_ARMOR = /<armor_rune>/i
	RUNE_UNIQUE = /<unique_rune>/i
  end
end

#===========================================================================
# ■ DataManager
#===========================================================================

module DataManager
#--------------------------------------------------------------------------
# ● Loads the database
#--------------------------------------------------------------------------
class << self
alias_method(:krx_sandal_dm_load_database, :load_database)
end
def self.load_database
krx_sandal_dm_load_database
load_sandal_notetags
end  
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def self.load_sandal_notetags
groups = [$data_weapons, $data_armors]
for group in groups
for obj in group
next if obj.nil?
obj.load_sandal_notetags
end
end
puts "Read: Enchantment Notetags"
end
end

#===========================================================================
# ■ RPG::EquipItem
#===========================================================================

class RPG::EquipItem
#--------------------------------------------------------------------------
# ● Public instance variables
#--------------------------------------------------------------------------
  attr_reader   :can_enchant
  attr_reader   :rune_slots
  attr_reader   :rune_type
  attr_reader   :rune_unique
#--------------------------------------------------------------------------
# ● Loads the note tags
#--------------------------------------------------------------------------
def load_sandal_notetags
	@rune_slots = KRX::RUNE_SLOTS_MAX
@note.split(/[\r\n]+/).each do |line|
case line
when KRX::REGEXP::ALLOW_ENCHANT
@can_enchant = true
	  when KRX::REGEXP::RUNE
		@is_rune = true
	  when KRX::REGEXP::RUNE_SLOTS
		@rune_slots = $1.to_i
	  when KRX::REGEXP::RUNE_WEAPON
		@rune_type = :weapon
	  when KRX::REGEXP::RUNE_ARMOR
		@rune_type = :armor
	  when KRX::REGEXP::RUNE_UNIQUE
		@rune_unique = true
end
end
end
#--------------------------------------------------------------------------
# ● Determine if the item is a rune
#--------------------------------------------------------------------------
  def is_rune?
	@is_rune && self.is_a?(RPG::Armor)
  end
end

#===========================================================================
# ■ Game_Actor
#===========================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● Returns the list of traits
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_ga_fo, :feature_objects)
  def feature_objects
	runes = []
	equips.compact.each do |equip|
	  container = equip.is_a?(RPG::Weapon) ? $game_party.enchants_w :
	  $game_party.enchants_a
	  next if container[equip.id].nil?
	  ids = container[equip.id]
	  ids.each do |id|
		next if id.nil?
		runes.push($data_armors[id])
	  end
	end
	krx_sandal_ga_fo + runes.compact
  end
end

#===========================================================================
# ■ Game_Party
#===========================================================================

class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● Returns the items equipped by all actors
#--------------------------------------------------------------------------
  def equipped_items
	result = []
	members.each {|actor| result.push(actor.equips)}
	return result.flatten
  end
#--------------------------------------------------------------------------
# ● Returns weapon enchantments
#--------------------------------------------------------------------------
  def enchants_w
	@enchants_w ||= {}
  end
#--------------------------------------------------------------------------
# ● Returns armor enchantments
#--------------------------------------------------------------------------
  def enchants_a
	@enchants_a ||= {}
  end
#--------------------------------------------------------------------------
# ● Inscribes a rune
#--------------------------------------------------------------------------
  def inscribe_rune(e_type, e_id, r_id, r_index)
	container = e_type == RPG::Weapon ? @enchants_w : @enchants_a
	container[e_id] = [] if container[e_id].nil?
	if container[e_id][r_index] != nil
	  item = $data_armors[container[e_id][r_index]]
	  gain_item(item, 1)
	end
	lose_item($data_armors[r_id], 1) unless r_id.nil?
	container[e_id][r_index] = r_id
  end
end

#==========================================================================
# ■ Window_EnchantList
#==========================================================================

class Window_EnchantList < Window_ItemList
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, w, h)
super(x, y, w, h)
refresh
	select(0)
	activate
end
#--------------------------------------------------------------------------
# ● Enable (always true)
#--------------------------------------------------------------------------
def enable?(item)
item != nil
end
#--------------------------------------------------------------------------
# ● Creates the list based on the recipes
#--------------------------------------------------------------------------
def make_item_list
@data = []
	($game_party.all_items + $game_party.equipped_items).each do |itm|
	  next if @data.include?(itm)
	  @data.push(itm) if itm.is_a?(RPG::EquipItem) && itm.can_enchant
	end
end
  #--------------------------------------------------------------------------
  # ● Displays the item
  #--------------------------------------------------------------------------
  def draw_item(index)
	item = @data[index]
	if item
	  rect = item_rect(index)
	  rect.width -= 4
	  draw_item_name(item, rect.x, rect.y, enable?(item))
	end
  end
#--------------------------------------------------------------------------
# ● Returns the number of columns
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Assigns a rune window
#--------------------------------------------------------------------------
def rune_window=(value)
@rune_window = value
end
#--------------------------------------------------------------------------
# ● Refreshes the help and rune windows
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@rune_window.set_item(item) unless @rune_window.nil?
end
end

#==========================================================================
# ■ Window_RuneList
#==========================================================================

class Window_RuneList < Window_ItemList
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, w, h)
super(x, y, w, h)
refresh
	select(0)
	hide
end
#--------------------------------------------------------------------------
# ● Enable
#--------------------------------------------------------------------------
def enable?(item)
	return true if item.nil?
	if item.rune_unique
	  ti = SceneManager.scene.target_item
	  container = ti.class == RPG::Weapon ? $game_party.enchants_w :
	  $game_party.enchants_a
	  slots = container[ti.id]
	  return !slots.include?(item.id)
	end
	if item.rune_type == :weapon
	  return SceneManager.scene.target_item.class == RPG::Weapon
	elsif item.rune_type == :armor
	  return SceneManager.scene.target_item.class == RPG::Armor
	end
return true
end
#--------------------------------------------------------------------------
# ● Creates the list based on the recipes
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select do |itm|
	  itm.is_a?(RPG::EquipItem) && itm.is_rune?
	end
	@data.insert(0, nil)
end
#--------------------------------------------------------------------------
# ● Returns the number of columns
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● Assigns a traits window
#--------------------------------------------------------------------------
def traits_window=(value)
@traits_window = value
end
  #--------------------------------------------------------------------------
  # ● Updates the help window
  #--------------------------------------------------------------------------
  def update_help
	@help_window.set_item(item) unless @help_window.nil?
	@traits_window.set_item(item) unless @traits_window.nil?
  end
end

#==========================================================================
# ■ Window_ViewRunes
#==========================================================================

class Window_ViewRunes < Window_Selectable
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
set_item
end
#--------------------------------------------------------------------------
# ● Refresh the contents
#--------------------------------------------------------------------------
def set_item(item = nil)
contents.clear
return if item.nil?
	container = item.is_a?(RPG::Weapon) ? $game_party.enchants_w :
	$game_party.enchants_a
	container[item.id] = [] if container[item.id].nil?
	@data = container[item.id]
	filler = item.rune_slots - @data.size
	filler.times {@data.push(nil)} if filler > 0
draw_item_runes(item)
end
#--------------------------------------------------------------------------
# ● Returns the selected rune
#--------------------------------------------------------------------------
  def get_item
	$data_armors[@data[index]]
  end
#--------------------------------------------------------------------------
# ● Displays the item's runes
#--------------------------------------------------------------------------
def draw_item_runes(item)
	# Draws the sys text
change_color(system_color)
contents.draw_text(4, 0, width, line_height, KRX::VOCAB::RUNE_NAME)
change_color(normal_color)
(1..item.rune_slots).each do |i|
	  contents.draw_text(4, line_height * i, width, line_height, "#{i}.")
	end
	# Draws the runes
@data.each_index do |i|
	  next if @data[i].nil?
rune = $data_armors[@data[i]]
	  draw_item_name(rune, 28, line_height * (i + 1), true, width - 24)
end
end
#--------------------------------------------------------------------------
# ● Returns the number of columns
#--------------------------------------------------------------------------
def col_max
return 1
end
  #--------------------------------------------------------------------------
  # ● Returns the max number of rows
  #--------------------------------------------------------------------------
  def item_max
	@data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # ● Sets the rectangle for selections
  #--------------------------------------------------------------------------
  def item_rect(index)
	rect = Rect.new
	rect.width = item_width
	rect.height = item_height
	rect.x = index % col_max * (item_width + spacing)
	rect.y = (index / col_max * item_height) + line_height
	rect
  end
#--------------------------------------------------------------------------
# ● Assigns a traits window
#--------------------------------------------------------------------------
def traits_window=(value)
@traits_window = value
end
  #--------------------------------------------------------------------------
  # ● Updates the help window
  #--------------------------------------------------------------------------
  def update_help
	unless @help_window.nil?
	  itm = @data[index].nil? ? nil : get_item
	  @help_window.set_item(itm)
	end
	@traits_window.set_item(@data[index]) unless @traits_window.nil?
  end
end

#==========================================================================
# ■ Window_ViewRunesTraits
#==========================================================================

class Window_ViewRunesTraits < Window_Base
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
set_item
end
#--------------------------------------------------------------------------
# ● Refresh the contents
#--------------------------------------------------------------------------
def set_item(item = nil)
contents.clear
return if item.nil?
	item = $data_armors[item] if item.is_a?(Integer)
	draw_rune_traits(item)
end
#--------------------------------------------------------------------------
# ● Displays the rune's traits
#--------------------------------------------------------------------------
def draw_rune_traits(item)
	# Draws the sys text
change_color(system_color)
contents.draw_text(4, 0, width, line_height, KRX::VOCAB::RUNE_TRAITS_NAME)
change_color(normal_color)
	# Draws the traits
item.features.each_index do |i|
	  f = item.features[i]
	  name = KRX::TraitsNamer.feature_name(f.code, f.data_id, f.value)
	  contents.draw_text(4, line_height * (i + 1), width - 24, line_height, name)
end
end
end

#==========================================================================
# ■ Scene_Enchant
#==========================================================================

class Scene_Enchant < Scene_ItemBase
#--------------------------------------------------------------------------
# ● Scene start
#--------------------------------------------------------------------------
def start
	super
	create_help_window
	create_traits_window
	create_rune_window
	create_enchant_window
	create_runelist_window
  end
#--------------------------------------------------------------------------
# ● Creates the window showing the rune's traits
#--------------------------------------------------------------------------
  def create_traits_window
	wx = ww = Graphics.width / 2
	wh = (Graphics.height - @help_window.height) / 2
	wy = Graphics.height - wh
	@traits_window = Window_ViewRunesTraits.new(wx, wy, ww, wh)
  end
#--------------------------------------------------------------------------
# ● Creates the window showing the current rune set
#--------------------------------------------------------------------------
  def create_rune_window
	wy = @help_window.height
	wx = ww = Graphics.width / 2
	wh = (Graphics.height - wy) / 2
	@rune_window = Window_ViewRunes.new(wx, wy, ww, wh)
	@rune_window.help_window = @help_window
	@rune_window.traits_window = @traits_window
	@rune_window.set_handler(:ok, method(:on_slot_ok))
	@rune_window.set_handler(:cancel, method(:on_slot_cancel))
  end
#--------------------------------------------------------------------------
# ● Creates the window listing the enchantable equipment
#--------------------------------------------------------------------------
  def create_enchant_window
	wy = @help_window.height
	ww = Graphics.width / 2
	wh = Graphics.height - wy
	@enchant_window = Window_EnchantList.new(0, wy, ww, wh)
	@enchant_window.set_handler(:ok, method(:on_item_ok))
	@enchant_window.set_handler(:cancel, method(:return_scene))
	@enchant_window.help_window = @help_window
	@enchant_window.rune_window = @rune_window
	@enchant_window.update_help
  end
#--------------------------------------------------------------------------
# ● Creates the window listing the available runes
#--------------------------------------------------------------------------
  def create_runelist_window
	wy = @help_window.height
	ww = Graphics.width / 2
	wh = Graphics.height - wy
	@runelist_window = Window_RuneList.new(0, wy, ww, wh)
	@runelist_window.help_window = @help_window
	@runelist_window.traits_window = @traits_window
	@runelist_window.set_handler(:ok, method(:on_rune_ok))
	@runelist_window.set_handler(:cancel, method(:on_rune_cancel))
  end
#--------------------------------------------------------------------------
# ● Validates the item selection
#--------------------------------------------------------------------------
  def on_item_ok
	@enchant_window.deactivate
	@rune_window.select(0)
	@rune_window.activate
  end
#--------------------------------------------------------------------------
# ● Validates the rune slot selection
#--------------------------------------------------------------------------
  def on_slot_ok
	@rune_window.deactivate
	@enchant_window.hide
	@runelist_window.show.select(0)
	@runelist_window.activate
  end
#--------------------------------------------------------------------------
# ● Cancels the rune slot selection
#--------------------------------------------------------------------------
  def on_slot_cancel
	@rune_window.unselect
	@enchant_window.select_last
	@enchant_window.activate
	@traits_window.set_item(nil)
  end
#--------------------------------------------------------------------------
# ● Validates the rune selection
#--------------------------------------------------------------------------
  def on_rune_ok
	e_type = @enchant_window.item.class
	e_id = @enchant_window.item.id
	r_index = @rune_window.index
	r_id = @runelist_window.item != nil ? @runelist_window.item.id : nil
	$game_party.inscribe_rune(e_type, e_id, r_id, r_index)
	@rune_window.set_item(@enchant_window.item)
	@rune_window.activate
	@runelist_window.hide.refresh
	@runelist_window.unselect
	@enchant_window.show
  end
#--------------------------------------------------------------------------
# ● Cancels the rune selection
#--------------------------------------------------------------------------
  def on_rune_cancel
	@rune_window.activate
	@runelist_window.hide.unselect
	@runelist_window.deactivate
	@enchant_window.show
  end
#--------------------------------------------------------------------------
# ● Returns the target item
#--------------------------------------------------------------------------
  def target_item
	@enchant_window.item
  end
end

## Menu inclusion, with Yanfly's Ace Menu Engine
if $imported["YEA-AceMenuEngine"]

#==========================================================================
#  ■ Scene_Menu
#==========================================================================

class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● Switch to the enchant scene
#--------------------------------------------------------------------------
def command_enchant
	SceneManager.call(Scene_Enchant)
  end
end

end ## End of Yanfly's Menu inclusion

end ## End of Traits Namer's check.
Individual Equip -

Code:
=begin
Individual Equipment
by Fomar0153
Version 1.1
----------------------
Notes
----------------------
This script changes the way weapons and armours are handled
in game. This script make every weapon and armour unique.
----------------------
Instructions
----------------------
Plug and play.
If you want to be able to carry more than 150 weapons and 150 armors
edit MAX_INVENTORY_SIZE which you can find at the top of the script.
This script is designed to be a base for other scripts.
For example:
Proper Weapon and Armour Customisation.
----------------------
Change Log
----------------------
1.0 -> 1.1 Added a single character (@) to fix a bug where you
		   created new equipment when changing equipment.
----------------------
Known bugs
----------------------
None
=end

module CustomEquip

  MAX_INVENTORY_SIZE = 150

end

class Game_CustomEquip < Game_BaseItem
  #--------------------------------------------------------------------------
  # ● New attr_accessor & attr_reader
  #--------------------------------------------------------------------------
  attr_accessor :pos
  attr_reader   :item_id
  #--------------------------------------------------------------------------
  # ● Pos is used to identify weapons and armors
  #--------------------------------------------------------------------------
  def initialize
	super
	@pos = 0
  end
  #--------------------------------------------------------------------------
  # ● The rest of the methods allow this item to pretend to be RPG::Weapon
  #   and RPG::Armor in some cases, increasing compatability, thought not
  #   as much as I would like.
  #--------------------------------------------------------------------------
  def description
	return nil if is_nil?
	return object.description
  end

  def name
	return nil if is_nil?
	return object.name
  end

  def icon_index
	return nil if is_nil?
	return object.icon_index
  end

  def price
	return nil if is_nil?
	return object.price
  end

  def animation_id
	return nil if is_nil?
	return nil if is_armor? # variable only exists for RPG::Weapon
	return object.animation_id
  end

  def note
	return nil if is_nil?
	return object.note
  end

  def id
	return nil if is_nil?
	return object.id
  end

  def features
	return nil if is_nil?
	return object.features
  end

  def params
	return nil if is_nil?
	return object.params
  end

  def etype_id
	return nil if is_nil?
	return object.etype_id
  end

  def wtype_id
	return nil if is_nil?
	return nil if is_armor? # variable only exists for RPG::Weapon
	return object.wtype_id
  end

  def atype_id
	return nil if is_nil?
	return nil if is_weapon? # variable only exists for RPG::Armor
	return object.atype_id
  end


  # performance returns an integer calculated from the equip item's params.
  # each point in a param increasing performance by one, except
  # for attack and magic on weapon which counts double
  # for defence and magic defence on armours which counts double
  def performance
	return nil if is_nil?
	return object.performance
  end

end

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ● Aliases init_all_items
  #--------------------------------------------------------------------------
  alias ie_init_all_items init_all_items
  def init_all_items
	ie_init_all_items
	@weapons = []
	@armors = []
  end
  #--------------------------------------------------------------------------
  # ● Rewrites weapons
  #--------------------------------------------------------------------------
  def weapons
	return @weapons
  end
  #--------------------------------------------------------------------------
  # ● Rewrites armors
  #--------------------------------------------------------------------------
  def armors
	return @armors
  end
  #--------------------------------------------------------------------------
  # ● Aliases item_number + Probably rewrite
  #--------------------------------------------------------------------------
  alias ie_item_number item_number
  def item_number(item)
	if item.class == RPG::Weapon or item.class == RPG::Armor
	  return 1 # I haven't found this to cause unexpected behaviour
			   # but I don't like it
	else
	  return ie_item_number(item)
	end
  end
  #--------------------------------------------------------------------------
  # ● Aliases gain_item
  #--------------------------------------------------------------------------
  alias ie_gain_item gain_item
  def gain_item(item, amount, include_equip = false)
	if item.class == RPG::Weapon
	  if amount > 0
		for i in 1..amount
		  t = Game_CustomEquip.new
		  t.object = item
		  @weapons.push(t)
		end
		weapon_sort
	  end
	elsif item.is_a?(Game_CustomEquip) && item.is_weapon?
	  if amount == 1
		@weapons.push(item)
		weapon_sort
	  elsif amount == -1
		# Can't sell more than 1 at a time
		# (is there any other way to remove more than 1 at a time?
		# except through events?)
		@weapons.delete_at(item.pos)
		weapon_sort
	  end
	elsif item.class == RPG::Armor
	  if amount > 0
		for i in 1..amount
		  t = Game_CustomEquip.new
		  t.object = item
		  @armors.push(t)
		end
		armor_sort
	  end
	elsif item.is_a?(Game_CustomEquip) && item.is_armor?
	  if amount == 1
		@armors.push(item)
		armor_sort
	  elsif amount == -1
		# Can't sell more than 1 at a time
		# (is there any other way to remove more than 1 at a time?
		# except through events?)
		@armors.delete_at(item.pos)
		armor_sort
	  end
	else
	  ie_gain_item(item, amount, include_equip)
	  return
	end
	$game_map.need_refresh = true
  end

  def weapon_sort
	@weapons.sort! { |a, b|  a.item_id <=> b.item_id }
	for i in 0..@weapons.size - 1
	  @weapons[i].pos = i
	end
  end

  def armor_sort
	@armors.sort! { |a, b|  a.item_id <=> b.item_id }
	for i in 0..@armors.size - 1
	  @armors[i].pos = i
	end
  end

  alias ie_max_item_number max_item_number
  def max_item_number(item)
	if item.class == RPG::Weapon
	  return CustomEquip::MAX_INVENTORY_SIZE - @weapons.size
	elsif item.class == RPG::Armor
	  return CustomEquip::MAX_INVENTORY_SIZE - @armors.size
	else
	  return ie_max_item_number(item)
	end
  end
end

class Window_ItemList < Window_Selectable

  alias ie_include? include?
  def include?(item)
	case @category
	when :weapon
	  item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Weapon)
	when :armor
	  item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Armor)
	else
	  ie_include?(item)
	end
  end

  alias ie_draw_item draw_item
  def draw_item(index)
	item = @data[index]
	if item && !item.is_a?(Game_CustomEquip)
	  ie_draw_item(index)
	elsif item && item.is_a?(Game_CustomEquip)
	  rect = item_rect(index)
	  rect.width -= 4
	  draw_item_name(item, rect.x, rect.y, enable?(item))
	  #draw_item_number(rect, item) just this line removed from the default
	end
  end

end


class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● Aliases include?
  #--------------------------------------------------------------------------
  alias ie2_include? include?
  def include?(item)
	return true if item == nil
	return false unless item.is_a?(Game_CustomEquip)
	return ie2_include?(item.object)
  end
  #--------------------------------------------------------------------------
  # ● Rewrites update_help
  #--------------------------------------------------------------------------
  def update_help
	super
	if @actor && @status_window
	  temp_actor = Marshal.load(Marshal.dump(@actor))
	  temp_actor.force_change_equip(@slot_id, item) unless item.nil?
	  @status_window.set_temp_actor(temp_actor)
	end
  end
end


class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● Rewrites init_equips
  #--------------------------------------------------------------------------
  def init_equips(equips)
	@equips = Array.new(equip_slots.size) { Game_CustomEquip.new } # only change
	equips.each_with_index do |item_id, i|
	  etype_id = index_to_etype_id(i)
	  slot_id = empty_slot(etype_id)
	  @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
	end
	refresh
  end
  #--------------------------------------------------------------------------
  # ● Rewrites change_equip
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
	return unless trade_item_with_party(item, @equips[slot_id])
	return if item && equip_slots[slot_id] != item.etype_id
	if item.nil?
	  @equips[slot_id] = Game_CustomEquip.new
	else
	  @equips[slot_id] = item
	end
	refresh
  end
  #--------------------------------------------------------------------------
  # ● Rewrites force_change_equip
  #--------------------------------------------------------------------------
  def force_change_equip(slot_id, item)
	if item.nil?
	  @equips[slot_id] = Game_CustomEquip.new
	else
	  @equips[slot_id] = item
	end
	release_unequippable_items(false)
	refresh
  end
  #--------------------------------------------------------------------------
  # ● Rewrites trade_item_with_party
  #--------------------------------------------------------------------------
  def trade_item_with_party(new_item, old_item)
	#return false if new_item && !$game_party.has_item?(new_item) removed
	$game_party.gain_item(old_item, 1)
	$game_party.lose_item(new_item, 1)
	return true
  end
  #--------------------------------------------------------------------------
  # ● Rewrites change_equip_by_id
  #--------------------------------------------------------------------------
  def change_equip_by_id(slot_id, item_id)
	if equip_slots[slot_id] == 0
	  t = Game_CustomEquip.new
	  t.object = $data_weapons[item_id]
	  $game_party.gain_item(t, 1)
	  change_equip(slot_id, t)
	else
	  t = Game_CustomEquip.new
	  t.object = $data_armors[item_id]
	  $game_party.gain_item(t, 1)
	  change_equip(slot_id, t)
	end
  end
  #--------------------------------------------------------------------------
  # ● Rewrites optimize_equipments or does it
  #--------------------------------------------------------------------------
  def optimize_equipments
	clear_equipments
	equip_slots.size.times do |i|
	  next if !equip_change_ok?(i)
	  items = $game_party.equip_items.select do |item|
		item.etype_id == equip_slots[i] &&
		equippable?(item.object) && item.performance >= 0
	  end
	  change_equip(i, items.max_by {|item| item.performance })
	end
  end
end


class Window_ShopStatus < Window_Base

  alias ie_draw_possession draw_possession
  def draw_possession(x, y)
	return if @item.is_a?(RPG::EquipItem)
	ie_draw_possession(x, y)
  end

  alias ie_draw_equip_info draw_equip_info
  def draw_equip_info(x, y)
	ie_draw_equip_info(x, y - line_height * 2)
  end
end
Individual Equipment Patch -

Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  ▼ Runic Enchantment - Individual Equipment Patch
#  Author: Kread-EX
#  Version 1.01
#  Release date: 17/03/2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#-------------------------------------------------------------------------------------------------
#  ▼ UPDATES
#-------------------------------------------------------------------------------------------------
# # 02/06/2012. Now lists equipped items.
#-------------------------------------------------------------------------------------------------
#  ▼ TERMS OF USAGE
#-------------------------------------------------------------------------------------------------
# #  You are free to adapt this work to suit your needs.
# #  You can use this work for commercial purposes if you like it.
# #  Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.net
# # rpgrevolution.com
#-------------------------------------------------------------------------------------------------
#  ▼ INTRODUCTION
#-------------------------------------------------------------------------------------------------
# # Allows compatibility with Fomar0153' Individual Equipment. ITT: all equipment
# # pieces are unique.
#-------------------------------------------------------------------------------------------------
#  ▼ COMPATIBILITY
#-------------------------------------------------------------------------------------------------
# # Put this script below both Individual Equipment and Runic Enchantment.
# #
# # Due to the nature of Fomar's script, despite his best efforts, this will
# # most likely clash with other scripts, so compatibility is overall low.
#-------------------------------------------------------------------------------------------------

if $imported.nil? || $imported['KRX-Enchantment'].nil?

msgbox('You need Runic Enchantment for this patch. Loading aborted.')

elsif not defined?(Game_CustomEquip)

msgbox('You need Individual Equipment for this patch. Loading aborted.')

else

#==========================================================================
# ■ Game_CustomEquip
#==========================================================================

class Game_CustomEquip < Game_BaseItem
#--------------------------------------------------------------------------
# ● Class variables
#--------------------------------------------------------------------------
  @@count = 0
#--------------------------------------------------------------------------
# ● Public instance variables
#--------------------------------------------------------------------------
  attr_reader   :unique_id
#--------------------------------------------------------------------------
# ● Object Initialize
#--------------------------------------------------------------------------  
  alias_method(:krx_sandal_gce_init, :initialize)
  def initialize
	krx_sandal_gce_init
	hash = 'sandal'.hash
	@unique_id = hash + @@count
	@@count += 1
  end
#--------------------------------------------------------------------------
# ● Determine if the item can be enchanted
#--------------------------------------------------------------------------
  def can_enchant
	object.is_a?(RPG::EquipItem) && object.can_enchant
  end
#--------------------------------------------------------------------------
# ● Determine the number of rune slots
#--------------------------------------------------------------------------
  def rune_slots
	object.is_a?(RPG::EquipItem) ? object.rune_slots : 0
  end
#--------------------------------------------------------------------------
# ● Determine if the item is a rune
#--------------------------------------------------------------------------
  def is_rune?
	object.is_rune?
  end
end

#==========================================================================
# ■ Window_EnchantList
#==========================================================================

class Window_EnchantList < Window_ItemList
#--------------------------------------------------------------------------
# ● Creates the list based on the recipes
#--------------------------------------------------------------------------
def make_item_list
@data = []
	($game_party.all_items + $game_party.equipped_items).each do |itm|
	  @data.push(itm) if itm.is_a?(Game_CustomEquip) && itm.can_enchant
	end
end
end

#==========================================================================
# ■ Window_RuneList
#==========================================================================

class Window_RuneList < Window_ItemList
#--------------------------------------------------------------------------
# ● Enable
#--------------------------------------------------------------------------
def enable?(item)
	return true if item.nil?
	if item.rune_unique
	  ti = SceneManager.scene.target_item
	  container = ti.object.class == RPG::Weapon ? $game_party.enchants_w :
	  $game_party.enchants_a
	  slots = container[ti.unique_id] || []
	  return !slots.include?(item.id)
	end
	if item.rune_type == :weapon
	  return SceneManager.scene.target_item.object.class == RPG::Weapon
	elsif item.rune_type == :armor
	  return SceneManager.scene.target_item.object.class == RPG::Armor
	end
return true
end
end

#==========================================================================
# ■ Window_ViewRunes
#==========================================================================

class Window_ViewRunes < Window_Selectable
#--------------------------------------------------------------------------
# ● Refresh the contents
#--------------------------------------------------------------------------
def set_item(item = nil)
contents.clear
return if item.nil?
	container = item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Weapon) ?
	$game_party.enchants_w : $game_party.enchants_a
	container[item.unique_id] = [] if container[item.unique_id].nil?
	@data = container[item.unique_id]
	filler = item.rune_slots - @data.size
	filler.times {@data.push(nil)} if filler > 0
draw_item_runes(item)
end
end

#==========================================================================
# ■ Scene_Enchant
#==========================================================================

class Scene_Enchant < Scene_ItemBase
#--------------------------------------------------------------------------
# ● Validates the rune selection
#--------------------------------------------------------------------------
  def on_rune_ok
	e_type = @enchant_window.item.object.class
	e_id = @enchant_window.item.unique_id
	r_index = @rune_window.index
	r_id = @runelist_window.item != nil ? @runelist_window.item.id : nil
	$game_party.inscribe_rune(e_type, e_id, r_id, r_index)
	@rune_window.set_item(@enchant_window.item)
	@rune_window.activate
	@runelist_window.hide.refresh
	@runelist_window.unselect
	@enchant_window.show
  end
end

#===========================================================================
# ■ Game_Party
#===========================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ● Initializes all items
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_gp_iai, :init_all_items)
  def init_all_items
	krx_sandal_patch_gp_iai
	@runes = {}
  end
#--------------------------------------------------------------------------
# ● Returns the items equipped by all actors
#--------------------------------------------------------------------------
  def equipped_items
	result = []
	members.each {|actor| result.push(actor.custom_equips)}
	return result.flatten
  end
#--------------------------------------------------------------------------
# ● Inscribes a rune
#--------------------------------------------------------------------------
  def inscribe_rune(e_type, e_id, r_id, r_index)
	container = e_type == RPG::Weapon ? @enchants_w : @enchants_a
	container[e_id] = [] if container[e_id].nil?
	if container[e_id][r_index] != nil
	  item = $data_armors[container[e_id][r_index]]
	  gain_item(item, 1)
	end
	lose_item($data_armors[r_id], 1) unless r_id.nil?
	container[e_id][r_index] = r_id
  end
  #--------------------------------------------------------------------------
  # ● Adds an item
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_gp_gi, :gain_item)
  def gain_item(item, amount, include_equip = false)
	if item.is_a?(RPG::Armor) && item.is_rune?
	  last_number = item_number(item)
	  new_number = last_number + amount
	  @runes[item.id] = [[new_number, 0].max, max_item_number(item)].min
	  @runes.delete(item.id) if @runes[item.id] == 0
	  return
	end
	krx_sandal_patch_gp_gi(item, amount, include_equip)
  end
  #--------------------------------------------------------------------------
  # ● Determine the possessed number of items
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_gp_in, :item_number)
  def item_number(item)
	if item.is_a?(RPG::Armor) && item.is_rune?
	  return @runes[item.id] ? @runes[item.id] || 0 : 0
	end
	krx_sandal_patch_gp_in(item)
  end
  #--------------------------------------------------------------------------
  # ● Determine the maximum number of items (Fomar's method)
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_gp_min, :max_item_number)
  def max_item_number(item)
	if item.is_a?(RPG::Armor) && item.is_rune?
	  return 99
	end
	krx_sandal_patch_gp_min(item)
  end
  #--------------------------------------------------------------------------
  # ● Returns the runes
  #--------------------------------------------------------------------------
  def runes
	@runes.keys.sort.collect {|id| $data_armors[id] }
  end
  #--------------------------------------------------------------------------
  # ● Returns all possessed items
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_gp_ai, :all_items)
  def all_items
	krx_sandal_patch_gp_ai + runes
  end
end

#===========================================================================
# ■ Window_ItemList
#===========================================================================

class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● Determine if an item goes in the list
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_wil_include?, :include?)
  def include?(item)
	case @category
	when :weapon
	  item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Weapon)
	when :armor
	  (item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Armor)) ||
	  (item.is_a?(RPG::Armor) && item.is_rune?)
	else
	  krx_sandal_patch_wil_include?(item)
	end
  end
end

#===========================================================================
# ■ Game_Actor
#===========================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● Returns the list of unique equipment
  #--------------------------------------------------------------------------
  def custom_equips
	@equips
  end
  #--------------------------------------------------------------------------
  # ● Returns the list of traits
  #--------------------------------------------------------------------------
  def feature_objects
	runes = []
	@equips.compact.each do |equip|
	  container = equip.object.is_a?(RPG::Weapon) ? $game_party.enchants_w :
	  $game_party.enchants_a
	  next if container[equip.unique_id].nil?
	  ids = container[equip.unique_id]
	  ids.each do |id|
		next if id.nil?
		runes.push($data_armors[id])
	  end
	end
	krx_sandal_ga_fo + runes.compact
  end
  #--------------------------------------------------------------------------
  # ● Determine if an item can be equipped
  #--------------------------------------------------------------------------
  alias_method(:krx_sandal_patch_ga_equippable?, :equippable?)
  def equippable?(item)
	if item.is_a?(Game_CustomEquip)
	  return equip_wtype_ok?(item.wtype_id) if item.object.is_a?(RPG::Weapon)
	  return equip_atype_ok?(item.atype_id) if item.object.is_a?(RPG::Armor)
	end
	krx_sandal_patch_ga_equippable?(item)
  end
end

end
Thank you very much in advance.

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,587
Latest member
Usagiis
Top