Cerca nel Forum
Showing results for tags 'Equipment Requirements'.
Trovato 2 risultati
-
BS/Battlers Addon Equipment Requirements
Ally ha aggiunto un topic in Scripts RPG Maker VX Ace (RGSS3)
Nome Script: Equipment Requirements Versione: 1.2 Autore/i: Fomar0153 Informazioni: Consente di definire i requisiti per Armi e Armature, ed è possibile utilizzare sia il loro livello o una delle loro statistiche. Istruzioni: Inserite lo script sotto Material. Istruzioni all'interno dello script. Script: =beginEquipment Requirementsby Fomar0153Version 1.2----------------------Notes----------------------Adds a level requirement to equipment.----------------------Instructions----------------------Notetag the weapons/armors like so:<levelreq x><mhpreq x><mmpreq x><atkreq x><defreq x><matreq x><mdfreq x><agireq x><lukreq x><switchreq x><wepreq x><armreq x>----------------------Change Log----------------------1.0 -> 1.1 Added stat requirements Changed script name from Equipment Level Requirements to just Equipment Requirements1.1 -> 1.2 Added switch and other equipment requirements----------------------Known bugs----------------------None=endclass Game_BattlerBase #-------------------------------------------------------------------------- # ● If set to true then it compares the requirement with the actor's base # stat rather than their current. #-------------------------------------------------------------------------- EQUIPREQ_USE_BASE_STAT = true #-------------------------------------------------------------------------- # ● Check the requirements #-------------------------------------------------------------------------- alias level_equippable? equippable? def equippable?(item) return false unless item.is_a?(RPG::EquipItem) return false if @level < item.levelreq return false if reqstat(0) < item.mhpreq return false if reqstat(1) < item.mmpreq return false if reqstat(2) < item.atkreq return false if reqstat(3) < item.defreq return false if reqstat(4) < item.matreq return false if reqstat(5) < item.mdfreq return false if reqstat(6) < item.agireq return false if reqstat(7) < item.lukreq if item.switchreq > 0 return false unless $game_switches[item.switchreq] end if item.wepreq > 0 e = [] for equip in @equips if equip.is_weapon? e.push(equip.object.id) end end return false unless e.include?(item.wepreq) unless equip.object.nil? end if item.armreq > 0 e = [] for equip in @equips if equip.is_armor? e.push(equip.object.id) unless equip.object.nil? end end return false unless e.include?(item.armreq) end return level_equippable?(item) end #-------------------------------------------------------------------------- # ● New Method #-------------------------------------------------------------------------- def reqstat(id) if EQUIPREQ_USE_BASE_STAT return param_base(id) else return param(id) end endendmodule RPG #-------------------------------------------------------------------------- # ● Equip Item is inherited by both Weapon and Armor #-------------------------------------------------------------------------- class EquipItem def levelreq if self.note =~ /<levelreq (.*)>/i return $1.to_i else return 0 end end def mhpreq if self.note =~ /<mhpreq (.*)>/i return $1.to_i else return 0 end end def mmpreq if self.note =~ /<mmpreq (.*)>/i return $1.to_i else return 0 end end def atkreq if self.note =~ /<atkreq (.*)>/i return $1.to_i else return 0 end end def defreq if self.note =~ /<defreq (.*)>/i return $1.to_i else return 0 end end def matreq if self.note =~ /<matreq (.*)>/i return $1.to_i else return 0 end end def mdfreq if self.note =~ /<mdfreq (.*)>/i return $1.to_i else return 0 end end def agireq if self.note =~ /<agireq (.*)>/i return $1.to_i else return 0 end end def lukreq if self.note =~ /<lukreq (.*)>/i return $1.to_i else return 0 end end def switchreq if self.note =~ /<switchreq (.*)>/i return $1.to_i else return 0 end end def wepreq if self.note =~ /<wepreq (.*)>/i return $1.to_i else return 0 end end def armreq if self.note =~ /<armreq (.*)>/i return $1.to_i else return 0 end end endend -
Nome Script: Equipment Requirements Versione: 1.2 Autore/i: Ayene Informazioni: Lo script permette di impostare i requisiti per armi e armature. Per esempio, equipaggiare un eroe con ascia a due mani sarebbe possibile solo dopo aver raggiunto un determinato livello o se dispone di statistiche adeguate. Inoltre ha aggiunto un opzione che permette di richiedere determinate abilità. Features: - Semplice da configurare - Finestra che mostra se le statistiche sono troppo basse e quali competenze sono necessarie - Viene mostrata l'abilità che può essere attivata e disattivata Istruzioni: Per utilizzare lo script è sufficiente configurare i requisiti di seguito (separatamente per ogni arma e armatura), secondo questo codice: WEAPON [weapon ID] = [lv, maxhp, maxsp, str, dex, agi, int, [skill_id, skill_id, ...]] Esempio:Se si vuole equipaggiare un personaggio con un'arma dal 2° al 6° livello, a condizione che abbia max 120 HP, 40 forza, 70 intelligenza, guardate come riferimento questo codice: WEAPON [2] = [6, 120, 0, 40, 0, 0, 70, []] Successivamente, per equipaggiare un armatura ID 3, che "richiede" l'agilità e le impostazioni degli ID 10 e 40, fate in questo modo: ARMOR [3] = [0, 0, 0, 0, 70, 0, 0, [10, 40]] Script: #=================================================================== # Equipment Requirements [XP] # by Ayene # 26.03.2010 ver 1.2 # www.ultimateam.pl #=================================================================== # Opis: # The script allows you to set requirements for weapon and armor. # For instance, outfitting a hero with two-handed axe would be possible # only after reaching a specific level or having adequate statistics. # Also added an option that allows to require certain skills. # # Instruction: # To use the script simply configure requirements below (separately for each # weapon and armor), according to the formula: # # WEAPON [weapon ID] = [lv, maxhp, maxsp, str, dex, agi, int, [skill_id, skill_id, ...]] # # For example: # If you want a character to equip a weapon ID 2 at level 6, provided that # it has 120 max HP, 40 strength, 70 intelligence, # type in configuration below: # WEAPON [2] = [6, 120, 0, 40, 0, 0, 70, []] # Next, to equip an armor ID 3, which "requires" adequate agility # and knowledge of the skill ID 10 and 40, type: # ARMOR [3] = [0, 0, 0, 0, 70, 0, 0, [10, 40]] # #=================================================================== # CONFIGURATION module AYENE module EQUIP_REQ WEAPON = [] ARMOR = [] # ~~~~~~~~~~~~~~~~~BRONIE~~~~~~~~~~~~~~~~ # WEAPON [weapon ID] = [lv, maxhp, maxsp, str, dex, agi, int, [skill_id, skill_id, ...]] WEAPON[1] = [2, 10, 10, 10, 10, 10, 10, [4]] WEAPON[3] = [3, 500, 20, 0, 0, 0, 0, []] # ~~~~~~~~~~~~~~~~PANCERZE~~~~~~~~~~~~~~~~ # ARMOR [armor ID] = [lv, maxhp, maxsp, str, dex, agi, int, [skill_id, skill_id, ...]] ARMOR[2] = [1, 300, 0, 0, 0, 0, 0, []] ARMOR[3] = [3, 400, 0, 0, 0, 0, 0, []] ACC_TEXT = "Your stats are too low to equip this item." PARAM_NAMES = ["Level", "Max HP", "Max SP", "Strength", "Dexterity", "Agility", "Intelligence", "Skills:"] SHOW_SKILL_REQ = true # Show which skill is needed? WLH = 32 # Line Height in Requirements Window end end #=================================================================== # Game_Actor #=================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Determine if Item can be Equiped (Actor's Parameters) # stat : stats #-------------------------------------------------------------------------- def equip_allowed?(stat) return true if stat[0] <= level && stat[1] <= base_maxhp && stat[2] <= base_maxsp && stat[3] <= base_str && stat[4] <= base_dex && stat[5] <= base_agi && stat[6] <= base_int && equip_skill_allowed?(stat) return false end #-------------------------------------------------------------------------- # * Determine if Item can be Equiped (Actor's Skills ) # stat : stats #-------------------------------------------------------------------------- def equip_skill_allowed?(stat) return true if stat[7].empty? stat[7].each{|skill_id| return false if !skill_learn?(skill_id) } return true end end #=================================================================== # Window_Help #=================================================================== class Window_EquipReq < Window_Base include AYENE::EQUIP_REQ #-------------------------------------------------------------------------- # * Object Initialization # item : item # data : parameters (array) # actor : actor # skill : skill #-------------------------------------------------------------------------- def initialize(item, data, actor, skill) if skill.empty? or !SHOW_SKILL_REQ height = (data.size+1) / 2 * WLH + WLH + 32 else height = (data.size+1) / 2 * WLH + WLH + 32 + WLH * [skill.size, 7].min end super(100, 200 - height/2, 460, height) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1000 self.opacity = 255 self.contents.font.color = crisis_color self.contents.draw_text(4, 0, self.width - 40, WLH, ACC_TEXT, 1) x = 10 y = WLH data.each_with_index{|array, i| self.contents.font.color = system_color self.contents.draw_text(x+i%2*240, y+i/2*WLH, 200, WLH, PARAM_NAMES[array[0]].to_s, 0) self.contents.font.color = normal_color self.contents.draw_text(x+120+i%2*240, y+i/2*WLH, 40, WLH, array[1].to_s, 2) } if !skill.empty? and SHOW_SKILL_REQ size = (data.size+1)/2*WLH self.contents.font.color = system_color self.contents.draw_text(x, y+size, 200, WLH, PARAM_NAMES[7].to_s, 0) self.contents.font.color = normal_color skill.each_with_index{|id, i| self.contents.draw_text(x+140, y+size+WLH*i, 200, WLH, "- #{$data_skills[id].name}", 0) } end end end #=================================================================== # Scene_Equip #=================================================================== class Scene_Equip include AYENE::EQUIP_REQ #-------------------------------------------------------------------------- # * Aliased Definitions #-------------------------------------------------------------------------- alias ayene_item_stats_sceq_update update alias ayene_item_stats_sceq_update_item update_item #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @req_window != nil ? update_spec_selection : ayene_item_stats_sceq_update end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_item @stat = nil item = @item_window.item case item when RPG::Weapon @stat = WEAPON[item.id] else @stat = ARMOR[item.id] end unless @stat == nil if Input.trigger?(Input::C) && [email protected]_allowed?(@stat) $game_system.se_play($data_system.buzzer_se) @item_window.active = false show_spec_window return end end ayene_item_stats_sceq_update_item end #-------------------------------------------------------------------------- # * Frame Update (when requirements window is active) #-------------------------------------------------------------------------- def update_spec_selection @frame < 100 ? @frame += 1 : @frame = 0 if @frame == 100 or Input.trigger?(Input::C) or Input.trigger?(Input:: @req_window.dispose @req_window = nil @item_window.active = true end end #-------------------------------------------------------------------------- # * Show Requirements Window #-------------------------------------------------------------------------- def show_spec_window @frame = 0 data = [] @stat.each_with_index {|value, type| data.push([type, value]) if value > 0 if type < 7 } data.sort!{|a,b| a[0] <=> b[0]} skill = @stat[7] @req_window = Window_EquipReq.new(@item, data, @actor, skill) end end #=================================================================== # Game_Interpreter #=================================================================== class Interpreter include AYENE::EQUIP_REQ #-------------------------------------------------------------------------- # * Aliased Definitions #-------------------------------------------------------------------------- alias aye_command_315 command_315 alias aye_command_316 command_316 alias aye_command_317 command_317 alias aye_command_318 command_318 #-------------------------------------------------------------------------- # * Change EXP #-------------------------------------------------------------------------- def command_315 aye_command_315 iterate_actor(@parameters[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Change Level #-------------------------------------------------------------------------- def command_316 aye_command_316 iterate_actor(@parameters[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Change Parameters #-------------------------------------------------------------------------- def command_317 aye_command_317 iterate_actor(@parameters[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Change Skills #-------------------------------------------------------------------------- def command_318 aye_command_318 iterate_actor(@parameters[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Check Equipment # actor : actor #-------------------------------------------------------------------------- def check_change_equip(actor) for i in 0..4 case i when 0 item = $data_weapons[actor.weapon_id] stat = WEAPON[item.id] when 1 item = $data_armors[actor.armor1_id] stat = ARMOR[item.id] when 2 item = $data_armors[actor.armor2_id] stat = ARMOR[item.id] when 3 item = $data_armors[actor.armor3_id] stat = ARMOR[item.id] when 4 item = $data_armors[actor.armor4_id] stat = ARMOR[item.id] end actor.equip(i, 0) if !stat.nil? && !actor.equip_allowed?(stat) end end end