Invité Invité
| Sujet: [VX] Niveau requis Jeu 5 Juil 2012 - 15:31 | |
| Bonjour, je sais que ce script existe pour VX mais impossible de mettre la main dessus. T_T C'est plus une recherche qu'une demande en fait. x) Je recherche donc un script qui permet aux personnages de l'équipe de porter une arme ou une armure uniquement quand le niveau minimum est requis. Un peu comme dans Diablo II. ^^ Merci d'avance. =) |
|
RitoJS Ancien staffeux
Messages postés : 1925 Date d'inscription : 22/02/2012 Jauge LPC :
| Sujet: Re: [VX] Niveau requis Jeu 5 Juil 2012 - 15:46 | |
| Voilà: - Code:
-
#=================================================================== # Equipment Requirements [VX] # by Ayene # 27.01.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 insert tag into the "Notes" box located in the # Weapon or Armor tab of the database: # <stat_require LV, MAXHP, MAXMP, ATK, DEF, SPI, AGI>, # where: # LV - required actor's level # MAXHP - maximum HP # MAXMP - maximum MP # ATK - Attack # DEF - Defence # SPI - Spirit # AGI - Agility # # For example: # If you want a character to equip a weapon at level 6, provided that # it has 120 max HP, 40 Attack, 70 Defence, # add in the specified weapon's "Note" box: # <stat_require 6, 120, 0, 40, 70, 0, 0> # # Next, to equip an armor, which "requires" adequate agility: # <stat_require 0, 0, 0, 0, 0, 0, 50> # # To set that the specified armor can be equipped only after gaining # certain skill(s), add in "Note" box: # <skill_require ID, ID, ...> # where: # ID - required skill(s) ID(s) # For example: # To equip an weapon, that "requires" skills ID 10 and 40: # <skill_require 10, 40> #=================================================================== module AYENE module ItemSpec ITEM_SPEC = /<(?:STAT_REQUIRE|stat_require)\s*(\d+)\s*, \s*(\d+), \s*(\d+), \s*(\d+), \s*(\d+), \s*(\d+), \s*(\d+)>/i WEAPON_TEXT = "Pour équiper cette arme vous devez avoir:" ARMOR_TEXT = "Pour équiper cette armure vous devez avoir:" ACC_TEXT = "Pour équiper cet accessoire vous devez avoir:" PARAM_NAMES = ["Niveau", "Max HP", "Max MP", "Attaqua", "Défense", "Intelligence", "Agilité", "Magie:"] SKILL_SPEC = /<(?:SKILL_REQUIRE|skill_require)[ ]*(\d+(?:[ ]*,[ ]*\d+)*)>/i SHOW_SKILL_REC = true # Show which skill is needed? (true/false) end end #=================================================================== # ** RPG::BaseItem #=================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :spec_params #-------------------------------------------------------------------------- # * Requirements Initialization #-------------------------------------------------------------------------- def equip_req_ini @spec_params = {} (0..6).each{|i| @spec_params[i] = 0} @spec_params[7] = [] self.note.split(/[\r\n]+/).each { |line| case line when AYENE::ItemSpec::ITEM_SPEC @spec_params[0] = $1.to_i @spec_params[1] = $2.to_i @spec_params[2] = $3.to_i @spec_params[3] = $4.to_i @spec_params[4] = $5.to_i @spec_params[5] = $6.to_i @spec_params[6] = $7.to_i end } self.note.split(/[\r\n]+/).each { |line| case line when AYENE::ItemSpec::SKILL_SPEC $1.scan(/\d+/).each { |num| skill_id = num.to_i @spec_params[7].push(skill_id) if $data_skills[skill_id] != nil } end } end end #=================================================================== # ** RPG::Weapon #=================================================================== class RPG::Weapon < RPG::BaseItem #-------------------------------------------------------------------------- # * Requirements Text #-------------------------------------------------------------------------- def eqreq_text return AYENE::ItemSpec::WEAPON_TEXT end end #=================================================================== # ** RPG::Armor #=================================================================== class RPG::Armor < RPG::BaseItem #-------------------------------------------------------------------------- # * Requirements Text #-------------------------------------------------------------------------- def eqreq_text case kind when 3 return AYENE::ItemSpec::ACC_TEXT else return AYENE::ItemSpec::ARMOR_TEXT end end end #=================================================================== # ** Game_Actor #=================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Determine if Item can be Equipped (Actor's Parameters) #-------------------------------------------------------------------------- def equip_allowed?(item) return true if (item.spec_params[0] <= level && item.spec_params[1] <= base_maxhp && item.spec_params[2] <= base_maxmp && item.spec_params[3] <= base_atk && item.spec_params[4] <= base_def && item.spec_params[5] <= base_spi && item.spec_params[6] <= base_agi) && equip_skill_allowed?(item) return false end #-------------------------------------------------------------------------- # * Determine if Item can be Equipped (Actor's Skills ) #-------------------------------------------------------------------------- def equip_skill_allowed?(item) item.spec_params[7].each{|skill_id| return false if !skill_learn?($data_skills[skill_id]) } return true end end #=================================================================== # ** Game_Interpreter #=================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # * Aliased Definitions #-------------------------------------------------------------------------- alias aye_eqreq_command_315 command_315 alias aye_eqreq_command_316 command_316 alias aye_eqreq_command_317 command_317 alias aye_eqreq_command_318 command_318 #-------------------------------------------------------------------------- # * Check Equipment # actor : actor #-------------------------------------------------------------------------- def check_change_equip(actor) for i in 0..4 item = actor.equips[i] actor.change_equip(i, nil) if !item.nil? && !actor.equip_allowed?(item) end end #-------------------------------------------------------------------------- # * Change EXP #-------------------------------------------------------------------------- def command_315 aye_eqreq_command_315 iterate_actor_id(@params[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Change Level #-------------------------------------------------------------------------- def command_316 aye_eqreq_command_316 iterate_actor_id(@params[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Change Parameters #-------------------------------------------------------------------------- def command_317 aye_eqreq_command_317 iterate_actor_id(@params[0]) do |actor| check_change_equip(actor) end end #-------------------------------------------------------------------------- # * Change Skills #-------------------------------------------------------------------------- def command_318 aye_eqreq_command_318 iterate_actor_id(@params[0]) do |actor| check_change_equip(actor) end end end #=================================================================== # ** Window_EquipReq #=================================================================== class Window_EquipReq < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # item : item # data : parameters (array) # actor : actor # skill : skill #-------------------------------------------------------------------------- def initialize(item, data, actor, skill) if skill.empty? or !AYENE::ItemSpec::SHOW_SKILL_REC height = (data.size+1) / 2 * WLH + WLH + 32 else height = (data.size+1) / 2 * WLH + WLH + 32 + WLH * [skill.size, 7].min end super(42, 180 - height/2, 460, height) self.back_opacity = 255 self.contents.font.color = crisis_color self.contents.draw_text(4, 0, self.width - 40, WLH, item.eqreq_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, AYENE::ItemSpec::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 AYENE::ItemSpec::SHOW_SKILL_REC size = (data.size+1)/2*WLH self.contents.font.color = system_color self.contents.draw_text(x, y+size, 200, WLH, AYENE::ItemSpec::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 #=================================================================== # ** Window_EquipItem #=================================================================== class Window_EquipItem < Window_Item #-------------------------------------------------------------------------- # * Determine if item is enabled #-------------------------------------------------------------------------- def enable?(item) return @actor.equip_allowed?(item) end end #=================================================================== # ** Scene_Title #=================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Aliased Definitions #-------------------------------------------------------------------------- alias aye_eqreq_sctit_loaddata load_database #-------------------------------------------------------------------------- # * Load Database (aliased) #-------------------------------------------------------------------------- def load_database aye_eqreq_sctit_loaddata for group in [$data_weapons, $data_armors] for obj in group next if obj.nil? obj.equip_req_ini end end end end #=================================================================== # ** Scene_Equip #=================================================================== class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- # * Aliased Definitions #-------------------------------------------------------------------------- alias aye_eqreq_sceq_update update alias aye_eqreq_sceq_upditsel update_item_selection #-------------------------------------------------------------------------- # * Update Frame (aliased) #-------------------------------------------------------------------------- def update if @eqreq_window != nil update_eqreq_window else aye_eqreq_sceq_update end end #-------------------------------------------------------------------------- # * Update Item Selection (aliased) #-------------------------------------------------------------------------- def update_item_selection @item = @item_window.item if @item != nil and !@actor.equip_allowed?(@item) and Input.trigger?(Input::C) Sound.play_buzzer @item_window.active = false show_eqreq_window else aye_eqreq_sceq_upditsel end end #-------------------------------------------------------------------------- # * Show Requirements Window #-------------------------------------------------------------------------- def show_eqreq_window @frame = 0 data = [] @item.spec_params.each {|type, value| data.push([type, value]) if value > 0 if type < 7 } data.sort!{|a,b| a[0] <=> b[0]} skill = @item.spec_params[7] @eqreq_window = Window_EquipReq.new(@item, data, @actor, skill) end #-------------------------------------------------------------------------- # * Update Requirements Window #-------------------------------------------------------------------------- def update_eqreq_window @frame < 200 ? @frame += 1 : @frame = 0 if @frame == 200 or Input.trigger?(Input::C) or Input.trigger?(Input::B) @eqreq_window.dispose @eqreq_window = nil @item_window.active = true end end end Instruction dans le script et sur Oniro.^^ |
|
Invité Invité
| Sujet: Re: [VX] Niveau requis Jeu 5 Juil 2012 - 16:01 | |
| Roh t'es trop rapide Rito, merci beaucoup. =) Je t'ajoute quelques points. |
|
RitoJS Ancien staffeux
Messages postés : 1925 Date d'inscription : 22/02/2012 Jauge LPC :
| Sujet: Re: [VX] Niveau requis Jeu 5 Juil 2012 - 16:04 | |
| |
|
Contenu sponsorisé
| Sujet: Re: [VX] Niveau requis | |
| |
|