iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Advanced Equip System, new equipment system with addons
sparkyg13
post Feb 16 2012, 05:37 AM
Post #1


x^2
Group Icon


Type: Coder
Alignment: Unaligned




Advanced Equip V0.2
by: sparkyg13



Introduction
This script greatly modifies the current equipment system and allows for specific addons (ie durablility)

Features
- arrayed equipment database keeps track of all items gained, loss, or used
- Items have individual variations that allow specific item coding

Screenshots

none atm

How to Use
place above main, place addons below

Script
CODE
#===============================================================================
# [SPG] Equipment System
# by: sparkyg13
#-------------------------------------------------------------------------------
# a basic script that alters most equipment functions.
# this script is required for most SPG equipment altering scripts.
#===============================================================================

#===============================================================================
# IMPORT
#-------------------------------------------------------------------------------
$imported ||= {}
$imported["SPG:EquipSystem"] = true
#===============================================================================
module SPG; module EquipSystem

UNSTACKABLE = {

# you can make an Array ( [] ) of item ids to specify individual item ids
# or you can specify a true or false value to make all items of that type
# stackable / unstackable
# true = cannot stack / false = can stack / [2, 3, ...] cannot stack ids 2 or 3
'items' => false,
'weapons' => true,
'armors' => true,
}

end; end
#===============================================================================
# RPG::BaseItem
#===============================================================================
class RPG::BaseItem

def variation
return @variation.nil? ? -1 : @variation
end

def variation=(v)
@variation = v
end

def unsigned?
return self.variation == -1
end

end
#===============================================================================
# Game_StoredItemData
#===============================================================================
class Game_StoredItemData

attr_reader :inventory
attr_reader :items
attr_reader :weapons
attr_reader :armors

def initialize
@inventory = []
@items = {}
@weapons = {}
@armors = {}
@variants = [{}, {}, {}] # 0 => items; 1 => weapons; 2 => armors
end

