Queex
Mar 20 2008, 11:22 AM
Skill Requirements SystemVersion 1.1
This allows you to add all kinds of requirements for skills using the note field for them. This requires TagNote v2.0. To use, all you have to do is add special lines to the notes field for the skill in question.
All requirements only check the first requirement of that type per skill, at the moment.
This is still currently experimental and largely untested. Please let me know if there are any problems with it or there's any unexpected behaviour.
<weapon_type x>
Requires a weapon with the same text in its notes field. Note that although a skill can only require on weapon type, weapons can have multiple types assigned to them, one per line formatted as above. 'x' is an arbitrary string.
<item_present x>
Requires a specific item to be with the party, equipped or not. 'x' is the id number of the item.
<item_consumed x>
<item_consumed x n>
Will consume a number of items and requires the party to have them to do so. 'x' is the id number of the item, 'n' the number to consume. If no 'n' is given, 1 is assumed.
<hp_percent_exceed p>
Requires the actor's hp total to be equal to or greater than p. 'p' is expressed as a percentage, but can be decimal.
<hp_percent_below p>
Requires the actor's hp total to be less than p. 'p' is expressed as a percentage, but can be decimal.
<mp_percent_exceed p>
<mp_percent_exceed p true>
Requires the actor's mp total to be equal to or greater than p. 'p' is expressed as a percentage, but can be decimal. If 'true' is included, then that proportion of the actor's mp will be consumed when the skill is used.
<mp_percent_below p>
Requires the actor's mp total to be less than p. 'p' is expressed as a percentage, but can be decimal.
<free_hand>
Requires the actor to have a free hand to use the skill.
<dual_weapon>
Requires the actor to be wielding two weapons.
<two_handed_weapon>
Requires the actor to be wielding a two-handed weapon.
CODE
###########################
# Requirements for Skills #
##############################################################################
# Version 1.0 #
# Author: Queex #
# Licence: Creative Commons Non-Commercial Attributive #
# Requires: TagNote 2.0+ #
##############################################################################
# Allows extra requirement before skills can be used. The requirements are #
# tags added to the notes field ofthe skills. Currently, only the first #
# requirement of a given type is checked. #
# #
# Tags that can be used in weapons: #
# <weapon_type xxx> #
# #
# Tags that can be used in items: #
# <include_battle_test> - makes this item available when testing battles #
# #
# Tags that can be used in skills: #
# <weapon_type xxx> - only weapons with this same type can use this skill #
# <item_present id> - the party must possess at least 1 item of that id #
# <item_consume id n> - the party must possess n items of that id, which #
# will be consumed. #
# <item_consume id> - the party must possess 1 item of that id, which will #
# be consumed. #
# <hp_percent_exceed per> - the actor's HP must equal or exceed this #
# percentage. #
# <hp_percent_below per> - the actor's HP must be below this percentage. #
# <mp_percent_exceed per> - the actor's MP must equal or exceed this #
# percentage. #
# <mp_percent_exceed per true> - the actor's MP must equal or exceed this #
# percentage, and that percentage will be #
# consumed. #
# <mp_percent_below per> - the actor's MP must be below this percentage. #
# <free_hand> - the actor must have at least one free hand. #
# <dual_weapon> - the actor must be using two weapons. #
# <two_handed_weapon> - the actor must be using a two-handed weapon. #
# #
# Note: #
# This script also includes the function hands_free which returns the #
# number of free hands for a Game_Actor. #
# #
# Version History: #
# 0.4 - test release #
# 0.5 - can specify some item to include in battle test #
# 1.0 - Bugfix and update to TagNote 2.0 *RELEASE* #
##############################################################################
class Game_Actor < Game_Battler
include TAGNOTE
def hands_free
if weapons[0]==nil
if @armor1_id[0]==0
return 2
elsif weapons.length==2
if weapons[1].two_handed
return 0
else
return 1
end
else
return 1
end
elsif weapons[0].two_handed or @armor1_id!=0
return 0
else
return 1
end
end
alias skill_req_skill_can_use? skill_can_use?
def skill_can_use?(skill)
if skill.id != 0
skill_note=$data_skills[skill.id].note
#Check for weapon type
skill_needs = get_tag(skill_note,"weapon_type") #weapon type string
if skill_needs != nil
if two_swords_style
if @weapon_id!=0 and @armor1_id!=0
return false unless has_tag_value?($data_weapons[@weapon_id].note,"weapon_type",skill_needs) or has_tag_value?($data_weapons[@armor1_id].note,"weapon_type",skill_needs)
elsif @weapon_id!=0
return false unless has_tag_value?($data_weapons[@weapon_id].note,"weapon_type",skill_needs)
elsif @armor1_id!=0
return false unless has_tag_value?($data_weapons[@armor1_id].note,"weapon_type",skill_needs)
else
return false
end
else
return false unless @weapon_id!=0
return false unless has_tag_value?($data_weapons[@weapon_id].note,"weapon_type",skill_needs)
end
end
#Check for item presence
skill_needs = get_tag(skill_note,"item_present") #item id
if skill_needs != nil
return false unless $game_party.has_item?($data_items[skill_needs.to_i],true)
end
#Check for item consumption
skill_needs = get_tag(skill_note,"item_consume") #item id
if skill_needs !=nil
skill_needs_num = get_additional_tag(skill_note,"item_consume",2) #number
if skill_needs_num == nil
skill_needs_num = 1
end
return false unless $game_party.item_number($data_items[skill_needs.to_i])>=skill_needs_num.to_i
end
#Check for HP exceeds
skill_needs = get_tag(skill_note,"hp_percent_exceed") #percent
if skill_needs !=nil
return false unless (100.0 * @hp/maxhp)>=skill_needs.to_f
end
#Check for HP below
skill_needs = get_tag(skill_note,"hp_percent_below") #percent
if skill_needs != nil
return false unless (100.0 * @hp/maxhp)<skill_needs.to_f
end
#Check for MP exceeds
skill_needs = get_tag(skill_note,"mp_percent_exceed") #percent
if skill_needs != nil
return false unless (100.0 * @mp/maxmp)>=skill_needs.to_f
end
#Check for MP below
skill_needs = get_tag(skill_note,"mp_percent_below") #percent
if skill_needs != nil
return false unless (100.0* @mp/maxmp)<skill_needs.to_f
end
#Check for free hand
skill_needs = has_tag?(skill_note,"free_hand") #boolean
if skill_needs
return false unless hands_free>=1
end
#Check for dual weapons
skill_needs = has_tag?(skill_note,"dual_weapon") #boolean
if skill_needs
return false unless two_swords_style
return false unless weapons[0]!=nil and weapons[1]!=nil
end
#Check for two-handed weapon
skill_needs = has_tag?(skill_note,"two_handed_weapon") #boolean
if skill_needs
return false unless ( weapons[0]!= nil and weapons[0].two_handed)
if two_swords_style
return false unless ( weapons[0]!= nil and weapons[0].two_handed) or (weapons[1] != nil and weapons[1].two_handed)
end
end
return skill_req_skill_can_use?(skill)
end
end
def calc_mp_cost(skill)
base_cost=skill.mp_cost
mp_prop=get_tag(skill.note,"mp_percent_exceed")
if mp_prop!=nil
mp_lose=get_additional_tag_value(skill.note,"mp_percent_exceed",2)
if mp_lose.eql?("true")
base_cost=(mp_prop.to_f/100.0 * maxmp).to_i
end
end
if half_mp_cost
return base_cost / 2
else
return base_cost
end
end
end
class Scene_Battle < Scene_Base
include TAGNOTE
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
alias skill_req_execute_action_skill execute_action_skill
def execute_action_skill
skill_req_execute_action_skill
skill = @active_battler.action.skill
#consume items required
skill_needs = get_tag(skill.note,"item_consume")
if skill_needs != nil
num_items = get_additional_tag(skill.note,"item_consume",2)
if num_items==nil
num_items=1
end
$game_party.lose_item($data_items[skill_needs.to_i],num_items.to_i,true)
end
end
end
class Game_Party < Game_Unit
include TAGNOTE
alias skill_req_setup_battle_test_members setup_battle_test_members
def setup_battle_test_members
skill_req_setup_battle_test_members
for i in 1...$data_items.size
if has_tag?($data_items[i].note,"include_battle_test")
@items[i] = 99
end
end
end
end
This script is part of the Queex script collection:
http://chthonic.150m.com/scratch/Queex_scripts.zip
RoxasXIII
Mar 20 2008, 01:00 PM
Sorry but this is really easy to do using events and common events.It may still be useful.
Queex
Mar 20 2008, 02:05 PM
I'm pretty sure it isn't. Common events don't seem to allow you to, say, see who's currently acting easily, which makes it tricky to check if they have the right weapon. The common event model would seem to fall down if two characters have access to the same skill, because there doesn't seem to be an easy way to differentiate.
Plus, if you plan on having a lot of skills with special prerequisites it's a lot easier to create and maintain a couple of lines in the notes field than a pile of events. Also, it looks like the event is called when the skill is used, so the skill won't be greyed out if its unusable.
I could be wrong, though.
There is another script in this forum for managing weapon requirements- so I thought there was at least a use for it.
Warder
Mar 20 2008, 07:20 PM
Actually, I think this is pretty damned useful. This should be helpful for the VX project I've been working on. Thanks Queex .
SuperMaxZero
Mar 24 2008, 03:22 PM
Yeah, this is very useful. I was bummed out that the ammo script only worke4d in XP, but this is even better.
Thanks, Queex.
EDIT: Hmm...I seem to be pretty confused on what to do. <_> Could you give an example of how to script, for example, an "item present" skill?
SeeYouAlways
Mar 26 2008, 07:00 PM
Hmm, I like this script! I was figuring out how to do such things with events but... No luck. Thanks.
Mr_E_Man
Mar 26 2008, 09:12 PM
This is very useful, especially if you have skills that consume ammunition, or a skill that's only available if a character is near death.
Queex
Mar 27 2008, 02:41 AM
A quick example.
If you have, in the notes field for the skill:
<item_present 3>
<item_consumed 4 2>
<weapon_type badger>
Then the skill can only used by an actor wielding a weapon with the line <weapon_type badger> in its notes field. It also requires item number 3 to be in the party inventory, and at least two item number 4s which will be used up by the skill.
ryuujin5
Mar 27 2008, 06:56 AM
I'm getting an error with the item present line as well. I have the associated item in id 22, with <item_present 22> in the notes of the skill, but when I try to use Skills in battle (not the specific skill, but opening the skill menu) i get this:
???? 'Prereqs' ? 50 ?? TypeError ????
cannot convert String into Integer
Prereqs is what I named the script to keep things simple, and here is the code section:
CODE
#Check for item presence
skill_needs = getTag(skill_note,"item_present") #item id
if skill_needs != nil
return false unless $game_party.has_item?($data_items[skill_needs],true)
end
I'm getting the error at "return false unless" line. Ideas?
Queex
Mar 27 2008, 07:04 AM
Try this:
CODE
#####################################
# Check for requirements for skills #
#####################################
class Game_Actor < Game_Battler
def hands_free
if weapons[0]==nil
if weapons[1]==nil
if @armour_id[0]==nil
return 2
else
return 1
end
elsif weapons[1].two_handed
return 0
else
if @armour_id[0]==nil
return 1
else
return 0
end
end
elsif weapons[0].two_handed
return 0
elsif weapons[1]!=nil or @armour_id[0]!=nil
return 0
else
return 1
end
end
def skill_can_use?(skill)
#Usual checks
return false unless skill_learn?(skill)
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
return false if calc_mp_cost(skill) > mp
if skill.id != 0
skill_note=$data_skills[skill.id].note
#Check for weapon type
skill_needs = getTag(skill_note,"weapon_type") #weapon type string
if skill_needs != nil
return false unless @weapon_id!=0
return false unless hasTagValue($data_weapons[@weapon_id].note,"weapon_type",skill_needs)
end
#Check for item presence
skill_needs = getTag(skill_note,"item_present") #item id
if skill_needs != nil
return false unless $game_party.has_item?($data_items[skill_needs.to_i],true)
end
#Check for item consumption
skill_needs = getTag(skill_note,"item_consume") #item id
if skill_needs !=nil
skill_needs_num = getTagAdditionalValue(skill_note,"item_consume",2) #number
if skill_needs_num == nil
skill_needs_num = 1
end
return false unless $game_party.item_number($data_items[skill_needs.to_i])>=skill_needs_num.to_i
end
#Check for HP exceeds
skill_needs = getTag(skill_note,"hp_percent_exceed") #percent
if skill_needs !=nil
return false unless (100.0 * @hp/maxhp)>=skill_needs.to_f
end
#Check for HP below
skill_needs = getTag(skill_note,"hp_percent_below") #percent
if skill_needs != nil
return false unless (100.0 * @hp/maxhp)<skill_needs.to_f
end
#Check for MP exceeds
skill_needs = getTag(skill_note,"mp_percent_exceed") #percent
if skill_needs != nil
return false unless (100.0 * @mp/maxmp)>=skill_needs.to_f
end
#Check for MP below
skill_needs = getTag(skill_note,"mp_percent_below") #percent
if skill_needs != nil
return false unless (100.0* @mp/maxmp)<skill_needs.to_f
end
#Check for free hand
skill_needs = hasTag(skill_note,"free_hand") #boolean
if skill_needs
return false unless hands_free>=1
end
#Check for dual weapons
skill_needs = hasTag(skill_note,"dual_weapon") #boolean
if skill_needs
return false unless weapons[0]!=nil and weapons[1]!=nil
end
#Check for two-handed weapon
skill_needs = hasTag(skill_note,"two_handed_weapon") #boolean
if skill_needs
return false unless ( weapons[0]!= nil and weapons[0].two_handed) or (weapons[1] != nil and weapons[1].two_handed)
end
end
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
def calc_mp_cost(skill)
base_cost=skill.mp_cost
mp_prop=getTag(skill.note,"mp_percent_exceed")
if mp_prop!=nil
mp_lose=getTagAdditionalValue(skill.note,"mp_percent_exceed",2)
if mp_lose.eql?("true")
base_cost=mp_prop.to_f * maxmp
end
end
if half_mp_cost
return skill.mp_cost / 2
else
return skill.mp_cost
end
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
def execute_action_skill
skill = @active_battler.action.skill
text = @active_battler.name + skill.message1
@message_window.add_instant_text(text)
unless skill.message2.empty?
wait(10)
@message_window.add_instant_text(skill.message2)
end
targets = @active_battler.action.make_targets
display_animation(targets, skill.animation_id)
@active_battler.mp -= @active_battler.calc_mp_cost(skill)
#consume items required
skill_needs = getTag(skill.note,"consume_item")
if skill_needs != nil
num_items = getTagAdditionalValue(skill.note,"consume_item",2)
$game_party.lose_item($data_items[skill_needs.to_i],num_items.to_i,true)
end
$game_temp.common_event_id = skill.common_event_id
for target in targets
target.skill_effect(@active_battler, skill)
display_action_effects(target, skill)
end
end
end
I think I missed a couple of casts out. Let me know if this fixes it.
ryuujin5
Mar 27 2008, 10:21 AM
Alright, it's working smoothly, but it won't consume the item after a skil is used.
Queex
Mar 27 2008, 01:28 PM
This should be fixed. I won't embarrass myself by saying what I'd got wrong...
I'd recommend getting v1.2 of TagNote as well, just in case...
CODE
#####################################
# Check for requirements for skills #
#####################################
class Game_Actor < Game_Battler
def hands_free
if weapons[0]==nil
if weapons[1]==nil
if @armour_id[0]==nil
return 2
else
return 1
end
elsif weapons[1].two_handed
return 0
else
if @armour_id[0]==nil
return 1
else
return 0
end
end
elsif weapons[0].two_handed
return 0
elsif weapons[1]!=nil or @armour_id[0]!=nil
return 0
else
return 1
end
end
def skill_can_use?(skill)
#Usual checks
return false unless skill_learn?(skill)
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
return false if calc_mp_cost(skill) > mp
if skill.id != 0
skill_note=$data_skills[skill.id].note
#Check for weapon type
skill_needs = getTag(skill_note,"weapon_type") #weapon type string
if skill_needs != nil
return false unless @weapon_id!=0
return false unless hasTagValue($data_weapons[@weapon_id].note,"weapon_type",skill_needs)
end
#Check for item presence
skill_needs = getTag(skill_note,"item_present") #item id
if skill_needs != nil
return false unless $game_party.has_item?($data_items[skill_needs.to_i],true)
end
#Check for item consumption
skill_needs = getTag(skill_note,"item_consume") #item id
if skill_needs !=nil
skill_needs_num = getTagAdditionalValue(skill_note,"item_consume",2) #number
if skill_needs_num == nil
skill_needs_num = 1
end
return false unless $game_party.item_number($data_items[skill_needs.to_i])>=skill_needs_num.to_i
end
#Check for HP exceeds
skill_needs = getTag(skill_note,"hp_percent_exceed") #percent
if skill_needs !=nil
return false unless (100.0 * @hp/maxhp)>=skill_needs.to_f
end
#Check for HP below
skill_needs = getTag(skill_note,"hp_percent_below") #percent
if skill_needs != nil
return false unless (100.0 * @hp/maxhp)<skill_needs.to_f
end
#Check for MP exceeds
skill_needs = getTag(skill_note,"mp_percent_exceed") #percent
if skill_needs != nil
return false unless (100.0 * @mp/maxmp)>=skill_needs.to_f
end
#Check for MP below
skill_needs = getTag(skill_note,"mp_percent_below") #percent
if skill_needs != nil
return false unless (100.0* @mp/maxmp)<skill_needs.to_f
end
#Check for free hand
skill_needs = hasTag(skill_note,"free_hand") #boolean
if skill_needs
return false unless hands_free>=1
end
#Check for dual weapons
skill_needs = hasTag(skill_note,"dual_weapon") #boolean
if skill_needs
return false unless weapons[0]!=nil and weapons[1]!=nil
end
#Check for two-handed weapon
skill_needs = hasTag(skill_note,"two_handed_weapon") #boolean
if skill_needs
return false unless ( weapons[0]!= nil and weapons[0].two_handed) or (weapons[1] != nil and weapons[1].two_handed)
end
end
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
def calc_mp_cost(skill)
base_cost=skill.mp_cost
mp_prop=getTag(skill.note,"mp_percent_exceed")
if mp_prop!=nil
mp_lose=getTagAdditionalValue(skill.note,"mp_percent_exceed",2)
if mp_lose.eql?("true")
base_cost=mp_prop.to_f * maxmp
end
end
if half_mp_cost
return skill.mp_cost / 2
else
return skill.mp_cost
end
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
def execute_action_skill
skill = @active_battler.action.skill
text = @active_battler.name + skill.message1
@message_window.add_instant_text(text)
unless skill.message2.empty?
wait(10)
@message_window.add_instant_text(skill.message2)
end
targets = @active_battler.action.make_targets
display_animation(targets, skill.animation_id)
@active_battler.mp -= @active_battler.calc_mp_cost(skill)
#consume items required
skill_needs = getTag(skill.note,"item_consume")
if skill_needs != nil
num_items = getTagAdditionalValue(skill.note,"item_consume",2)
if num_items==nil
num_items=1
end
$game_party.lose_item($data_items[skill_needs.to_i],num_items.to_i,true)
end
$game_temp.common_event_id = skill.common_event_id
for target in targets
target.skill_effect(@active_battler, skill)
display_action_effects(target, skill)
end
end
end
SuperMaxZero
Mar 27 2008, 09:09 PM
Thanks, I got it to work fine. I was being stupid and over thinking when I was using the notes before.
sunnyghost
Mar 28 2008, 07:24 AM
thanks, but
<item_consumed x>
<item_consumed x n>
<mp_percent_exceed p true>
these don't work, nothing will be consumed
and when use <free_hand> with out any weapon, it will make error
Queex
Mar 28 2008, 08:30 AM
The first two should be fixed now.
I'll look at the other two shortly.
EDIT: Should both be working properly, now.
lahandi
Mar 28 2008, 10:29 AM
A powerfull script mate. This will make lot things easier. Salute!
aevonhaldy
Mar 29 2008, 09:22 PM
This is a great script--will really help me with two skill ideas I have! --But any idea why I am getting a syntax error at the last line??
display_animation(targets, skill.animation_id)
Mr_E_Man
Mar 29 2008, 09:32 PM
QUOTE (aevonhaldy @ Mar 29 2008, 08:36 PM)

