=begin
Ninja Throw script by LockeZ
Allows any skill to consume either an item or a weapon
Utilize for whatever you want, no credit necessary
This script does not use notetags, because screw you. Instead, near the top of
the script is a place to put lines indicating which skills require
which items/weapons. There are some example lines which you may delete.
This script could also be used for any other type of skill
which consumes an item, such as gun or bow skills that require ammo,
or spells that require reagents. Weapons which are equipped cannot be thrown.
If you use this script to make a skill use up an item,
it can also still cost MP or TP like any other skill.
It is recommended that you name the skills the same names
as the weapons/items being thrown, since the cost is not shown.
If you want to show the cost, just put it in the skill's name.
Unlike Final Fantasy, skills appear in your skill list whether you own the item
or not, they're just grayed out if you don't have enough items to throw them.
This allows you to teach the player these skills any way you want,
so for example you might require a character to pay gold at a trainer to learn
the ability to throw mythril swords. If you want to dynamically add and remove
skills based on the player's inventory, like Final Fantasy,
then do that your own damn self with a common event.
Copy and paste the following
@ninja_throw_skill_items[x] = v
@ninja_throw_skill_weapons[x] = v
where x is the ID of the skill
and v is the ID of the item/weapon
=end
class Game_BattlerBase
attr_accessor :ninja_throw_skill_items
attr_accessor :ninja_throw_skill_weapons
alias ninja_throw_initialize initialize
def initialize
@ninja_throw_skill_items = {}
@ninja_throw_skill_weapons = {}
# Add your game's skills that use up items below this line.
# Examples follow.
@ninja_throw_skill_items[30] = 3 # Skill #30 requires item #3
@ninja_throw_skill_items[31] = 5 # Skill #31 requires item #5
@ninja_throw_skill_weapons[32] = 5 # Skill #32 requires weapon #5
ninja_throw_initialize
end
alias ninja_throw_skill_cost_payable? skill_cost_payable?
def skill_cost_payable?(skill)
if @ninja_throw_skill_items[skill.id] != nil
unless $game_party.has_item?($data_items[@ninja_throw_skill_items[skill.id]])
return false
end
end
if @ninja_throw_skill_weapons[skill.id] != nil
unless $game_party.has_item?($data_weapons[@ninja_throw_skill_weapons
[skill.id]])
return false
end
end
ninja_throw_skill_cost_payable?(skill)
end
alias ninja_throw_pay_skill_cost pay_skill_cost
def pay_skill_cost(skill)
if @ninja_throw_skill_items[skill.id] != nil
$game_party.lose_item($data_items[@ninja_throw_skill_items[skill.id]], 1)
end
if @ninja_throw_skill_weapons[skill.id] != nil
$game_party.lose_item($data_weapons[@ninja_throw_skill_weapons[skill.id]], 1)
end
ninja_throw_pay_skill_cost(skill)
end
end