Hello everyone !
I make a request for 2 VX ACE scripts i'd like to use with MV.
- Dynamic Weapon Animations (Author : Hime)
- Item and Skill Restrictions (Author : Hime)
I don't know if similars script exists, I didn't find anything.
I make a request for 2 VX ACE scripts i'd like to use with MV.
- Dynamic Weapon Animations (Author : Hime)
- Item and Skill Restrictions (Author : Hime)
#==============================================================================# Dynamic Weapon Animations#===============================================================================begin#=============================================================================== Title: Dynamic Weapon Animations Author: Hime Date: Mar 23, 2014 URL: -------------------------------------------------------------------------------- ** Change log Mar 23, 2014 - Initial release-------------------------------------------------------------------------------- ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Credits to Hime Works in your project * Preserve this header-------------------------------------------------------------------------------- ** Description This script allows you to dynamically determine a weapon's animation. When using a skill or item, you can choose to show a "normal attack" animation. This will tell the engine to use the animation that you have selected for the weapon. However, sometimes this is not enough. You might want a single weapon to show different animations depending on factors such as the current state or who the actor is. For example, you might have a normal slash animation, but if you have an ice enchantment state, you might want to play an ice slash animation, and if you have a fire enchantment state, you might want to play a fire slash animation. By using dynamic weapon animations, you can use formulas to determine which animation will be played based on a variety of conditions. -------------------------------------------------------------------------------- ** Installation In the script editor, place this script below Materials and above Main-------------------------------------------------------------------------------- ** Usage To specify an animation formula for a weapon, note-tag it with <animation formula> FORMULA </animation formula> Where the formula is any valid formula that returns the ID of the animation that you want to use. The following formula variables are available: a - the user p - game party t - game troop s - game switches v - game variables To use the weapon's animation, your skill or item must use "normal attack" animation. Remember that your formula must always return an ID. There is no default ID. #================================================================================end$imported = {} if $imported.nil?$imported[:TH_DynamicWeaponAnimations] = true#===============================================================================# ** Configuration#===============================================================================module TH module Dynamic_Weapon_Animations Ext_Regex = /<animation[-_ ]formula>(.*?)<\/animation[-_ ]formula>/im endend#===============================================================================# ** Rest of script#===============================================================================module RPG class Weapon < EquipItem def weapon_animation_formula load_notetag_dynamic_weapon_animations unless @weapon_animation_formula return @weapon_animation_formula end def load_notetag_dynamic_weapon_animations @weapon_animation_formula = "" res = self.note.match(TH:😀ynamic_Weapon_Animations::Ext_Regex) if res @weapon_animation_formula = res[1] end end def eval_weapon_animation(a, p=$game_party, t=$game_troop, v=$game_variables, s=$game_switches) eval(self.weapon_animation_formula) end endendclass Game_Actor < Game_Battler #----------------------------------------------------------------------------- # Replaced #----------------------------------------------------------------------------- def atk_animation_id1 if dual_wield? return weapons[0].eval_weapon_animation(self) if weapons[0] return weapons[1] ? 0 : 1 else return weapons[0] ? weapons[0].eval_weapon_animation(self) : 1 end end #----------------------------------------------------------------------------- # Replaced #----------------------------------------------------------------------------- def atk_animation_id2 if dual_wield? return weapons[1] ? weapons[1].eval_weapon_animation(self) : 0 else return 0 end endend
Code:
#==============================================================================# Item and Skill Restrictions#===============================================================================begin============================================================================== ** FP Item and Skill Restrictions Author: Hime Version: 1.1 Date: May 13, 2012------------------------------------------------------------------------------ ** Change log 1.1 May 13 -added support for name requirements -removed redundant method definitions 1.0 May 12 -Initial release------------------------------------------------------------------------------ This script adds restrictions to skill and item usage. The following restrictions are available -state (state IDs) -armor (armor IDs) -weapon (weapon IDs) -atype (armor types) -wtype (weapon types) -ctype (class types) -ename (equip name) -wname (weapon name) -aname (armor name) -cname (class name) Equip means that you must have a specific equip on you. Can be armor or weapon You can specify generic equip types, for armors or weapons You can specify what state must be active You can specify that one of your equips must have a certain name You can specify that only certain classes can use it, or if the class name contains a specific word The same applies to items.===============================================================================endmodule Feature_Plus module Skill_Restrict # Feature code, do not change FEATURE_SKILL_RESTRICT = 101 # Data_id's - for reference only ARMOR_EQUIP = 0 WEAPON_EQUIP = 1 ATYPE_EQUIP = 2 WTYPE_EQUIP = 3 STATE_ACTIVE = 4 EQUIP_ENAME = 5 EQUIP_ANAME = 6 EQUIP_WNAME = 7 CLASS_TYPE = 8 CLASS_NAME = 9 SR_ARMOR = /<fp:sr\s*armor:?\s*(\d+).*>/i SR_ATYPE = /<fp:sr\s*atype:?\s*(\d+).*\s*>/i SR_WEAPON = /<fp:sr\s*weapon:?\s*(\d+).*\s*>/i SR_WTYPE = /<fp:sr\s*wtype:?\s*(\d+).*\s*>/i SR_STATE = /<fp:sr\s*state:?\s*(\d+).*\s*>/i SR_CTYPE = /<fp:sr\s*wname:?\s*(\d+)\s*>/i SR_ENAME = /<fp:sr\s*ename:?\s*(\w+)\s*>/i SR_ANAME = /<fp:sr\s*aname:?\s*(\w+)\s*>/i SR_WNAME = /<fp:sr\s*wname:?\s*(\w+)\s*>/i SR_CNAME = /<fp:sr\s*cname:?\s*(\w+)\s*>/i endend#==============================================================================# ** RPG classes#------------------------------------------------------------------------------# Load notetags#==============================================================================module RPG class UsableItem < BaseItem include Feature_Plus::Skill_Restrict alias :fp_sr_initialize_rpg_usables :initialize def initialize fp_sr_initialize_rpg_usables fp_sr_load_notetags end def add_sr_name_feature(name, data_id) add_feature(FEATURE_SKILL_RESTRICT, data_id, name.downcase) end def add_sr_feature(values, data_id) values.collect {|equip_id| add_feature(FEATURE_SKILL_RESTRICT, data_id, equip_id) } end def add_feature(code, data_id, value=0) RPG::BaseItem::Feature.new(code, data_id, value) end def fp_sr_load_notetags self.note.split(/[\r\n]+/).each do |line| case line when SR_ARMOR values = line.scan(/\d+/).map(&:to_i) @features.concat(add_sr_feature(values, ARMOR_EQUIP)) when SR_ATYPE values = line.scan(/\d+/).map(&:to_i) @features.concat(add_sr_feature(values, ATYPE_EQUIP)) when SR_WEAPON values = line.scan(/\d+/).map(&:to_i) @features.concat(add_sr_feature(values, WEAPON_EQUIP)) when SR_WTYPE values = line.scan(/\d+/).map(&:to_i) @features.concat(add_sr_feature(values, WTYPE_EQUIP)) when SR_STATE values = line.scan(/\d+/).map(&:to_i) @features.concat(add_sr_feature(values, STATE_ACTIVE)) when SR_CTYPE values = line.scan(/\d+/).map(&:to_i) @features.concat(add_sr_feature(values, CLASS_TYPE)) when SR_ENAME @features << add_sr_name_feature($1, EQUIP_ENAME) when SR_ANAME @features << add_sr_name_feature($1, EQUIP_ANAME) when SR_WNAME @features << add_sr_name_feature($1, EQUIP_WNAME) when SR_CNAME @features << add_sr_name_feature($1, CLASS_NAME) end end end endend#==============================================================================# ** DataManager#------------------------------------------------------------------------------# Initialize custom notetags#==============================================================================module DataManager class << self alias tsuki_fp_sr_init init end def self.init tsuki_fp_sr_init load_notetags_fp_skill_restrict end def self.load_notetags_fp_skill_restrict groups = [$data_skills, $data_items] for group in groups for obj in group next if obj.nil? obj.fp_sr_load_notetags end end endendclass Game_BattlerBase include Feature_Plus::Skill_Restrict def fpsr_skill_features(skill, code, data_id) skill.features.select {|ft| ft.code == code && ft.data_id == data_id} end def fpsr_condition_required(skill, data_id) fpsr_skill_features(skill, FEATURE_SKILL_RESTRICT, data_id).collect {|skill| skill.value} end #-------------------------------------------------------------------------- # * Logical OR condition: as long as any one of the requirements are met #-------------------------------------------------------------------------- def sr_require_ok?(ids, skill, data_id) values = fpsr_condition_required(skill, data_id) return true if values.empty? return values.any?{|req| ids.include?(req)} end def sr_names_ok?(names, skill, data_id) reqs = fpsr_condition_required(skill, data_id) return true if reqs.empty? req_str = reqs[0] return names.any?{|str| str.include?(req_str)} endendclass Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Add more conditions to actor skill and item usage #-------------------------------------------------------------------------- def skill_conditions_met?(skill) fpsr_conditions_met?(skill) && super end def item_conditions_met?(item) fpsr_conditions_met?(item) && super end #-------------------------------------------------------------------------- # * FP:SR main condition check #-------------------------------------------------------------------------- def fpsr_conditions_met?(skill) return false unless sr_require_ok?(armor_ids, skill, ARMOR_EQUIP) return false unless sr_require_ok?(atype_ids, skill, ATYPE_EQUIP) return false unless sr_require_ok?(weapon_ids, skill, WEAPON_EQUIP) return false unless sr_require_ok?(wtype_ids, skill, WTYPE_EQUIP) return false unless sr_require_ok?(state_ids, skill, STATE_ACTIVE) return false unless sr_require_ok?([self.class], skill, CLASS_TYPE) return false unless sr_names_ok?(equip_names, skill, EQUIP_ENAME) return false unless sr_names_ok?(weapon_names, skill, EQUIP_ANAME) return false unless sr_names_ok?(armor_names, skill, EQUIP_WNAME) return false unless sr_names_ok?([self.class.name.downcase], skill, CLASS_NAME) return true end #-------------------------------------------------------------------------- # * Convenience methods #-------------------------------------------------------------------------- def armor_ids @equips.select {|item| item.is_armor? }.collect {|item| item.item_id } end def atype_ids armors.collect {|armor| armor.atype_id} end def weapon_ids @equips.select {|item| item.is_weapon? }.collect {|item| item.item_id} end def armor_names armor_ids.collect {|id| $data_armors[id].name.downcase} end def weapon_names weapon_ids.collect {|id| $data_weapons[id].name.downcase} end def wtype_ids weapons.collect {|weapon| weapon.wtype_id} end def state_ids states.collect {|state| state.id} end def equip_names armor_names + weapon_names end end#==============================================================================# I need the item_id ...#==============================================================================class Game_BaseItem attr_reader :item_idend