=begin #=============================================================================== Title: Placeholder Equip Parameters Author: Hime Date: Mar 17, 2015 URL: http://himeworks.com/2015/03/placeholder-equip-parameters/ -------------------------------------------------------------------------------- ** Change log Mar 17, 2015 - 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 have an equip pull parameters from a different equip depending on which actor is using it. For example, a long sword might give 20 ATK to one actor, but give 60 ATK to a different actor, based on the actor ID or the actor's class ID. -------------------------------------------------------------------------------- ** Installation In the script editor, place this script below Materials and above Main -------------------------------------------------------------------------------- ** Usage For each weapon and armor, use the note-tag Where the ACTOR_ID is the ID of the actor that is using the weapon or wearing the armor, and the EQUIP_ID is the ID of the weapon or armor that it should read parameters from. Class-based equip parameters are also available, using the note-tag Note that if both actor and class ID's exist for an equip, then the actor's ID will be used since it is more specific and therefore has higher precedence. #=============================================================================== =end $imported = {} if $imported.nil? $imported[:TH_PlaceholderEquipParameters] = true #=============================================================================== # ** Configuration #=============================================================================== module TH module Placeholder_Equip_Parameters #=============================================================================== # ** Rest of the script #=============================================================================== Actor_Regex = //im Class_Regex = //im end end module RPG class EquipItem def load_notetag_placeholder_equip_parameters @actor_equips = {} @class_equips = {} results = self.note.scan(TH::Placeholder_Equip_Parameters::Actor_Regex) results.each do |res| actor_id = res[0].to_i equip_id = res[1].to_i @actor_equips[actor_id] = equip_id end results = self.note.scan(TH::Placeholder_Equip_Parameters::Class_Regex) results.each do |res| class_id = res[0].to_i equip_id = res[1].to_i @class_equips[class_id] = equip_id end end end class Armor def actor_params(actor_id, class_id) load_notetag_placeholder_equip_parameters unless @actor_equips id = @actor_equips[actor_id] return $data_armors[id].params if id id = @class_equips[class_id] return $data_armors[id].params if id return self.params end end class Weapon def actor_params(actor_id, class_id) load_notetag_placeholder_equip_parameters unless @actor_equips id = @actor_equips[actor_id] return $data_weapons[id].params if id id = @class_equips[class_id] return $data_weapons[id].params if id return self.params end end end class Game_Actor def param_plus(param_id) equips.compact.inject(super) {|r, item| r += item.actor_params(@actor_id, @class_id)[param_id] } end end