I've been trying to use SephirothSpawn's 'Skill Use Item' script
http://www.rmxpu.net/staff/sephirothspawn/Script%20Files/Skills%20Use%20Items.txt
to make healing moves which require that an item be consumed to work.
It seems the 1st bit of the script is working since it understands that I need the item to use the skill, but when I use the skill it doesn't consume an item.
Also I was curious if I wanted multiple skills that each needed to consume there own individual item if I'd just add more Item_Cost lines with different skill numbers and item numbers or if I'd have to add a whole new script for each one.
This is what I have:
Thanks
http://www.rmxpu.net/staff/sephirothspawn/Script%20Files/Skills%20Use%20Items.txt
to make healing moves which require that an item be consumed to work.
It seems the 1st bit of the script is working since it understands that I need the item to use the skill, but when I use the skill it doesn't consume an item.
Also I was curious if I wanted multiple skills that each needed to consume there own individual item if I'd just add more Item_Cost lines with different skill numbers and item numbers or if I'd have to add a whole new script for each one.
This is what I have:
Code:
#==============================================================================
# ** Skills Use Items
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2006-10-15
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to make skill using consume items.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
# To customize skill item usage, refer to customization.
#------------------------------------------------------------------------------
# * Customization :
#
# Settings Skills That Use Items
# - Item_Cost = { skill_id => <item_cost>, ... }
#
# Replace <item_cost> with
# - { item_type => { id => n, ... }, ... }
#
# Item Types : 0 - Item, 1 - Weapons, 2 - Armors
#==============================================================================
#==============================================================================
# ** RPG::Skill
#==============================================================================
class RPG::Skill
#--------------------------------------------------------------------------
# * Skills That Use Items
#
# ~ skill_id => { item_type => { id => n, ... }, ...}
#
# Item_Types = 0 : Items, 1 : Weapons, 2 : Armors
#--------------------------------------------------------------------------
Item_Cost = {
84 => { 0 => { 33 => 1 } }
}
#--------------------------------------------------------------------------
# * Item Cost
#--------------------------------------------------------------------------
def item_cost
return ( Item_Cost.has_key?(@id) ? Item_Cost[@id] : {} )
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
alias seph_skillsuseitems_gmbtlr_skc? skill_can_use?
alias seph_skillsuseitems_gmbtlr_se skill_effect
#--------------------------------------------------------------------------
# * Determine if Skill can be Used
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# If Actor
if self.is_a?(Game_Actor)
# Checks All Skill Requirements
$data_skills[skill_id].item_cost.each do |item_type, ids|
# Items
if item_type == 0
ids.each do |id, n|
return false if $game_party.item_number(id) < n
end
# Weapons
elsif item_type == 1
ids.each do |id, n|
return false if $game_party.weapon_number(id) < n
end
# Armors
elsif item_type == 2
ids.each do |id, n|
return false if $game_party.armor_number(id) < n
end
end
end
end
# Return Original Test
return seph_skillsuseitems_gmbtlr_skc?(skill_id)
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# If Original Effect
if self.seph_skillsuseitems_gmbtlr_se(user, skill)
# If User is an Actor
if user.is_a?(Game_Actor)
# Lose Item Cost
skill.item_cost.each do |item_type, ids|
# Items
if item_type == 0
ids.each { |id, n| $game_party.lose_item(33, 0) }
# Weapons
elsif item_type == 1
ids.each { |id, n| $game_party.lose_weapon(id, n) }
# Armors
elsif item_type == 2
# Lose All Armors
ids.each { |id, n| $game_party.lose_armor(id, n) }
end
end
end
end
end
end
Thanks