Group: Member
Posts: 75
Type: None
RM Skill: Beginner
Skill Requirements System Version 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.
########################### # 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
Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed
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.
__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.