This is a great script--will really help me with two skill ideas I have! --But any idea why I am getting a syntax error at the last line??
display_animation(targets, skill.animation_id)
I got that at first too. You need to have the
TagNote script as well for it to work.
aevonhaldy
Mar 29 2008, 09:39 PM
@ Mr E
Well, I do actually have the most recent TagNote script... thanks for trying to help me, though! (^_^);
Queex
Mar 30 2008, 09:18 AM
Hmm. I don't know about that. I don't get an error my end. Are you using any other scripts that affect Scene_Battle at all? That line is taken unaltered from the default code so I have no idea why it may cause a syntax error.
icecold49
Mar 30 2008, 10:37 AM
I have to say that this is one solid script here. Very nice. Yes, this will definitely come useful in my game. Thanks Queen.
luciddose
Mar 30 2008, 12:33 PM
I was wondering how you can make this work with Fomar0153 Blue mage script, after implimenting this script which works fine, my characters no longer learn any skills from enemies.
Queex
Mar 30 2008, 01:47 PM
We both change Scene_Battle.execute_action_skill for different reasons. I'm not entirely up to speed with aliases yet.
Try this and let me know if it fixes it:
CODE
#####################################
# Check for requirements for skills #
#####################################
class Game_Actor < Game_Battler
def hands_free
if weapons[0]==nil
if @armor1_id[0]==0
return 2
elsif weapons.length==2
if weapons[1].two_handed
return 0
else
return 1
end
else
return 1
end
elsif weapons[0].two_handed or @armor1_id!=0
return 0
else
return 1
end
end
def skill_can_use?(skill)
#Usual checks
return false unless skill_learn?(skill)
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
return false if calc_mp_cost(skill) > mp
if skill.id != 0
skill_note=$data_skills[skill.id].note
#Check for weapon type
skill_needs = getTag(skill_note,"weapon_type") #weapon type string
if skill_needs != nil
return false unless @weapon_id!=0
return false unless hasTagValue($data_weapons[@weapon_id].note,"weapon_type",skill_needs)
end
#Check for item presence
skill_needs = getTag(skill_note,"item_present") #item id
if skill_needs != nil
return false unless $game_party.has_item?($data_items[skill_needs.to_i],true)
end
#Check for item consumption
skill_needs = getTag(skill_note,"item_consume") #item id
if skill_needs !=nil
skill_needs_num = getTagAdditionalValue(skill_note,"item_consume",2) #number
if skill_needs_num == nil
skill_needs_num = 1
end
return false unless $game_party.item_number($data_items[skill_needs.to_i])>=skill_needs_num.to_i
end
#Check for HP exceeds
skill_needs = getTag(skill_note,"hp_percent_exceed") #percent
if skill_needs !=nil
return false unless (100.0 * @hp/maxhp)>=skill_needs.to_f
end
#Check for HP below
skill_needs = getTag(skill_note,"hp_percent_below") #percent
if skill_needs != nil
return false unless (100.0 * @hp/maxhp)<skill_needs.to_f
end
#Check for MP exceeds
skill_needs = getTag(skill_note,"mp_percent_exceed") #percent
if skill_needs != nil
return false unless (100.0 * @mp/maxmp)>=skill_needs.to_f
end
#Check for MP below
skill_needs = getTag(skill_note,"mp_percent_below") #percent
if skill_needs != nil
return false unless (100.0* @mp/maxmp)<skill_needs.to_f
end
#Check for free hand
skill_needs = hasTag(skill_note,"free_hand") #boolean
if skill_needs
return false unless hands_free>=1
end
#Check for dual weapons
skill_needs = hasTag(skill_note,"dual_weapon") #boolean
if skill_needs
return false unless weapons[0]!=nil and weapons[1]!=nil
end
#Check for two-handed weapon
skill_needs = hasTag(skill_note,"two_handed_weapon") #boolean
if skill_needs
return false unless ( weapons[0]!= nil and weapons[0].two_handed) or (weapons[1] != nil and weapons[1].two_handed)
end
end
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
def calc_mp_cost(skill)
base_cost=skill.mp_cost
mp_prop=getTag(skill.note,"mp_percent_exceed")
if mp_prop!=nil
mp_lose=getTagAdditionalValue(skill.note,"mp_percent_exceed",2)
if mp_lose.eql?("true")
base_cost=(mp_prop.to_f/100.0 * maxmp).to_i
end
end
if half_mp_cost
return base_cost / 2
else
return base_cost
end
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
alias skill_req_execute_action_skill execute_action_skill
def execute_action_skill
skill_req_execute_action_skill
skill = @active_battler.action.skill
#consume items required
skill_needs = getTag(skill.note,"item_consume")
if skill_needs != nil
num_items = getTagAdditionalValue(skill.note,"item_consume",2)
if num_items==nil
num_items=1
end
$game_party.lose_item($data_items[skill_needs.to_i],num_items.to_i,true)
end
end
end
aevonhaldy
Mar 30 2008, 02:59 PM
QUOTE (Queex @ Mar 30 2008, 11:32 AM)