def setup
for actor in $game_party.members
weapon = $data_weapons[actor.weapon_id]
unless weapon.nil?
w_var = actor.weapon_var = add_item(weapon, true)
new_weapon = @weapons[weapon.id][w_var][:weapon]
equip_item(new_weapon, actor.id)
end
if actor.two_swords_style
armor1 = $data_weapons[actor.armor1_id]
else
armor1 = $data_armors[actor.armor1_id]
end
unless armor1.nil?
a1_var = actor.armor1_var = add_item(armor1, true)
new_armor1 = @armors[armor1.id][a1_var][:armor]
equip_item(new_armor1, actor.id)
end
for i in [2, 3, 4]
txt = "armor#{i} = $data_armors[actor.armor#{i}_id];
unless armor#{i}.nil?;
a#{i}_var = actor.armor#{i}_var = add_item(armor#{i}, true);
new_armor#{i} = @armors[armor#{i}.id][a#{i}_var][:armor];
equip_item(new_armor#{i}, actor.id);
end"
eval(txt)
end
end
end

def set_inventory(add, n, item)
if add
if $game_party.unstackable?(item)
@inventory << item
else
a = @inventory.find_all { |i| i.is_a?(Array) and i[0].id == item.id }
if !a.empty?
a.each { |i|
if i[0].id == item.id
i[1] += 1
end
}
else
@inventory << [item, 1]
end
end
return
else
if $game_party.unstackable?(item)
@inventory.delete(item)
else
i = @inventory.find{ |i| i.is_a?(Array) and i[0].id == item.id }
if !i.nil?
i[1] -= 1
if i[1] <= 0
@inventory.delete(i)
end
else
return
end
end
return
end
end

def add_item(item, called_var = false)
i = item.id
if item.is_a?(RPG::Item)
new_item_data(item, 0) unless item_data_exists?(item, 0)
var = item.variation = new_item_variant(item, 0, true)
elsif item.is_a?(RPG::Weapon)
new_item_data(item, 1) unless item_data_exists?(item, 1)
var = item.variation = new_item_variant(item, 1, true)
elsif item.is_a?(RPG::Armor)
new_item_data(item, 2) unless item_data_exists?(item, 2)
var = item.variation = new_item_variant(item, 2, true)
end
return var if called_var
end

def equip_item(item, actor_id)
var = item.variation
if item.is_a?(RPG::Weapon)
var = add_item(item, true) if !item_data_exists?(item, 1)
set_inventory(false, 1, @weapons[item.id][var][:weapon])
@weapons[item.id][var][:equipped] = true
@weapons[item.id][var][:equipped_to] = actor_id
elsif item.is_a?(RPG::Armor)
var = add_item(item, true) if !item_data_exists?(item, 2)
set_inventory(false, 1, @armors[item.id][var][:armor])
@armors[item.id][var][:equipped] = true
@armors[item.id][var][:equipped_to] = actor_id
end
end

def unequip_item(item)
var = item.variation
if item.is_a?(RPG::Weapon)
@weapons[item.id][var][:equipped] = false
@weapons[item.id][var][:equipped_to] = nil
set_inventory(true, 1, @weapons[item.id][var][:weapon])
elsif item.is_a?(RPG::Armor)
@armors[item.id][var][:equipped] = false
@armors[item.id][var][:equipped_to] = nil
set_inventory(true, 1, @armors[item.id][var][:armor])
end
end

def remove_item(item, n)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
var = item.variation
case type
when 0
@items[item.id][var][:lost] = true
set_inventory(false, n, @items[item.id][var][:item])
when 1
@weapons[item.id][var][:lost] = true
set_inventory(false, n, @weapons[item.id][var][:weapon])
when 2
@armors[item.id][var][:lost] = true
set_inventory(false, n, @armors[item.id][var][:armor])
end
end

def new_item_data(item, type)
case type
when 0 # ITEM
@items[item.id] = {}
when 1 # WEAPON
@weapons[item.id] = {}
when 2 # ARMOR
@armors[item.id] = {}
end
end

def item_data_exists?(item, type)
case type
when 0 # ITEM
return true if !@items[item.id].nil?
when 1 # WEAPON
return true if !@weapons[item.id].nil?
when 2 # ARMOR
return true if !@armors[item.id].nil?
end
return false
end

def new_item_variant(item, type, called = false)
id = item.id
case type
when 0 # ITEM
var = @variants[0][id].nil? ? @variants[0][id] = 0 : @variants[0][id]
@variants[0][id] += 1
@items[id][var] = {}
@items[id][var][:item] = $data_items[id].dup
@items[id][var][:item].variation = var
@items[id][var][:lost] = false
set_inventory(true, 1, @items[id][var][:item])
when 1 # WEAPON
var = @variants[1][id].nil? ? @variants[1][id] = 0 : @variants[1][id]
@variants[1][id] += 1
@weapons[id][var] = {}
@weapons[id][var][:weapon] = $data_weapons[id].dup
@weapons[id][var][:weapon].variation = var
set_inventory(true, 1, @weapons[id][var][:weapon])
@weapons[id][var][:equipped] = false # not visible flag
@weapons[id][var][:equip_to] = nil # id of the actor wearing equipment
@weapons[id][var][:lost] = false
when 2 # ARMOR
var = @variants[2][id].nil? ? @variants[2][id] = 0 : @variants[2][id]
@variants[2][id] += 1
@armors[id][var] = {}
@armors[id][var][:armor] = $data_armors[id].dup
@armors[id][var][:armor].variation = var
set_inventory(true, 1, @armors[id][var][:armor])
@armors[id][var][:equipped] = false # not visible flag
@armors[id][var][:equip_to] = nil # id of the actor wearing equipment
@armors[id][var][:lost] = false
end
return var if called
end

end
#===============================================================================
# Game_Party
#===============================================================================
class Game_Party

include SPG::EquipSystem

alias spg_equipsystem_game_party_ini initialize unless $@
alias spg_equipsystem_game_party_in item_number unless $@
alias spg_equipsystem_game_party_ssm setup_starting_members unless $@

attr_reader :stored_item_data

def initialize
spg_equipsystem_game_party_ini
@stored_item_data = Game_StoredItemData.new
end

def setup_starting_members
spg_equipsystem_game_party_ssm
@stored_item_data.setup
end

def items
result = []
@stored_item_data.inventory.each { |item|
next if item.nil?
if item.is_a?(Array)
result.push item[0] if !item[0].nil?
else
result.push item
end
}
return result
end

def unstackable?(item)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
type2 = type == 0 ? 'items' : type == 1 ? 'weapons' : 'armors'
if UNSTACKABLE[type2].is_a?(TrueClass)
return true
elsif UNSTACKABLE[type2].is_a?(FalseClass)
return false
elsif UNSTACKABLE[type2].is_a?(Array)
return UNSTACKABLE[type2].include?(item.id)
end
end

def item_number(item)
type = item.is_a?(RPG::Item) ? 'items' : item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
a = @stored_item_data.inventory.find{ |i| i.is_a?(Array) and i[0].id == item.id}
return 1 if a.nil? && !@stored_item_data.inventory.find{|i| i == item}.nil?
number = a.nil? ? 0 : a[1]
return number
end

def has_usable_item?(item, include_equip = false)
i = include_equip ? "" : "!var[:equipped] and"
type = item.is_a?(RPG::Item) ? 'items' : item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
return eval("@stored_item_data.#{type}[item.id].values.find_all{|var|
#{i} !var[:lost]}.size > 0")
end

def has_item?(item, include_equip = false)
if item_number(item) > 0
return true
end
if include_equip
for actor in members
return true if actor.equips.include?(item)
end
end
return false
end

def gain_item(item, n, include_equip = false)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
type2 = type == 0 ? 'items' : type == 1 ? 'weapons' : 'armors'
@stored_item_data.new_item_data(item, type) unless @stored_item_data.item_data_exists?(item, type)
number = item_number(item)
for i in 0...n
@stored_item_data.add_item(item) unless number + i > 99
end
end

def lose_item(item, n, include_equip = false)
number = item_number(item)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
@stored_item_data.remove_item(item, n)
if include_equip
for actor in member
if actor.equips.include?(item) and number - n < 0
actor.discard_equip(item)
end
end
end
end

def consume_item(item)
if item.is_a?(RPG::Item) and item.consumable
lose_item(item, 1)
end
end

def item_can_use?(item)
return false unless item.is_a?(RPG::Item)
return false if item_number(item) == 0
if $game_temp.in_battle
return item.battle_ok?
else
return item.menu_ok?
end
end

end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor

attr_accessor :weapon_var
attr_accessor :armor1_var
attr_accessor :armor2_var
attr_accessor :armor3_var
attr_accessor :armor4_var

alias spg_equip_system_game_actor_ce change_equip unless $@

def equip_data
result = []
result.push($data_weapons[@weapon_id])
two_swords_style ? result.push($data_weapons[@armor1_id]) : result.push($data_armors[@armor1_id])
for i in [2, 3, 4]
armor = eval("$data_armors[@armor#{i}_id]")
result.push(armor)
end
return result
end

def weapons
result = []
sd = $game_party.stored_item_data.weapons
if @weapon_id != 0 and @weapon_var != nil
result.push(sd[@weapon_id][@weapon_var][:weapon])
else
result.push(nil)
end
if two_swords_style
if @armor1_id != 0 and @armor1_var != nil
result.push(sd[@armor1_id][@armor1_var][:weapon])
else
result.push(nil)
end
end
return result
end

def armors
result = []
sd = $game_party.stored_item_data.armors
unless two_swords_style
if @armor1_id != 0 and @armor1_var != nil
result.push(sd[@armor1_id][@armor1_var][:armor])
else
result.push(nil)
end
end
for i in [2, 3, 4]
txt = "if @armor#{i}_id != 0 and @armor#{i}_var != nil;
result.push(sd[@armor#{i}_id][@armor#{i}_var][:armor]);
else;
result.push(nil);
end"
eval(txt)
end
return result
end

def change_equip(equip_type, item, test = false)
last_item = equips[equip_type]
unless test
return if $game_party.item_number(item) == 0 if item != nil
unless last_item.nil?
type = last_item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
st = eval("$game_party.stored_item_data.#{type}[last_item.id]")
$game_party.stored_item_data.unequip_item(last_item)
end
unless item.nil?
type = item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
st = eval("$game_party.stored_item_data.#{type}[item.id]")
$game_party.stored_item_data.equip_item(item, self.id)
end
end
item_id = item.nil? ? 0 : item.id
var = item.nil? ? nil : item.variation
case equip_type
when 0 # Weapon
@weapon_id = item_id
@weapon_var = var
when 1 # Shield
@armor1_id = item_id
@armor1_var = var
when 2 # Head
@armor2_id = item_id
@armor2_var = var
when 3 # Body
@armor3_id = item_id
@armor3_var = var
when 4 # Accessory
@armor4_id = item_id
@armor4_var = var
end
end

end
#===============================================================================
# Window_Item
#===============================================================================
class Window_Item < Window_Selectable

def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
unless $game_party.unstackable?(item)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
end

end
#===============================================================================
# END
#===============================================================================


Addons

Item Durability :: sparkyg13
Spoiler:

CODE

#===============================================================================
# [SPG] Equipment Durability
# by: sparkyg13
#-------------------------------------------------------------------------------
# a script that adds durability to armor and weapons.
#-------------------------------------------------------------------------------
# to set an item's maximum durability place:
# "<durability_max = n>" (without quotes)
# where n is equal to the maximum value
#===============================================================================
module SPG
module EquipDura
#===============================================================================
# CONFIG
#===============================================================================

# cost to repair 1 durability point.
COST_PER_DURABILITY_POINT = 1

VOCAB = {

:repair => "Repair",
:repair_all => "Repair All",
:repair_all_help => "Repairs all items",

}

#===============================================================================
# END CONFIG
#===============================================================================
end
end
#===============================================================================
# RPG::BaseItem
#===============================================================================
class RPG::BaseItem

def durability=(n)
return if unbreakable?
@durability = [[n, 0].max, max_durability].min
end

def durability
@durability = @durability.nil? ? max_durability : @durability.to_i
return @durability
end

def max_durability
self.note.scan(/<durability_max[ ]=(.*)>/i)
return $1.nil? ? -1 : $1.to_i
end

def broken?; return @durability == 0; end
def unbreakable?; return max_durability == -1; end

end
#===============================================================================
# RPG::Weapon
#===============================================================================
class RPG::Weapon

def atk; return broken? ? 0 : @atk; end
def def; return broken? ? 0 : @def; end
def spi; return broken? ? 0 : @spi; end
def agi; return broken? ? 0 : @agi; end
def fast_attack; return broken? ? false : @fast_attack; end
def dual_attack; return broken? ? false : @dual_attack; end
def critical_bonus; return broken? ? false : @critical_bonus; end
def element_set; return broken? ? [] : @element_set; end
def state_set; return broken? ? [] : @state_set; end

def price
return ((@price * durability) / max_durability)
end

end
#===============================================================================
# RPG::Armor
#===============================================================================
class RPG::Armor

def atk; return broken? ? 0 : @atk; end
def def; return broken? ? 0 : @def; end
def spi; return broken? ? 0 : @spi; end
def agi; return broken? ? 0 : @agi; end
def prevent_critical; return broken? ? false : @prevent_critical; end
def half_mp_cost; return broken? ? false : @half_mp_cost; end
def double_exp_gain; return broken? ? false : @double_exp_gain; end
def auto_hp_recover; return broken? ? false : @auto_hp_recover; end
def element_set; return broken? ? [] : @element_set; end
def state_set; return broken? ? [] : @state_set; end

def price
return ((@price * durability) / max_durability)
end

end
#===============================================================================
# Scene_Battle
#===============================================================================
class Scene_Battle

alias spg_equip_durability_scene_battle_dhd display_hp_damage unless $@

def display_hp_damage(target, obj = nil)
spg_equip_durability_scene_battle_dhd(target, obj)
if target.hp_damage > 0
act = target.actor? ? target : @active_battler
ene = target.actor? ? @active_battler : target
act.do_dura_loss(target.actor?, ene)
end
end

end
#===============================================================================
# Game_Battler
#===============================================================================
class Game_Battler

def do_dura_loss(actor, obj)
if actor # actor is target : armor durability loss
damage = obj.atk * 4
base = [damage, 1].max
for armor in armors
next if armor.nil? || armor.unbreakable?
d = rand(base / 4)
armor.durability -= (d / armors.compact.size)
end
else # enemy is target : weapon durablity loss
damage = self.atk * 4
base = [obj.maxhp - damage, 1].max
for weapon in weapons
next if weapon.nil? || weapon.unbreakable?
d = rand(base / 4)
weapon.durability -= (d / weapons.compact.size)
end
end
end

end
#===============================================================================
# Window_Base
#===============================================================================
class Window_Base

alias spg_equip_durability_window_base_din draw_item_name unless $@

def draw_item_name(item, x, y, enabled = true)
spg_equip_durability_window_base_din(item, x, y, enabled)
return if item.nil?
unless self.is_a?(Window_ShopBuy) || self.is_a?(Window_ShopNumber)
draw_item_dura_gauge(x, y, item) if !item.unbreakable? && !item.unsigned?
end
end

def draw_item_dura_gauge(x, y, item)
gw = 20 * item.durability / item.max_durability
gc1 = Color.new(0, 55, 0)
gc2 = Color.new(255, 30, 0)
self.contents.fill_rect(x+2, y+20, 20, 3, gc2)
self.contents.fill_rect(x+2, y+20, gw, 3, gc1)
end

end
#===============================================================================
# Scene_Shop
#===============================================================================
class Scene_Shop

alias spg_equip_durability_scene_shop_sta start unless $@
alias spg_equip_durability_scene_shop_upd update unless $@
alias spg_equip_durability_scene_shop_ucs update_command_selection unless $@

def start
@can_repair = $game_temp.shop_repair
spg_equip_durability_scene_shop_sta
@repair_window = Window_ShopRepair.new(0, 112, 544, 304)
@repair_window.active = false
@repair_window.visible = false
@repairing_window = Window_ShopRepairing.new(0, 112)
@repairing_window.active = false
@repairing_window.visible = false
$game_temp.shop_repair = true
end

def create_command_window
s1 = Vocab::ShopBuy
s2 = Vocab::ShopSell
s3 = SPG::EquipDura::VOCAB[:repair]
s4 = Vocab::ShopCancel
@command_window = Window_Command.new(384, [s1, s2, s3, s4], 4, 0, 8)
@command_window.y = 56
if $game_temp.shop_purchase_only
@command_window.draw_item(1, false)
end
if !@can_repair
@command_window.draw_item(2, false)
end
end

def update
spg_equip_durability_scene_shop_upd
if @repair_window.active
@repair_window.update
update_repair
elsif @repairing_window.active
@repairing_window.update
update_repairing
end
end

def update_command_selection
if Input.trigger?(Input::C)
case @command_window.index
when 2
Input.update
if !@can_repair
Sound.play_buzzer
else
Sound.play_decision
@command_window.active = false
@dummy_window.visible = false
@repair_window.active = true
@repair_window.visible = true
@repair_window.refresh
@repair_window.help_window = @help_window
end
return
when 3
Sound.play_decision
$scene = Scene_Map.new
return
end
end
spg_equip_durability_scene_shop_ucs
end

def update_repair
if @repair_window.repair_all?
@help_window.set_text(SPG::EquipDura::VOCAB[:repair_all_help])
end
if Input.trigger?(Input:: cool.gif
Sound.play_cancel
@repair_window.active = false
@repair_window.visible = false
@dummy_window.visible = true
@command_window.active = true
@help_window.set_text("")
return
elsif Input.trigger?(Input::C)
@item = @repair_window.item
return Sound.play_buzzer unless @repair_window.enable?(@item)
@repairing_window.item = @item
@repairing_window.refresh
Input.update
Sound.play_decision
@repair_window.visible = false
@repair_window.active = false
@repairing_window.active = true
@repairing_window.visible = true
end

end

def update_repairing
if Input.trigger?(Input:: cool.gif
Sound.play_cancel
@repairing_window.active = false
@repairing_window.visible = false
@repair_window.visible = true
@repair_window.active = true
elsif Input.trigger?(Input::C)
Input.update
case @repairing_window.i
when 0 # yes
return Sound.play_buzzer if $game_party.gold < @repairing_window.repair_cost
$game_party.lose_gold(@repairing_window.repair_cost)
if @item.nil?
for item in $game_party.items
item.durability = item.max_durability
end
else
@item.durability = @item.max_durability
end
Sound.play_shop
when 1
Sound.play_cancel
end
@repairing_window.active = false
@repairing_window.visible = false
@repair_window.visible = true
@repair_window.active = true
@repair_window.refresh
@gold_window.refresh
end
end

end
#===============================================================================
# Window_ShopRepair
#===============================================================================
class Window_ShopRepair < Window_ShopSell

def include?(item)
return true if item.nil?
return (item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor))
end

def enable?(item)
return need_repair_items.compact.size > 0 if item.nil?
return (item.durability < item.max_durability)
end

def repair_all?
return self.index == @data.size - 1
end

def draw_item(i)
super(i)
rect = item_rect(@data.size - 1)
rect.width -= 4
default_alpha = self.contents.font.color.alpha
enabled = enable?(nil)
self.contents.font.color.alpha = enabled ? 255 : 128
ra = SPG::EquipDura::VOCAB[:repair_all]
self.contents.draw_text(rect, ra, 1)
self.contents.font.color.alpha = default_alpha
end

def need_repair_items
result = []
for item in @data
next if item.nil?
result << item if item.durability < item.max_durability
end
return result
end

end
#===============================================================================
# Window_ShopRepairing
#===============================================================================
class Window_ShopRepairing < Window_Base

attr_accessor :item
attr_reader :i

def initialize(x, y)
super(x, y, 544, 304)
@item = nil
@i = 0
refresh
end

def update
super
if self.active
if Input.trigger?(Input::RIGHT) and @i != 1
Sound.play_cursor
@i = 1
refresh
elsif Input.trigger?(Input::LEFT) and @i != 0
Sound.play_cursor
@i = 0
refresh
end
else
@i = 0
end
end

def repair_cost
cost = 0
cpd = SPG::EquipDura::COST_PER_DURABILITY_POINT
if @item.nil?
for item in $game_party.items
if item.durability < item.max_durability
cost += (cpd*(item.max_durability - item.durability))
end
end
else
if @item.durability < @item.max_durability
cost = (cpd*(@item.max_durability - @item.durability))
end
end
return cost
end

def refresh
y = 96
self.contents.clear
text = @item.nil? ? "all equipment" : @item.name
self.contents.draw_text(0, 0, 544, WLH, "Repair #{text}?")
draw_currency_value(repair_cost, 4, y + WLH * 2, 264)
y_rect = Rect.new(self.width/2 * 0, y, self.width/2 - 32, WLH)
n_rect = Rect.new(self.width/2 * 1, y, self.width/2 - 32, WLH)
self.contents.font.color = normal_color
self.contents.draw_text(y_rect, "Yes", 1)
self.contents.draw_text(n_rect, "No", 1)
self.cursor_rect.set(self.width/2 * @i, y, self.width/2 - 32, WLH)
end

end
#===============================================================================
# Game_Temp
#===============================================================================
class Game_Temp

def shop_repair
return @shop_repair.nil? ? true : @shop_repair
end

def shop_repair=(bool)
@shop_repair = bool
end

end
#===============================================================================
# END
#===============================================================================



Equipment Quality :: sparkyg13
Spoiler:
CODE

#==============================================================================
=begin
#==============================================================================

Equip Quality aka Item Rarity
by: sparkyg13

#==============================================================================
=end
#==============================================================================
module SPG::ItmRar

# RARITY
# Allows you to choose which item types are shown to have rarities.
# For Item, Skill, Weapon, and Armor (respectively)

ITM_RARITY = true # if false colors will not change for this paticular type
SKL_RARITY = false # "
WEP_RARITY = true # "
ARM_RARITY = true # "

# RAR_WINDOW
# If true a small window will display at the bottom right corner of item / skill
# windows that will display the name of the current item's rarity

RAR_WINDOW = true

# RAR_SATIONARY
# If true the RAR_WINDOW remains in the corner rather than following the
# items you are choosing.

RAR_STATIONARY = false

# RARITY = {}
# Array of raritys set up in this manner:
#
# id => [rarity name, [red, green, blue]*** ]
#
# *** or: Color.new(red, green, blue)
#
# Now to break that down:
#
# 1. id
# the id is the current id of the rarity
# this is the number you will put into the notebox of the item, weapon, ect.
# to give the item its rarity.
#
# 2. rarity name
# the name of the rarity, be sure to put it in quotations!
#
# 3. [red, green, blue] -OR- Color.new(red, green, blue)
# this is the array of colors that will be used to make a new color
# with its different assortments you can easily create your own colors
# rather than using predefined ones.
# a. red
# the ammount of red in the color from 0 - 255
# b. green
# the ammount of blue in the color from 0 - 255
# c. blue
# then ammount of green in the color from 0 - 255
#
# NOTE: refrer to the Color section of the Help directory for more info
#
# HINT: You can use the ' Flash Screen ' event command to see what levels
# of each color are used to make certain colors.
#
# to give an Item its Rarity:
# in the notebox of the item put (these all work):
#
# <rarity: 0>
# <RARITY: 0>
# <rarity = 0>
# <RARITY = 0>
#
# below is a basic group of rarity types you might see in average games.

RARITY = { # defines RARITY as a Hash Expression

# id Name Color Array
# r g b
-1 => ["Junk" , [ 0, 0, 0] ], # color black
0 => ["Very Common", [170, 170, 170] ], # color grey
1 => ["Common" , [255, 255, 255] ], # color white # DEFAULT
2 => ["Uncommon" , [ 0, 136, 0] ], # color green
3 => ["Rare" , [ 0, 68, 187] ], # color blue
4 => ["Epic" , [119, 0, 255] ], # color purple
5 => ["Legendary" , [204, 204, 0] ], # color yellow

} #<-- DO NOT EDIT

DEFAULT_RARITY = 1

#===========================================================================
#
# For Common Events
#
# If you need to check item rarities for common event purposes
# simply create the common event and go to the script section
#
# type: "TYPE_rarity(n) == " (without quotes)
# where TYPE is the type of item (item, armor, weapon, or skill)
# where n is the id of the item as it appears in the database
# and after the '==' (interchangable with: >, <, >=, <=, !=) put the id
# of the rarity you want to see if that number is eqaul to...
#
#===========================================================================

end

#==============================================================================
# IMPORT
#------------------------------------------------------------------------------
$imported = {} if $imported == nil
$imported["SPG:ItmRar"] = true
#=============================================================================
#==============================================================================
# RPG::BaseItem
#==============================================================================
class RPG::BaseItem

def rarity
note.scan(/<rarity[\s][=|:][\s](.*)>/i)
return $1.nil? ? SPG::ItmRar::DEFAULT_RARITY : $1.to_i
end

end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base

alias spg_itm_rar_window_base_din draw_item_name unless $@

def draw_item_name(item, x, y, enabled = true)
@change = true
if item != nil
draw_icon(item.icon_index, x, y, enabled)
if item.is_a?(RPG::Item)
@change = false unless SPG::ItmRar::ITM_RARITY
elsif item.is_a?(RPG::Weapon)
@change = false unless SPG::ItmRar::WEP_RARITY
elsif item.is_a?(RPG::Armor)
@change = false unless SPG::ItmRar::ARM_RARITY
elsif item.is_a?(RPG::Skill)
@change = false unless SPG::ItmRar::SKL_RARITY
end
@change = false if item.rarity == nil
spg_itm_rar_window_base_din(item, x, y, enabled)
if @change
if SPG::ItmRar::RARITY[item.rarity][1].is_a?(Array)
red = SPG::ItmRar::RARITY[item.rarity][1][0]
green = SPG::ItmRar::RARITY[item.rarity][1][1]
blue = SPG::ItmRar::RARITY[item.rarity][1][2]
color = Color.new(red, green, blue)
elsif SPG::ItmRar::RARITY[item.rarity][1].is_a?(Color)
color = SPG::ItmRar::RARITY[item.rarity][1]
end
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, 172, WLH, item.name)
self.contents.font.color = normal_color
end
end
end

end
#==============================================================================
# Window_Rarity
#==============================================================================
class Window_Rarity < Window_Base

attr_accessor :item

def initialize(x, y)
super(x, y, 120, 46)
self.openness = 0
refresh
@item = nil
end

def refresh
self.contents.clear
item = @item
@change = true
if item != nil
self.contents.font.size = 15
if item.is_a?(RPG::Item)
@change = false unless SPG::ItmRar::ITM_RARITY
elsif item.is_a?(RPG::Weapon)
@change = false unless SPG::ItmRar::WEP_RARITY
elsif item.is_a?(RPG::Armor)
@change = false unless SPG::ItmRar::ARM_RARITY
elsif item.is_a?(RPG::Skill)
@change = false unless SPG::ItmRar::SKL_RARITY
end
@change = false if item.rarity == nil
if @change
name = SPG::ItmRar::RARITY[item.rarity][0]
if SPG::ItmRar::RARITY[item.rarity][1].is_a?(Array)
red = SPG::ItmRar::RARITY[item.rarity][1][0]
green = SPG::ItmRar::RARITY[item.rarity][1][1]
blue = SPG::ItmRar::RARITY[item.rarity][1][2]
color = Color.new(red, green, blue)
elsif SPG::ItmRar::RARITY[item.rarity][1].is_a?(Color)
color = SPG::ItmRar::RARITY[item.rarity][1]
end
self.contents.font.color = color
end
self.contents.draw_text(0, 0, self.contents.width, 15, name, 1)
end
end

end
#==============================================================================
# Window_Selectable
#==============================================================================
class Window_Selectable

alias spg_itm_rar_window_selectable_ini initialize unless $@
alias spg_itm_rar_window_selectable_upd update unless $@
alias spg_itm_rar_window_selectable_dis dispose unless $@

def initialize(x, y, width, height, spacing = 32)
spg_itm_rar_window_selectable_ini(x, y, width, height, spacing)
use_rar = SPG::ItmRar::RAR_WINDOW
return unless (defined?(item) or defined?(skill)) && use_rar
@rarity_window = Window_Rarity.new(x+width-120, y+height-46)
@old_item = nil
end

def page_row
row = (self.index / self.column_max)
page_row = row.floor - top_row
return page_row
end

def update
spg_itm_rar_window_selectable_upd
return if @rarity_window.nil?
return unless defined?(item) or defined?(skill)
@rarity_window.update
@cancel = false
if defined?(item)
@rarity_window.item = item
@cancel = true if item.is_a?(RPG::Item) and !SPG::ItmRar::ITM_RARITY
@cancel = true if item.is_a?(RPG::Weapon) and !SPG::ItmRar::WEP_RARITY
@cancel = true if item.is_a?(RPG::Armor) and !SPG::ItmRar::ARM_RARITY
elsif defined?(skill)
@rarity_window.item = skill
@cancel = true if !SPG::ItmRar::SKL_RARITY
else; return
end
obj = @rarity_window.item
update_open if self.active && !obj.nil? && !@cancel
update_close if !self.active || obj.nil? || @cancel
if @old_item != @rarity_window.item
@rarity_window.refresh
@old_item = @rarity_window.item
end
update_rarity_pos
end

def update_rarity_pos
return if @cancel
if SPG::ItmRar::RAR_STATIONARY
if @rarity_window.x != self.x + self.width-120 #
@rarity_window.x = self.x + self.width-120 #
end
if @rarity_window.y != self.y + self.height-46
@rarity_window.y = self.y + self.height-46
end
else
if @rarity_window.x != (width / self.column_max)*(self.index % self.column_max) + x + 14
@rarity_window.x = (width / self.column_max)*(self.index % self.column_max) + x + 14
end
if @rarity_window.y != self.y + (24 * page_row) + 40
@rarity_window.y = self.y + (24 * page_row) + 40
end
end
end

def update_open
return if @rarity_window.openness >= 255
@rarity_window.openness += 18
end

def update_close
return if @rarity_window.openness <= 0
@rarity_window.openness -= 18
end

def dispose
spg_itm_rar_window_selectable_dis
return if @rarity_window.nil?
return unless defined?(item) or defined?(skill)
@rarity_window.dispose
end

end
#==============================================================================
# Game_Interpreter
#==============================================================================
class Game_Interpreter

def item_rarity(n)
return $data_items[n].rarity
end

def armor_rarity(n)
return $data_armors[n].rarity
end

def weapon_rarity(n)
return $data_weapons[n].rarity
end

def skill_rarity(n)
return $data_skills[n].rarity
end

end
#===============================================================================


Equipment Levels :: sparkyg13
Spoiler:
CODE

#==============================================================================
=begin
#==============================================================================

[SPG] Equipment Levels
by: sparkyg13

an add-on for the Equipment System, gives level values to weapons and armors

NOTE:: you need a custom menu script that allows you to add custom menu
commands to it, the scene that is called when upgrading weapons is
'Scene_EquipLevel'

#==============================================================================

Item upgrading works by giving an item the ability to add xp to weapons (see
UPGRADE_ITEMS) then by selecting the upgrade option from the menu you can
use these items to upgrade weapons and armors that have the ability to upgrade

To give a weapon/armor the ability to be leveled up see WEAPON_LEVELS and
ARMOR_LEVELS below, simply place the weapon/armor's id as the first value then
add a '=>' (without quotes) then give the weapon/armor an xp max and some
upgraded stats here is an example:

03 => [[1000, ["name = Deadly Spear", "atk = 14"]]]

this give the weapon with id 03 (default spear) the ability to level up when
given leveling up items whose xps equal 1000. upon leveling up its name will
change to "Deadly Spear" and given an atk stat of 14

stat changes =

name = x (sets name)
icon_index = x (sets icon index)
anim = x (changes animation id)
price = x (changes price)
hit = x (sets hit ratio)
rarity = x (changes rarity (if item rarities is installed))
atk = x (sets atk stat)
def = x (sets def stat)
agi = x (sets agi stat)
spi = x (sets spi stat)

to give an item the ability to upgrade weapons/armors simply see UPGRADE_ITEMS
below, place the item id of the item you wish to have the ability to upgrade
weapons/armors, then plase the '=>' (without quotes) then the ammount of xp
it gives weapons/armors.

An addition to this script may be added later which allows items to be upgraded
based on how many times you strike with it.

#==============================================================================
=end
#==============================================================================
module SPG; module EquipLevel

# Weapon upgrades
WEAPON_LEVELS = {

#id => level_1 ... level_2 ...
# [xp_max, [level_up attribs.]], [xp_max, [level_up attribs.]]
01 => [[100, ["name = Spiked Club", "atk = 7", "rarity = 2"]], [1000, ["name = Master Club", "atk = 14"]]]

}

# Armor upgrades
ARMOR_LEVELS = {

}

# items used in item upgrading
# the items id followed by the ammount of xp it gives
UPGRADE_ITEMS = {

#id => xp

21 => 10

}

# The help text displayed in relation to the command window
UPGRADE_WINDOW_HELP = ["Upgrade an Item", "View Weapon Stats",
"View Upgrade Items", "Return to menu"]

# the command text displayed on the command menu
COMMAND_TEXT = ["Upgrade", "Stats", "Items", "Exit"]

# the sound type either, 'se' or 'me'
UPGRADE_SOUND_TYPE = 'me'

# the sound file name
UPGRADE_SOUND = 'item'

end; end

#==============================================================================
# RPG::Weapon
#==============================================================================
class RPG::Weapon

def level
return @level.nil? ? -1 : @level
end

def level=(v)
@level = v
end

def xp
return @xp.nil? ? 0 : @xp
end

def xp=(v)
@xp = v
end

def max_xp
return 0 if !has_level_up?
return 0 if !is_upgradable?
return SPG::EquipLevel::WEAPON_LEVELS[self.id][level - 1][0]
end

def has_level_up?
return !SPG::EquipLevel::WEAPON_LEVELS[self.id][level + 1].nil?
end

def is_upgradable?
return !SPG::EquipLevel::WEAPON_LEVELS[self.id].nil?
end

def level_up
args = SPG::EquipLevel::WEAPON_LEVELS[self.id][level - 1][1]
args.each { |arg|
case arg
when /name[ ]=[ ](.*)/i
self.name = $1.to_s
when /icon[_]index[ ]=[ ](\d)/i
self.icon_index = $1.to_i
when /anim[ ]=[ ](\d)/i
self.animation_id = $1.to_i
when /price[ ]=[ ](\d)/i
self.price = $1.to_i
when /hit[ ]=[ ](\d)/i
self.hit = $1.to_i
when /rarity[ ]=[ ](\d*)/i
@rarity = $1.to_i
when /atk[ ]=[ ](\d)/i
self.atk = $1.to_i
when /def[ ]=[ ](\d)/i
self.def = $1.to_i
when /agi[ ]=[ ](\d)/i
self.agi = $1.to_i
when /spi[ ]=[ ](\d)/i
self.spi = $1.to_i
end
}
end

end

#==============================================================================
# RPG::Armor
#==============================================================================
class RPG::Armor

def level
return @level.nil? ? -1 : @level
end

def level=(v)
@level = v
end

def xp
return @xp.nil? ? 0 : @xp
end

def xp=(v)
@xp = v
end

def max_xp
return 0 if !has_level_up?
return 0 if !is_upgradable?
return SPG::EquipLevel::ARMOR_LEVELS[self.id][level - 1][0]
end

def is_upgradable?
return !SPG::EquipLevel::ARMOR_LEVELS[self.id].nil?
end

def has_level_up?
return !SPG::EquipLevel::ARMOR_LEVELS[self.id][level + 1].nil?
end

def level_up
args = SPG::EquipLevel::ARMOR_LEVELS[self.id][level - 1][1]
args.each { |arg|
case arg
when /name[ ]=[ ](.*)/i
self.name = $1.to_s
when /icon[_]index[ ]=[ ](\d)/i
self.icon_index = $1.to_i
when /anim[ ]=[ ](\d)/i
self.animation_id = $1.to_i
when /price[ ]=[ ](\d)/i
self.price = $1.to_i
when /eva[ ]=[ ](\d)/i
self.eva = $1.to_i
when /atk[ ]=[ ](\d)/i
self.atk = $1.to_i
when /def[ ]=[ ](\d)/i
self.def = $1.to_i
when /agi[ ]=[ ](\d)/i
self.agi = $1.to_i
when /spi[ ]=[ ](\d)/i
self.spi = $1.to_i
end
}
end

end

class RPG::Item

def upgrade
return xp > 0
end

def xp
@xp = SPG::EquipLevel::UPGRADE_ITEMS[self.id]
return @xp.nil? ? 0 : @xp
end

end

#==============================================================================
# Scene_EquipLevel
#==============================================================================
class Scene_EquipLevel < Scene_Base

def initialize(actor_index)
@actor_index = actor_index
end

def start
create_windows
end

def active_window
windows = [@command_window, @equipment_window,
@item_window]
for window in windows
return window if window.active
end
end

def create_windows
create_help_window
create_command_window
create_status_window
create_upgrade_window
create_equipment_window
create_item_window
create_big_item_window
create_dead_window
end

def create_help_window
@help_window = Window_Help.new
end

def create_command_window
@command_window = Window_Command.new(160, SPG::EquipLevel::COMMAND_TEXT)
@command_window.y = @help_window.height
end

def create_status_window
actor = $game_party.members[@actor_index]
@status_window = Window_EquipLevelStatus.new(160, @command_window.y, actor)
end

def create_upgrade_window
actor = $game_party.members[@actor_index]
y = @help_window.height + @command_window.height
@upgrade_window = Window_EquipLevelEquipStats.new(0, y, actor)
end

def create_dead_window
y = @help_window.height + @command_window.height
w = 544 - @equipment_window.width
h = 416 - @help_window.height - @status_window.height
@dead_window = Window_Base.new(0, y, w, h)
end

def create_item_window
y = @help_window.height + @command_window.height
w = 544 - @equipment_window.width
h = 416 - @help_window.height - @status_window.height
@item_window = Window_EquipLevelItem.new(0, y, w, h)
end

def create_equipment_window
actor = $game_party.members[@actor_index]
x = @upgrade_window.width
y = @help_window.height + @command_window.height
@equipment_window = Window_EquipLevelEquip.new(x, y, actor)
end

def create_big_item_window
y = @help_window.height + @command_window.height
h = 416 - @help_window.height - @status_window.height
@big_item_window = Window_EquipLevelItem.new(0, y, 544, h)
end

def update
update_windows
end

def update_windows
@dead_window.update
update_help_window
update_command_window
update_status_window
update_upgrade_window
update_equipment_window
update_item_window
update_big_item_window
end

def update_help_window
@help_window.update
return if !@command_window.active
return if @help_window.text == SPG::EquipLevel::UPGRADE_WINDOW_HELP[@command_window.index]
@help_window.set_text(SPG::EquipLevel::UPGRADE_WINDOW_HELP[@command_window.index])
end

def update_command_window
@command_window.update
return unless @command_window.active
if Input.trigger?(Input::C)
Input.update
Sound.play_decision
case @command_window.index
when 0 # Upgrade
@equipment_window.active = true
@equipment_window.index = 0
@dead_window.visible = false
@item_window.visible = true
@command_window.active = false
@equipment_window.help_window = @help_window
when 1 # Stats
@equipment_window.active = true
@equipment_window.index = 0
@dead_window.visible = false
@upgrade_window.visible = true
@command_window.active = false
@equipment_window.help_window = @help_window
when 2 # Items
@dead_window.visible = false
@equipment_window.visible = false
@big_item_window.visible = true
@big_item_window.help_window = @help_window
@big_item_window.active = true
@command_window.active = false
@big_item_window.index = 0
when 3 # Exit
$scene = Scene_Menu.new
end
elsif Input.trigger?(Input::cool.gif
Sound.play_cancel
$scene = Scene_Menu.new
end
end

def update_status_window
@status_window.update
end

def update_upgrade_window
@upgrade_window.update
@upgrade_window.item = @equipment_window.item
end

def update_equipment_window
@equipment_window.update
return unless @equipment_window.active
if Input.trigger?(Input::C)
Input.update
case @command_window.index
when 0 #Upgrading
return Sound.play_buzzer if @equipment_window.item.nil?
return Sound.play_buzzer if !@equipment_window.item.is_upgradable?
return Sound.play_buzzer if !@equipment_window.item.has_level_up?
Sound.play_decision
@to_be_upd = @equipment_window.item
@equipment_window.active = false
@item_window.active = true
@item_window.index = 0
when 1 #Stats
end
elsif Input.trigger?(Input::cool.gif
Sound.play_cancel
@equipment_window.active = false
@equipment_window.index = -1
@dead_window.visible = true
@upgrade_window.visible = false
@item_window.visible = false
@command_window.active = true
end
end

def update_item_window
@item_window.update
return unless @item_window.active
if Input.trigger?(Input::C)
Sound.play_use_item
Input.update
@upgrade_item = @item_window.item
upgrade_weapon(@to_be_upd, @upgrade_item) unless @to_be_upd.nil?
elsif Input.trigger?(Input::cool.gif
Sound.play_cancel
@item_window.active = false
@equipment_window.active = true
@equipment_window.visible = true
@item_window.index = -1
end
end

def update_big_item_window
@big_item_window.update
return unless @big_item_window.active
if Input.trigger?(Input::cool.gif
Input.update
Sound.play_cancel
@big_item_window.visible = false
@big_item_window.active = false
@equipment_window.visible = true
@dead_window.visible = true
@command_window.active = true
end
end

def upgrade_weapon(equip, upgrader)
return Sound.play_buzzer if upgrader.nil?
equip.xp += upgrader.xp
check_for_upgrade(equip)
$game_party.lose_item(upgrader, 1)
@item_window.refresh
end

def check_for_upgrade(equip)
if equip.xp >= equip.max_xp # level up ?
equip.level_up
@equipment_window.refresh
type = SPG::EquipLevel::UPGRADE_SOUND_TYPE
sound = SPG::EquipLevel::UPGRADE_SOUND
eval("Audio.#{type}_play('Audio/#{type}/#{sound}')")
end
end

def terminate
@command_window.dispose
@help_window.dispose
@status_window.dispose
@item_window.dispose
@big_item_window.dispose
@equipment_window.dispose
@dead_window.dispose
end

end

#==============================================================================
# Window_Help
#==============================================================================
class Window_Help

attr_reader :text

end

#==============================================================================
# Window_EquipLevelStatus
#==============================================================================
class Window_EquipLevelStatus < Window_Base

def initialize(x, y, actor)
@actor = actor
super(x, y, 544-160, 128)
refresh
end

def refresh
self.contents.clear
actor = @actor
@item_max = $game_party.members.size
draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
x = 104
y = actor.index * 96 + WLH / 2
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x, y + WLH * 2)
draw_actor_hp(actor, x + 120, y + WLH * 1)
draw_actor_mp(actor, x + 120, y + WLH * 2)
end

end

#==============================================================================
# Window_EquipLevelEquip
#==============================================================================
class Window_EquipLevelEquip < Window_Equip

def initialize(x, y, actor)
super(x, y, actor)
self.index = -1
self.height = 232
end

def refresh
self.contents.clear
@data = []
for item in @actor.equips do @data.push(item) end
@item_max = @data.size
self.contents.font.color = system_color
if @actor.two_swords_style
self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
else
self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
end
self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
for i in 0...5
enabled = @data[i].is_a?(RPG::Weapon) ? @data[i].has_level_up? : false
draw_item_name(@data[i], 92, WLH * i, enabled)
end
end

end

#==============================================================================
# Window_EquipLevelEquipStats
#==============================================================================
class Window_EquipLevelEquipStats < Window_EquipStatus

attr_accessor :item

def initialize(x, y, actor)
super(x, y, actor)
self.visible = false
self.active = false
@last_item = nil
@item = nil
@next_level_item = nil
self.height = 232
end

def update
super
if @last_item != @item
refresh
@last_item = @item
end
end

def refresh
create_contents
return if @item.nil?
return if !@item.is_upgradable?
draw_item_name(@item, 0, 4, 0)
self.contents.draw_text(0, 28, self.contents.width, WLH, "#{item.xp} / #{item.max_xp}", 2)
draw_item_name(@next_level_item, 0, WLH * 2)
@next_level_item = $data_weapons[@item.id].clone
@next_level_item.level_up
@new_atk = @next_level_item.atk + @actor.atk - @item.atk
@new_def = @next_level_item.def + @actor.def - @item.def
@new_spi = @next_level_item.spi + @actor.spi - @item.spi
@new_agi = @next_level_item.agi + @actor.agi - @item.agi
draw_parameter(0, WLH * 3, 0)
draw_parameter(0, WLH * 4, 1)
draw_parameter(0, WLH * 5, 2)
draw_parameter(0, WLH * 6, 3)
end

def draw_parameter(x, y, type)
case type
when 0
name = Vocab::atk
value = @actor.atk
new_value = @new_atk
when 1
name = Vocab::def
value = @actor.def
new_value = @new_def
when 2
name = Vocab::spi
value = @actor.spi
new_value = @new_spi
when 3
name = Vocab::agi
value = @actor.agi
new_value = @new_agi
end
self.contents.font.color = system_color
self.contents.draw_text(x + 4, y, 80, WLH, name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 90, y, 30, WLH, value, 2)
self.contents.font.color = system_color
self.contents.draw_text(x + 122, y, 20, WLH, ">", 1)
if new_value != nil
self.contents.font.color = new_parameter_color(value, new_value)
self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2)
end
end

end

#==============================================================================
# Window_EquipLevelItem
#==============================================================================
class Window_EquipLevelItem < Window_Item

def initialize(x, y, w, h)
super(x, y, w, h)
@column_max = 1
@index = -1
create_contents
self.active = false
self.visible = false
refresh
end

def refresh
@data = []
for item in $game_party.items
next unless item.upgrade
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end

end


..more to come smile.gif

Credit
please credit me (sparkyg13) if you use this script

This post has been edited by sparkyg13: Feb 24 2012, 05:03 PM


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
kyros2000
post Feb 17 2012, 06:09 PM
Post #2



Group Icon


Type: Coder




QUOTE (sparkyg13 @ Feb 16 2012, 05:37 AM) *
Advanced Equip V0.01
by: sparkyg13



Introduction
This script greatly modifies the current equipment system and allows for specific addons (ie durablility)

Features
- arrayed equipment database keeps track of all items gained, loss, or used
- Items have individual variations that allow specific item coding

Screenshots

none atm

How to Use
place above main, place addons below

Script
CODE
#===============================================================================
# [SPG] Equipment System
# by: sparkyg13
#-------------------------------------------------------------------------------
# a basic script that alters most equipment functions.
# this script is required for most SPG equipment altering scripts.
#===============================================================================

#===============================================================================
# IMPORT
#-------------------------------------------------------------------------------
$imported ||= {}
$imported["SPG:EquipSystem"] = true
#===============================================================================
module SPG; module EquipSystem

UNSTACKABLE = {

# you can make an Array ( [] ) of item ids to specify individual item ids
# or you can specify a true or false value to make all items of that type
# stackable / unstackable
# true = cannot stack / false = can stack / [2, 3, ...] cannot stack ids 2 or 3
'items' => false,
'weapons' => true,
'armors' => true,
}

end; end
#===============================================================================
# RPG::BaseItem
#===============================================================================
class RPG::BaseItem

def variation
return @variation.nil? ? -1 : @variation
end

def variation=(v)
@variation = v
end

def unsigned?
return self.variation == -1
end

end
#===============================================================================
# Game_StoredItemData
#===============================================================================
class Game_StoredItemData

attr_reader :inventory
attr_reader :items
attr_reader :weapons
attr_reader :armors

def initialize
@inventory = []
@items = {}
@weapons = {}
@armors = {}
@variants = [{}, {}, {}] # 0 => items; 1 => weapons; 2 => armors
end

def setup
for actor in $game_party.members
weapon = $data_weapons[actor.weapon_id]
unless weapon.nil?
w_var = actor.weapon_var = add_item(weapon, true)
new_weapon = @weapons[weapon.id][w_var][:weapon]
equip_item(new_weapon, actor.id)
end
if actor.two_swords_style
armor1 = $data_weapons[actor.armor1_id]
else
armor1 = $data_armors[actor.armor1_id]
end
unless armor1.nil?
a1_var = actor.armor1_var = add_item(armor1, true)
new_armor1 = @armors[armor1.id][a1_var][:armor]
equip_item(new_armor1, actor.id)
end
for i in [2, 3, 4]
txt = "armor#{i} = $data_armors[actor.armor#{i}_id];
unless armor#{i}.nil?;
a#{i}_var = actor.armor#{i}_var = add_item(armor#{i}, true);
new_armor#{i} = @armors[armor#{i}.id][a#{i}_var][:armor];
equip_item(new_armor#{i}, actor.id);
end"
eval(txt)
end
end
end

def set_inventory(add, item)
if add
if $game_party.unstackable?(item)
@inventory << item
else
a = @inventory.find_all { |i| i.is_a?(Array) }
if !a.empty?
a.each { |i|
if i[0].id == item.id
i[1] += 1
end
}
else
@inventory.push << [item, 1]
end
end
else
if $game_party.unstackable?(item)
@inventory.delete(item)
else
i = @inventory.find{ |i| i.is_a?(Array) and i[0].id == item.id }
if !i.nil?
i[1] -= 1
if i[1] <= 0
@inventory.delete(i)
end
else
return
end
end
end
end

def add_item(item, called_var = false)
i = item.id
if item.is_a?(RPG::Item)
new_item_data(item, 0) unless item_data_exists?(item, 0)
var = item.variation = new_item_variant(item, 0, true)
elsif item.is_a?(RPG::Weapon)
new_item_data(item, 1) unless item_data_exists?(item, 1)
var = item.variation = new_item_variant(item, 1, true)
elsif item.is_a?(RPG::Armor)
new_item_data(item, 2) unless item_data_exists?(item, 2)
var = item.variation = new_item_variant(item, 2, true)
end
return var if called_var
end

def equip_item(item, actor_id)
var = item.variation
if item.is_a?(RPG::Weapon)
var = add_item(item, true) if !item_data_exists?(item, 1)
set_inventory(false, @weapons[item.id][var][:weapon])
@weapons[item.id][var][:equipped] = true
@weapons[item.id][var][:equipped_to] = actor_id
elsif item.is_a?(RPG::Armor)
var = add_item(item, true) if !item_data_exists?(item, 2)
set_inventory(false, @armors[item.id][var][:armor])
@armors[item.id][var][:equipped] = true
@armors[item.id][var][:equipped_to] = actor_id
end
end

def unequip_item(item)
var = item.variation
if item.is_a?(RPG::Weapon)
@weapons[item.id][var][:equipped] = false
@weapons[item.id][var][:equipped_to] = nil
set_inventory(true, @weapons[item.id][var][:weapon])
elsif item.is_a?(RPG::Armor)
@armors[item.id][var][:equipped] = false
@armors[item.id][var][:equipped_to] = nil
set_inventory(true, @armors[item.id][var][:armor])
end
end

def remove_item(item)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
var = item.variation
case type
when 0
@items[item.id][var][:lost] = true
set_inventory(false, @items[item.id][var][:item])
when 1
@weapons[item.id][var][:lost] = true
set_inventory(false, @weapons[item.id][var][:weapon])
when 2
@armors[item.id][var][:lost] = true
set_inventory(false, @armors[item.id][var][:armor])
end
end

def new_item_data(item, type)
case type
when 0 # ITEM
@items[item.id] = {}
when 1 # WEAPON
@weapons[item.id] = {}
when 2 # ARMOR
@armors[item.id] = {}
end
end

def item_data_exists?(item, type)
case type
when 0 # ITEM
return !@items[item.id].nil?
when 1 # WEAPON
return !@weapons[item.id].nil?
when 2 # ARMOR
return !@armors[item.id].nil?
end
end

def new_item_variant(item, type, called = false)
id = item.id
case type
when 0 # ITEM
var = @variants[0][id].nil? ? @variants[0][id] = 0 : @variants[0][id]
@variants[0][id] += 1
@items[id][var] = {}
@items[id][var][:item] = $data_items[id].dup
@items[id][var][:item].variation = var
set_inventory(true, @items[id][var][:item])
@items[id][var][:lost] = false
when 1 # WEAPON
var = @variants[1][id].nil? ? @variants[1][id] = 0 : @variants[1][id]
@variants[1][id] += 1
@weapons[id][var] = {}
@weapons[id][var][:weapon] = $data_weapons[id].dup
@weapons[id][var][:weapon].variation = var
set_inventory(true, @weapons[id][var][:weapon])
@weapons[id][var][:equipped] = false # not visible flag
@weapons[id][var][:equip_to] = nil # id of the actor wearing equipment
@weapons[id][var][:lost] = false
when 2 # ARMOR
var = @variants[2][id].nil? ? @variants[2][id] = 0 : @variants[2][id]
@variants[2][id] += 1
@armors[id][var] = {}
@armors[id][var][:armor] = $data_armors[id].dup
@armors[id][var][:armor].variation = var
set_inventory(true, @armors[id][var][:armor])
@armors[id][var][:equipped] = false # not visible flag
@armors[id][var][:equip_to] = nil # id of the actor wearing equipment
@armors[id][var][:lost] = false
end
return var if called
end

end
#===============================================================================
# Game_Party
#===============================================================================
class Game_Party

include SPG::EquipSystem

alias spg_equipsystem_game_party_ini initialize unless $@
alias spg_equipsystem_game_party_in item_number unless $@
alias spg_equipsystem_game_party_ssm setup_starting_members unless $@

attr_reader :stored_item_data

def initialize
spg_equipsystem_game_party_ini
@stored_item_data = Game_StoredItemData.new
end

def setup_starting_members
spg_equipsystem_game_party_ssm
@stored_item_data.setup
end

def items
result = []
@stored_item_data.inventory.each { |item|
next if item.nil?
if item.is_a?(Array)
result.push item[0] if !item[0].nil?
next
else
result.push item
end
}
return result
end

def unstackable?(item)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
type2 = type == 0 ? 'items' : type == 1 ? 'weapons' : 'armors'
if UNSTACKABLE[type2].is_a?(TrueClass)
return true
elsif UNSTACKABLE[type2].is_a?(FalseClass)
return false
elsif UNSTACKABLE[type2].is_a?(Array)
return UNSTACKABLE[type2].include?(item.id)
end
end

def item_number(item)
return 1 if !@stored_item_data.inventory.find{|i| i == item}.nil?
a = @stored_item_data.inventory.find{ |i| i.is_a?(Array) and i[0].id == item.id}
number = a.nil? ? 0 : a[1]
return number
end

def has_usable_item?(item, include_equip = false)
return true unless item.is_a?(RPG::Item) && !include_equip
type = item.is_a?(RPG::Item) ? 'items' : item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
return eval("@stored_item_data.#{type}[item.id].values.find_all{|var|
!var[:equpped] and !var[:lost]}.size > 0")
end

def has_item?(item, include_equip = false)
if item_number(item) > 0
return true
end
if include_equip
for actor in members
return true if actor.equips.include?(item)
end
end
return false
end

def gain_item(item, n, include_equip = false)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
type2 = type == 0 ? 'items' : type == 1 ? 'weapons' : 'armors'
@stored_item_data.new_item_data(item, type) unless @stored_item_data.item_data_exists?(item, type)
number = item_number(item)
for i in 0...n
@stored_item_data.add_item(item) unless number + i > 99
end
end

def lose_item(item, n, include_equip = false)
number = item_number(item)
type = item.is_a?(RPG::Item) ? 0 : item.is_a?(RPG::Weapon) ? 1 : 2
for i in 0...n
@stored_item_data.remove_item(item)
end
if include_equip
for actor in member
if actor.equips.include?(item) and number - n < 0
actor.discard_equip(item)
end
end
end
end

def consume_item(item)
if item.is_a?(RPG::Item) and item.consumable
lose_item(item, 1)
end
end

def item_can_use?(item)
return false unless item.is_a?(RPG::Item)
return false if item_number(item) == 0
if $game_temp.in_battle
return item.battle_ok?
else
return item.menu_ok?
end
end

end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor

attr_accessor :weapon_var
attr_accessor :armor1_var
attr_accessor :armor2_var
attr_accessor :armor3_var
attr_accessor :armor4_var

alias spg_equip_system_game_actor_ce change_equip unless $@

def equip_data
result = []
result.push($data_weapons[@weapon_id])
two_swords_style ? result.push($data_weapons[@armor1_id]) : result.push($data_armors[@armor1_id])
for i in [2, 3, 4]
armor = eval("$data_armors[@armor#{i}_id]")
result.push(armor)
end
return result
end

def weapons
result = []
sd = $game_party.stored_item_data.weapons
if @weapon_id != 0 and @weapon_var != nil
result.push(sd[@weapon_id][@weapon_var][:weapon])
else
result.push(nil)
end
if two_swords_style
if @armor1_id != 0 and @armor1_var != nil
result.push(sd[@armor1_id][@armor1_var][:weapon])
else
result.push(nil)
end
end
return result
end

def armors
result = []
sd = $game_party.stored_item_data.armors
unless two_swords_style
if @armor1_id != 0 and @armor1_var != nil
result.push(sd[@armor1_id][@armor1_var][:armor])
else
result.push(nil)
end
end
for i in [2, 3, 4]
txt = "if @armor#{i}_id != 0 and @armor#{i}_var != nil;
result.push(sd[@armor#{i}_id][@armor#{i}_var][:armor]);
else;
result.push(nil);
end"
eval(txt)
end
return result
end

def change_equip(equip_type, item, test = false)
last_item = equips[equip_type]
unless test
return if $game_party.item_number(item) == 0 if item != nil
unless last_item.nil?
type = last_item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
st = eval("$game_party.stored_item_data.#{type}[last_item.id]")
$game_party.stored_item_data.unequip_item(last_item)
end
unless item.nil?
type = item.is_a?(RPG::Weapon) ? 'weapons' : 'armors'
st = eval("$game_party.stored_item_data.#{type}[item.id]")
$game_party.stored_item_data.equip_item(item, self.id)
end
end
item_id = item.nil? ? 0 : item.id
var = item.nil? ? nil : item.variation
case equip_type
when 0 # Weapon
@weapon_id = item_id
@weapon_var = var
when 1 # Shield
@armor1_id = item_id
@armor1_var = var
when 2 # Head
@armor2_id = item_id
@armor2_var = var
when 3 # Body
@armor3_id = item_id
@armor3_var = var
when 4 # Accessory
@armor4_id = item_id
@armor4_var = var
end
end

end
#===============================================================================
# Window_Item
#===============================================================================
class Window_Item < Window_Selectable

def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
unless $game_party.unstackable?(item)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
end

end
#===============================================================================
# END
#===============================================================================


Addons
Spoiler:

Item Durability
Spoiler:

CODE

#===============================================================================
# [SPG] Equipment Durability
# by: sparkyg13
#-------------------------------------------------------------------------------
# a script that adds durability to armor and weapons.
#-------------------------------------------------------------------------------
# to set an item's maximum durability place:
# "<durability_max = n>" (without quotes)
# where n is equal to the maximum value
#===============================================================================
module SPG
module EquipDura
#===============================================================================
# CONFIG
#===============================================================================

# cost to repair 1 durability point.
COST_PER_DURABILITY_POINT = 1

VOCAB = {

:repair => "Repair",
:repair_all => "Repair All",
:repair_all_help => "Repairs all items",

}

#===============================================================================
# END CONFIG
#===============================================================================
end
end
#===============================================================================
# RPG::BaseItem
#===============================================================================
class RPG::BaseItem

def durability=(n)
return if unbreakable?
@durability = [[n, 0].max, max_durability].min
end

def durability
@durability = @durability.nil? ? max_durability : @durability.to_i
return @durability
end

def max_durability
self.note.scan(/<durability_max[ ]=(.*)>/i)
return $1.nil? ? -1 : $1.to_i
end

def broken?; return @durability == 0; end
def unbreakable?; return max_durability == -1; end

end
#===============================================================================
# RPG::Weapon
#===============================================================================
class RPG::Weapon

def atk; return broken? ? 0 : @atk; end
def def; return broken? ? 0 : @def; end
def spi; return broken? ? 0 : @spi; end
def agi; return broken? ? 0 : @agi; end
def fast_attack; return broken? ? false : @fast_attack; end
def dual_attack; return broken? ? false : @dual_attack; end
def critical_bonus; return broken? ? false : @critical_bonus; end
def element_set; return broken? ? [] : @element_set; end
def state_set; return broken? ? [] : @state_set; end

def price
return ((@price * durability) / max_durability)
end

end
#===============================================================================
# RPG::Armor
#===============================================================================
class RPG::Armor

def atk; return broken? ? 0 : @atk; end
def def; return broken? ? 0 : @def; end
def spi; return broken? ? 0 : @spi; end
def agi; return broken? ? 0 : @agi; end
def prevent_critical; return broken? ? false : @prevent_critical; end
def half_mp_cost; return broken? ? false : @half_mp_cost; end
def double_exp_gain; return broken? ? false : @double_exp_gain; end
def auto_hp_recover; return broken? ? false : @auto_hp_recover; end
def element_set; return broken? ? [] : @element_set; end
def state_set; return broken? ? [] : @state_set; end

def price
return ((@price * durability) / max_durability)
end

end
#===============================================================================
# Scene_Battle
#===============================================================================
class Scene_Battle

alias spg_equip_durability_scene_battle_dhd display_hp_damage unless $@

def display_hp_damage(target, obj = nil)
spg_equip_durability_scene_battle_dhd(target, obj)
if target.hp_damage > 0
act = target.actor? ? target : @active_battler
ene = target.actor? ? @active_battler : target
act.do_dura_loss(target.actor?, ene)
end
end

end
#===============================================================================
# Game_Battler
#===============================================================================
class Game_Battler

def do_dura_loss(actor, obj)
if actor # actor is target : armor durability loss
damage = obj.atk * 4
base = [damage, 1].max
for armor in armors
next if armor.nil? || armor.unbreakable?
d = rand(base / 4)
armor.durability -= (d / armors.compact.size)
end
else # enemy is target : weapon durablity loss
damage = self.atk * 4
base = [obj.maxhp - damage, 1].max
for weapon in weapons
next if weapon.nil? || weapon.unbreakable?
d = rand(base / 4)
weapon.durability -= (d / weapons.compact.size)
end
end
end

end
#===============================================================================
# Window_Base
#===============================================================================
class Window_Base

alias spg_equip_durability_window_base_din draw_item_name unless $@

def draw_item_name(item, x, y, enabled = true)
spg_equip_durability_window_base_din(item, x, y, enabled)
return if item.nil?
unless self.is_a?(Window_ShopBuy) || self.is_a?(Window_ShopNumber)
draw_item_dura_gauge(x, y, item) if !item.unbreakable? && !item.unsigned?
end
end

def draw_item_dura_gauge(x, y, item)
gw = 20 * item.durability / item.max_durability
gc1 = Color.new(0, 55, 0)
gc2 = Color.new(255, 30, 0)
self.contents.fill_rect(x+2, y+20, 20, 3, gc2)
self.contents.fill_rect(x+2, y+20, gw, 3, gc1)
end

end
#===============================================================================
# Scene_Shop
#===============================================================================
class Scene_Shop

alias spg_equip_durability_scene_shop_sta start unless $@
alias spg_equip_durability_scene_shop_upd update unless $@
alias spg_equip_durability_scene_shop_ucs update_command_selection unless $@

def start
@can_repair = $game_temp.shop_repair
spg_equip_durability_scene_shop_sta
@repair_window = Window_ShopRepair.new(0, 112, 544, 304)
@repair_window.active = false
@repair_window.visible = false
@repairing_window = Window_ShopRepairing.new(0, 112)
@repairing_window.active = false
@repairing_window.visible = false
$game_temp.shop_repair = true
end

def create_command_window
s1 = Vocab::ShopBuy
s2 = Vocab::ShopSell
s3 = SPG::EquipDura::VOCAB[:repair]
s4 = Vocab::ShopCancel
@command_window = Window_Command.new(384, [s1, s2, s3, s4], 4, 0, 8)
@command_window.y = 56
if $game_temp.shop_purchase_only
@command_window.draw_item(1, false)
end
if !@can_repair
@command_window.draw_item(2, false)
end
end

def update
spg_equip_durability_scene_shop_upd
if @repair_window.active
@repair_window.update
update_repair
elsif @repairing_window.active
@repairing_window.update
update_repairing
end
end

def update_command_selection
if Input.trigger?(Input::C)
case @command_window.index
when 2
Input.update
if !@can_repair
Sound.play_buzzer
else
Sound.play_decision
@command_window.active = false
@dummy_window.visible = false
@repair_window.active = true
@repair_window.visible = true
@repair_window.refresh
@repair_window.help_window = @help_window
end
return
when 3
Sound.play_decision
$scene = Scene_Map.new
return
end
end
spg_equip_durability_scene_shop_ucs
end

def update_repair
if @repair_window.repair_all?
@help_window.set_text(SPG::EquipDura::VOCAB[:repair_all_help])
end
if Input.trigger?(Input::cool.gif
Sound.play_cancel
@repair_window.active = false
@repair_window.visible = false
@dummy_window.visible = true
@command_window.active = true
@help_window.set_text("")
return
elsif Input.trigger?(Input::C)
@item = @repair_window.item
return Sound.play_buzzer unless @repair_window.enable?(@item)
@repairing_window.item = @item
@repairing_window.refresh
Input.update
Sound.play_decision
@repair_window.visible = false
@repair_window.active = false
@repairing_window.active = true
@repairing_window.visible = true
end

end

def update_repairing
if Input.trigger?(Input::cool.gif
Sound.play_cancel
@repairing_window.active = false
@repairing_window.visible = false
@repair_window.visible = true
@repair_window.active = true
elsif Input.trigger?(Input::C)
Input.update
case @repairing_window.i
when 0 # yes
return Sound.play_buzzer if $game_party.gold < @repairing_window.repair_cost
$game_party.lose_gold(@repairing_window.repair_cost)
if @item.nil?
for item in $game_party.items
item.durability = item.max_durability
end
else
@item.durability = @item.max_durability
end
Sound.play_shop
when 1
Sound.play_cancel
end
@repairing_window.active = false
@repairing_window.visible = false
@repair_window.visible = true
@repair_window.active = true
@repair_window.refresh
@gold_window.refresh
end
end

end
#===============================================================================
# Window_ShopRepair
#===============================================================================
class Window_ShopRepair < Window_ShopSell

def include?(item)
return true if item.nil?
return (item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor))
end

def enable?(item)
return need_repair_items.compact.size > 0 if item.nil?
return (item.durability < item.max_durability)
end

def repair_all?
return self.index == @data.size - 1
end

def draw_item(i)
super(i)
rect = item_rect(@data.size - 1)
rect.width -= 4
default_alpha = self.contents.font.color.alpha
enabled = enable?(nil)
self.contents.font.color.alpha = enabled ? 255 : 128
ra = SPG::EquipDura::VOCAB[:repair_all]
self.contents.draw_text(rect, ra, 1)
self.contents.font.color.alpha = default_alpha
end

def need_repair_items
result = []
for item in @data
next if item.nil?
result << item if item.durability < item.max_durability
end
return result
end

end
#===============================================================================
# Window_ShopRepairing
#===============================================================================
class Window_ShopRepairing < Window_Base

attr_accessor :item
attr_reader :i

def initialize(x, y)
super(x, y, 544, 304)
@item = nil
@i = 0
refresh
end

def update
super
if self.active
if Input.trigger?(Input::RIGHT) and @i != 1
Sound.play_cursor
@i = 1
refresh
elsif Input.trigger?(Input::LEFT) and @i != 0
Sound.play_cursor
@i = 0
refresh
end
else
@i = 0
end
end

def repair_cost
cost = 0
cpd = SPG::EquipDura::COST_PER_DURABILITY_POINT
if @item.nil?
for item in $game_party.items
if item.durability < item.max_durability
cost += (cpd*(item.max_durability - item.durability))
end
end
else
if @item.durability < @item.max_durability
cost = (cpd*(@item.max_durability - @item.durability))
end
end
return cost
end

def refresh
y = 96
self.contents.clear
text = @item.nil? ? "all equipment" : @item.name
self.contents.draw_text(0, 0, 544, WLH, "Repair #{text}?")
draw_currency_value(repair_cost, 4, y + WLH * 2, 264)
y_rect = Rect.new(self.width/2 * 0, y, self.width/2 - 32, WLH)
n_rect = Rect.new(self.width/2 * 1, y, self.width/2 - 32, WLH)
self.contents.font.color = normal_color
self.contents.draw_text(y_rect, "Yes", 1)
self.contents.draw_text(n_rect, "No", 1)
self.cursor_rect.set(self.width/2 * @i, y, self.width/2 - 32, WLH)
end

end
#===============================================================================
# Game_Temp
#===============================================================================
class Game_Temp

def shop_repair
return @shop_repair.nil? ? true : @shop_repair
end

def shop_repair=(bool)
@shop_repair = bool
end

end
#===============================================================================
# END
#===============================================================================



..more to come smile.gif


Credit
please credit me (sparkyg13) if you use this script


This post has been edited by kyros2000: Feb 17 2012, 06:10 PM
Go to the top of the page
 
+Quote Post
   
kyros2000
post Feb 17 2012, 06:14 PM
Post #3



Group Icon


Type: Coder




Sorry about the previous post. Now if I am not mistaken this just may be the script I have been waiting for to be released.
Correct me if I am wrong, but doesn't this script allow for specific customizations or variants to specific instances of either
an item, weapon, or armor? I need to know if that is the case and by looking at the code you make an exact replica of the
internal game inventory and then allow for the built in way to customize/variant equipment. I was thinking now of using
this to implement a blacksmith type system to build upon the customized specific instances of either an item, weapon, or
armor. I just need some verification that this could be used for that purpose. Thank you very much smile.gif A very nice script.
Go to the top of the page
 
+Quote Post
   
sparkyg13
post Feb 17 2012, 06:22 PM
Post #4


x^2
Group Icon


Type: Coder
Alignment: Unaligned




yep that's about exactly what it does smile.gif, and feel free to make your own addons as well I'd be more than happy to add them to the topic

Edit: let me elaborate, you should be able to call specific item variations with just a variable call, this will allow for specific item modification even to the point of altering the weapon entirely but still keeping it separate from other items of the same type. The Game_StoredItemData class handles all of the functions associated with storing items, with some modifications to the base class methods that allow for switching items or adding them to your inventory, the inventory is also handled by the class mentioned before.

This post has been edited by sparkyg13: Feb 17 2012, 06:29 PM


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
kyros2000
post Feb 17 2012, 07:06 PM
Post #5



Group Icon


Type: Coder




One last question I have, is all the modified items/equipment are saved externally so that when you save your modified changes
and quit the game? You load the game later and all the changes you had done to a specific instance will be saved? I am only
asking because some scripters forget about that part when they make anything that requires a changed state to something
like items etc. Thank you for your quick responses.
Go to the top of the page
 
+Quote Post
   
sparkyg13
post Feb 17 2012, 07:08 PM
Post #6


x^2
Group Icon


Type: Coder
Alignment: Unaligned




as long as you have started a new game after installing the script, the data is saved as part of the Game_Party class so all of the data will be stored there upon restarting the game.


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
sparkyg13
post Feb 17 2012, 07:56 PM
Post #7


x^2
Group Icon


Type: Coder
Alignment: Unaligned




Update: added the equipment quality add-on smile.gif


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
kyros2000
post Feb 17 2012, 09:53 PM
Post #8



Group Icon


Type: Coder




QUOTE (sparkyg13 @ Feb 17 2012, 07:56 PM) *
Update: added the equipment quality add-on smile.gif


Coincidentally enough, the rarity of equipment was another awesome idea I was thinking about. You just made that happen once again. That
will go great with my Rare Goods Shop in which I can do a random percentage chance of picking a somewhat rarer item to display in a shop
with the rarest being the lowest percentage to load. You have been a lot of help greatly. Keep up the good work.

This post has been edited by kyros2000: Feb 17 2012, 09:54 PM
Go to the top of the page
 
+Quote Post
   
Nelderson
post Feb 17 2012, 10:58 PM
Post #9



Group Icon


Type: Designer
Alignment: Lawful Good




Dude.....NICE! I tried my hand at this a little while ago, but stopped once I realized how much of a bitch it was to iterate every variant of a particular Weapon/Item/Skill after duplication.


I'm glad to see that there are people like you who aren't lazy! tongue.gif




Keep up the good work! Look forward to more add-ons from you! laugh.gif


--------------------
STOP BEING A JAPFAG CRIMSON!!!

Meh.....F$#@ you Mike <=== Still applies....<_<
Go to the top of the page
 
+Quote Post
   
sparkyg13
post Feb 17 2012, 11:08 PM
Post #10


x^2
Group Icon


Type: Coder
Alignment: Unaligned




QUOTE (Nelderson @ Feb 17 2012, 07:58 PM) *
Dude.....NICE! I tried my hand at this a little while ago, but stopped once I realized how much of a bitch it was to iterate every variant of a particular Weapon/Item/Skill after duplication.


I'm glad to see that there are people like you who aren't lazy! tongue.gif




Keep up the good work! Look forward to more add-ons from you! laugh.gif


thank you very much smile.gif, i actually had written this awhile ago, but never got around to posting it..
the next add-on will be one that gives your weapon/armors levels and can be upgraded and given more stats
expect it soon biggrin.gif


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
IXFURU
post Feb 20 2012, 04:45 PM
Post #11


just a nut trying to keep away the squirrels
Group Icon


Type: Undisclosed
Alignment: Lawful Evil




Hey. You deserve a lot of credit for this. If it's compatible with some of the other scripts in my game unsure.gif , it should be a great addition. Keep coding, man! biggrin.gif


--------------------




To Support:


Spoiler:
CODE
[url="http://www.rpgmakervx.net/index.php?showtopic=57406"][img]http://i16.photobucket.com/albums/b38/Dwiguitar/TheFinishLineUserBar_zps63f6f475.png[/img][/url]


I support:


Spoiler:







I actually won something...Can you believe that?!

Spoiler:



Go to the top of the page
 
+Quote Post
   
sparkyg13
post Feb 20 2012, 07:43 PM
Post #12


x^2
Group Icon


Type: Coder
Alignment: Unaligned




QUOTE (IXFURU @ Feb 20 2012, 12:45 PM) *
Hey. You deserve a lot of credit for this. If it's compatible with some of the other scripts in my game unsure.gif , it should be a great addition. Keep coding, man! biggrin.gif

thank you



UPDATE: Fixed a bug that caused some items to not display in the item menu.

UPDATE: New Equipment Upgrades add-on added

This post has been edited by sparkyg13: Feb 24 2012, 05:03 PM


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
Benos
post Feb 26 2012, 03:25 AM
Post #13



Group Icon


Type: Writer




I put them all one space at time and got a error from the Item Durability


---------------------------
Spirit Guardians: The Mask Of Xen
---------------------------
Script 'Advanced Equip System' line 273: NoMethodError occurred.

undefined method `inventory' for nil:NilClass
---------------------------
OK
---------------------------


Getting some errors, you mean above Main inside Materials?
and delete the insert materials one?

This post has been edited by Benos: Feb 26 2012, 03:30 AM
Go to the top of the page
 
+Quote Post
   
sparkyg13
post Feb 26 2012, 04:12 AM
Post #14


x^2
Group Icon


Type: Coder
Alignment: Unaligned




yep inside materials and above main, be sure to put add-ons below the base script. And try starting a new game as well, if you haven't already tried that.


--------------------
/yawn
Go to the top of the page
 
+Quote Post
   
comarck
post Oct 4 2012, 07:02 AM
Post #15



Group Icon


Type: Undisclosed




Hey! I tried to use [SPG] Equipment System and [SPG] Equipment Levels scripts in my new project.
I placed them under materials like this:
-------------------------------------------------
Materials
(instert here)
eq system
eq levels

Main process
-------------------------------------------------
But when i try to run new game i get this error:
Script eq level line 370 syntax error.

Here is line 370 itself:
Sound.play_cancel
Plz help ( i know it is noobish question, but i just started with my new game and all scripting seems difficult to understand at moment...)
Go to the top of the page
 
+Quote Post
   
???nOBodY???
post Oct 13 2012, 08:32 AM
Post #16


moogles + nightmares + coffee = Scripting Psychopathic Tendency
Group Icon


Type: Coder
Alignment: Chaotic Neutral




Probably due to the codeboxes. I'd suggest the OP post the scripts in a set of code tags (not codeboxes), nested within their respective spoiler tags as well.


--------------------
*The Master List Update Project is currently up-to-date with the latest scripts for that dream project!
*By entering the RGSS2/Ruby Scripting section, you are agreeing to abide by The Coder's Creed.

My Scripts
Spoiler:

ACK Script Requests
Spoiler:

Scripts
Stat Change Formulas
GTBS Ziifee's spin menu Submenus
GTBS Weapon Unleash
GTBS Enemy Status
Attack Command Submenu
Jump To (X,Y)
BGM/BGS Fadein
Window_Message - Pop Text
Spell Management Menu
Melee Mastery Management Menu
Ghost List
Save / Autoload
Some Popup v2.9 => v2.91
Scene_StringEntry v1.02
Scene_StringEntry: More Than 24-Character Input
Scene_StringEntry: Scrolling Character Input Window
Scene_StringEntry: Typing Input
MA's Quest Journal - Accept Quest Add-On (internal)
MA's Quest Journal - Accept Quest Add-On (external)
Easy-to-Add Extra Ziifee Spin Commands
Scrolling Battle Message
Non-Differentiating Enemies
Quest Item Drops
(VX) FP Conditional Drops
FFTA World Map HUD bugfix
RSSBS / SSS - Wereforms patch
Death Counterattack
Targetting Extension

My Heart (Resources)
Spoiler:

Projects
Project AMBROSIA
*something generically clever*

Support these:
Spoiler:







Awards:
Spoiler:

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 26th July 2014 - 12:18 PM

RPGMakerVX.net is an Privacy Policy, Legal.