Hmm. I don't know about that. I don't get an error my end. Are you using any other scripts that affect Scene_Battle at all? That line is taken unaltered from the default code so I have no idea why it may cause a syntax error.
Erg! That could be it! I am using DerVVulfman's battlebacks script and Lomexi's Battle Theme adjuster... (@_@)!
..I will take a look at it later when I have more time--unless anyone already knows what the conflict might be.
Queex
Mar 30 2008, 04:07 PM
I'm using battlebacks (before this script) without problems. Try moving scripts to after main until the problem goes away.
aevonhaldy
Mar 30 2008, 06:29 PM
Well, I tried taking out my scripts ONE BY ONE until I was left with just TagNote and the Skill Req script, but still the syntax error on the last line. (!)
Finally, I just added "end, end" to the end... and it SEEMS to work (so far so good).
CODE
display_animation(targets, skill.animation_id)
end
end
I have yet to do much with the actual notes, so we shall see... Anyway, thanks for your helpful demeanor! (And I'll be back if I have more problems that I can't fix on my own! But here's hoping I wont have any!)
Regards,
AEVH
Queex
Mar 31 2008, 12:51 AM
Actually- that shouldn't be the last line. I think you may not have copied all of it. Double check that and see if it works.
aevonhaldy
Mar 31 2008, 08:28 AM
QUOTE (Queex @ Mar 31 2008, 03:05 AM)

Actually- that shouldn't be the last line. I think you may not have copied all of it. Double check that and see if it works.
Hm, yeah, that was one of the first things I checked when I got the script because I thought the end looked funny. --But I can't seem to get the code box to scroll down any further than that line. I often have trouble with code boxes though...maybe because I'm in Internet Explorer....
I don't suppose I could trouble you to post the full code as a TXT file download?
Queex
Mar 31 2008, 02:07 PM
Done- check the original post. That version is the semi-experimental one posted earlier attempting to use an alias, so if there are still problems I'll revert it to the older version.
I intend to upgrade this at some point, after revising TagNote to handle multiple tags of the same type properly.
aevonhaldy
Mar 31 2008, 03:06 PM
Thanks Queex,
You are awesome. I look forward to any upgrades, etc., because this is a really useful script. Thanks for making it.
Dark Koji
Apr 1 2008, 07:55 AM
Yo there!
I noticed that if I set <weapon_type x> to a specified skill, the skill will only work when the "x" weapon is equipped to the character's first weapon slot.
This means that when I shift the same weapon over to the character's shield slot (secondary weapon in this case, since he is allowed to wield two weapons), the skill will still remain disabled - not recognizing the presence of "x" weapon in place.
Any tips on how can I overcome this problem?
Queex
Apr 1 2008, 08:15 AM
I'll fix the script. Tonight, probably. Should be fairly trivial.
Edit: Done. As always, if there are any problems with it let me know. I've cleaned it up a little, too.
Dark Koji
Apr 1 2008, 03:56 PM
Tested it, and it works! Both when equipped with only the weapon on the off-hand, and with two weapons~ Great job as always, Queex!
Oh and, I would like to point out that there is a small bug with <item_consume x>.
You still have to state 'n', as in <item_consume x n> in order for the item to be consumed.
The problem is nothing big, though just wanna let you know it won't be assumed as 1, without an 'n' stated. >_<
Queex
Apr 1 2008, 04:19 PM
Umm, it seems to work for me. As ever, check both it and TagNote are the latest version, other scripts, etc. etc. I'll look into it if the problem persists.
luciddose
Apr 2 2008, 11:25 PM
wow that totally works - thank you, dont know what you did but it works like a charm. You rock! Mucho Kudos!
Queex
Apr 4 2008, 05:03 PM
Bump for newer version.
Now uses the revised TagNote script, has a couple of fixes and includes a facility to make sure required items appear in the inventory when testing battles.
yuukimaru
Apr 9 2008, 01:15 PM
hey is there a way to make one of the requirements being that the actor is under a certain state? like a light arts/dark arts set up if anyone has played FFXI >.>
hjorverdr
May 28 2008, 09:16 AM
sorry, i'm having problems with the status on the skills
for example, if a skill causes atk up, there's an error. it is in line 196. i don't know anything about scripting, but i guess that the error is in all this part:
#consume items required
skill_needs = get_tag(skill.note,"item_consume")
if skill_needs != nil
num_items = get_additional_tag(skill.note,"item_consume",2)
if num_items==nil
num_items=1
end
$game_party.lose_item($data_items[skill_needs.to_i],num_items.to_i,true)
end
end
end
even so, it's a great job, man
thinkabout
May 28 2008, 12:26 PM
This script looks solid.
I'll look forward <gold_exceed p> and <party_member_present p>
Queex
May 29 2008, 05:57 AM
I've been side-tracked by other time sinks recently- most notably getting my car past the MOT- so it might be a while before I make any substantial revisions- although thinkabout's suggestions are definitely good choices for inclusion.
As for hjorverdr's problem, I can't see any way that status effects could interfere. Can you verify that the problem isn't present for a skill with identical requirements but no status effect, and that you're using the latest version in the zip file?
ell
Jul 21 2008, 02:43 AM
I have the same problem as hjorverdr and it seems that a duplicate skil without status effects seems to work fine, i must add that i am not using your script on the skill or the duplicate, tthe notes are blank, hope you can fix it. Great script otherwise!
Mickadell
Jan 17 2009, 08:11 PM
Comment
Rate: Ok
I do like it. Alittle but more improvement will do thanks
but its still ok.
ZFMaster
Jan 17 2009, 08:12 PM
QUOTE (callydude @ Mar 20 2008, 01:00 PM)

Sorry but this is really easy to do using events and common events.It may still be useful.
Cool now i dont have to use so many event's thank's.
The Imp
Feb 1 2009, 09:42 PM
Hey nice script. Is there any way to make this work with equipment too? Like certain equipment requires certain item so you can attack.
silvershadic
Apr 9 2011, 10:29 AM
Is there a way to consume armors?
Kread-EX
Apr 9 2011, 10:54 AM
Check this part of the script:
CODE
#Check for item consumption
skill_needs = get_tag(skill_note,"item_consume") #item id
if skill_needs !=nil
skill_needs_num = get_additional_tag(skill_note,"item_consume",2) #number
if skill_needs_num == nil
skill_needs_num = 1
end
return false unless $game_party.item_number($data_items[skill_needs.to_i])>=skill_needs_num.to_i
end
Just below, add this:
CODE
#Check for armor consumption
skill_needs = get_tag(skill_note,"armor_consume") #armor id
if skill_needs !=nil
skill_needs_num = get_additional_tag(skill_note,"armor_consume",2) #number
if skill_needs_num == nil
skill_needs_num = 1
end
return false unless $game_party.item_number($data_armors[skill_needs.to_i])>=skill_needs_num.to_i
end
Now, search for this:
CODE
#consume items required
skill_needs = get_tag(skill.note,"item_consume")
if skill_needs != nil
num_items = get_additional_tag(skill.note,"item_consume",2)
if num_items==nil
num_items=1
end
$game_party.lose_item($data_items[skill_needs.to_i],num_items.to_i,true)
end
end
end
Just below, add this:
CODE
#consume armors required
skill_needs = get_tag(skill.note,"armor_consume")
if skill_needs != nil
num_items = get_additional_tag(skill.note,"armor_consume",2)
if num_items==nil
num_items=1
end
$game_party.lose_item($data_armors[skill_needs.to_i],num_items.to_i,true)
end
end
end
You should be able to use all item consumption tags, but with "armor" instead.
That being said, it is a very old topic and the author hasn't been seen since 2008 so closing down.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.