Accueil du SiteAccueil du Site  AccueilAccueil  Dernières imagesDernières images  RechercherRechercher  ConnexionConnexion  S'enregistrerS'enregistrer  



-29%
Le deal à ne pas rater :
DYSON V8 Origin – Aspirateur balai sans fil
269.99 € 379.99 €
Voir le deal

Partagez
 

 Equipement Skill System

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Choco-sama
Ancien staffeux
Ancien staffeux
Choco-sama

Masculin
Messages postés : 3012
Date d'inscription : 19/10/2009
Jauge LPC :
Equipement Skill System 891527140058 / 10058 / 100Equipement Skill System 8915271400

Equipement Skill System Game-d10
Equipement Skill System Mappeu10
Equipement Skill System Projet16
Equipement Skill System Projet10
Equipement Skill System Membre15
Equipement Skill System Promot10
Equipement Skill System Padago10
Equipement Skill System Riche_10
Equipement Skill System Travai10
Equipement Skill System Mythe_10


Equipement Skill System Empty
MessageSujet: Equipement Skill System   Equipement Skill System EmptyVen 9 Aoû 2013 - 1:45

Equipement Skill System

Auteur: Fomar0153

Ce script permet de définir des compétences lorsqu'on s'équipe d'armes et d'armures (avec la possibilité d'apprendre la compétence de façon permanente si vous utilisez un système AP). Par exemple, une épée possède la compétence "Lame Flamme", si un personnage s'en équipe, il pourra utiliser cette compétence.

Screen:

Equipement Skill System SS0002


Script autonome:

Code:
=begin
Equipment Skills System Script
by Fomar0153
Version 1.1
----------------------
Notes
----------------------
Requires an AP System if you want characters to
learn skills pernamently.
If using my Custom Equipment Slots script then
make sure this script is above the Equipment Slots Script
and make sure you have the compatability patch.
Allows learning of skills by equipment with the
option to learn skills pernamently.
----------------------
Instructions
----------------------
Set Learn_Skills to false if you want the skills to
only be temporary.
If you can learn skills then you need to set up AP for
each skill you put on an item.
In the notes section put:
AP:n
where n is the ap required to learn pernamently.
Then follow the instructions below about how to add skills
to weapons and armor.
----------------------
Change Log
----------------------
1.0 -> 1.1 Fixed a bug which caused skills learnt from
          armour to not display they were learnt.
----------------------
Known bugs
----------------------
None
=end
 
 
module Equipment_Skills
 
  # If set to false then characters will not
  # learn the skills pernamently and you will
  # not need an ap system
  Learn_Skills = true
 
  Weapons = []
  # Add weapon skills in this format
  # Weapons[weapon_id] = [skillid1, skillid2]
  Weapons[1] = [8]
 
  Armors = []
  # Add weapon skills in this format
  # Armors[armor_id] = [skillid1, skillid2]
  Armors[3] = [9]
 
  def self.get_ap_cost(skill_id)
    t = $data_skills[skill_id].note
    if t.include?("AP:")
      ap = /AP:(\d+)/.match(t)
      ap = ap[0].split(":")
      return ap[1].to_i
    end
    return 999
  end
 
end
 
class Game_Actor < Game_Battler
  attr_reader  :ap
  #--------------------------------------------------------------------------
  # ● Aliases setup
  #--------------------------------------------------------------------------
  alias eqskills_setup setup
  def setup(actor_id)
    eqskills_setup(actor_id)
    if Equipment_Skills::Learn_Skills
      @ap = []
    end
  end
  #--------------------------------------------------------------------------
  # ● Rewrites change_equip
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
    return unless trade_item_with_party(item, equips[slot_id])
    if equips[slot_id].is_a?(RPG::Weapon)
      unless Equipment_Skills::Weapons[equips[slot_id].id] == nil
        for skill in Equipment_Skills::Weapons[equips[slot_id].id]
          if Equipment_Skills::Learn_Skills
            if @ap[skill] == nil
              @ap[skill] = 0
            end
            unless @ap[skill] >= Equipment_Skills.get_ap_cost(skill)
              forget_skill(skill)
            end
          else
            forget_skill(skill)
          end
        end
      end
    end
    if equips[slot_id].is_a?(RPG::Armor)
      unless Equipment_Skills::Armors[equips[slot_id].id] == nil
        for skill in Equipment_Skills::Armors[equips[slot_id].id]
          if Equipment_Skills::Learn_Skills
            if @ap[skill] == nil
              @ap[skill] = 0
            end
            unless @ap[skill] >= Equipment_Skills.get_ap_cost(skill)
              forget_skill(skill)
            end
          else
            forget_skill(skill)
          end
        end
      end
    end
    return if item && equip_slots[slot_id] != item.etype_id
    @equips[slot_id].object = item
    refresh
  end
  #--------------------------------------------------------------------------
  # ● New Method or Rewrites gain_ap
  #--------------------------------------------------------------------------
  def gain_ap(ap)
    if Equipment_Skills::Learn_Skills
      for item in self.equips
        if item.is_a?(RPG::Weapon)
          unless Equipment_Skills::Weapons[item.id] == nil
            for skill in Equipment_Skills::Weapons[item.id]
              if @ap[skill] == nil
                @ap[skill] = 0
              end
              last_ap = @ap[skill]
              @ap[skill] += ap
              if last_ap < Equipment_Skills.get_ap_cost(skill) and Equipment_Skills.get_ap_cost(skill) <= @ap[skill]
                SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill].name + ".")
              end
            end
          end
        end
        if item.is_a?(RPG::Armor)
          unless Equipment_Skills::Armors[item.id] == nil
            for skill in Equipment_Skills::Armors[item.id]
              if @ap[skill] == nil
                @ap[skill] = 0
              end
              last_ap = @ap[skill]
              @ap[skill] += ap
              if last_ap < Equipment_Skills.get_ap_cost(skill) and Equipment_Skills.get_ap_cost(skill) <= @ap[skill]
                SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill].name + ".")
              end
            end
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● Aliases refresh
  #--------------------------------------------------------------------------
  alias eqskills_refresh refresh
  def refresh
    eqskills_refresh
    for item in self.equips
      if item.is_a?(RPG::Weapon)
        unless Equipment_Skills::Weapons[item.id] == nil
          for skill in Equipment_Skills::Weapons[item.id]
            learn_skill(skill)
          end
        end
      end
      if item.is_a?(RPG::Armor)
        unless Equipment_Skills::Armors[item.id] == nil
          for skill in Equipment_Skills::Armors[item.id]
            learn_skill(skill)
          end
        end
      end
    end
    # relearn any class skills you may have forgotten
    self.class.learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level <= @level
    end
  end
end
 
 
class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● Rewrites col_max
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # ● Aliases update_help
  #--------------------------------------------------------------------------
  alias eqskills_update_help update_help
  def update_help
    eqskills_update_help
    if @actor && @status_window
      @status_window.refresh(item)
    end
  end
end
 
class Scene_Equip < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● Rewrites create_item_window
  #--------------------------------------------------------------------------
  alias eqskills_create_item_window create_item_window
  def create_item_window
    wx = @status_window.width # Edited line if you need to merge
    wy = @slot_window.y + @slot_window.height
    ww = @slot_window.width  # Edited line if you need to merge
    wh = Graphics.height - wy
    @item_window = Window_EquipItem.new(wx, wy, ww, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.status_window = @status_window
    @item_window.actor = @actor
    @item_window.set_handler(:ok,    method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @slot_window.item_window = @item_window
  end
end
 
 
class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● Rewrites window_height
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - (2 * line_height + standard_padding * 2)#fitting_height(visible_line_number)
  end
  #--------------------------------------------------------------------------
  # ● Aliases refresh
  #--------------------------------------------------------------------------
  alias eqskills_refresh refresh
  def refresh(item = nil)
    eqskills_refresh
    contents.clear
    draw_actor_name(@actor, 4, 0) if @actor
    6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
      unless item == nil
      if item.is_a?(RPG::Weapon)
        unless Equipment_Skills::Weapons[item.id] == nil
          skills = Equipment_Skills::Weapons[item.id]
        end
      end
      if item.is_a?(RPG::Armor)
        unless Equipment_Skills::Armors[item.id] == nil
          skills = Equipment_Skills::Armors[item.id]
        end
      end
      unless skills == nil
        change_color(normal_color)
        draw_text(4, 168, width, line_height, "Equipment Skills")
        change_color(system_color)
        i = 1
        for skill in skills
          draw_text(4, 168 + 24 * i, width, line_height, $data_skills[skill].name)
          if Equipment_Skills::Learn_Skills and @actor.ap[skill] == nil
            @actor.ap[skill] = 0
          end
          i = i + 1
          if Equipment_Skills::Learn_Skills
            draw_current_and_max_values(4, 168 + 24 * i, width - 50, [@actor.ap[skill],Equipment_Skills.get_ap_cost(skill)].min, Equipment_Skills.get_ap_cost(skill), system_color, system_color)
            i = i + 1
          end
        end
      end
    end
  end
end
 
 
class Window_EquipSlot < Window_Selectable
  #--------------------------------------------------------------------------
  # ● Aliases update
  #--------------------------------------------------------------------------
  alias eqskills_update update
  def update
    eqskills_update
    @status_window.refresh(self.item) if self.active == true
  end
end
 
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● New method add_text
  #--------------------------------------------------------------------------
  def add_message(text)
    $game_message.add('\.' + text)
  end
end

Script en lien avec le script "Unique Classes":

Code:
=begin
Equipment Skills System Script
by Fomar0153
Version 1.1
----------------------
Notes
----------------------
Requires an AP System if you want characters to
learn skills pernamently.
If using my Custom Equipment Slots script then
make sure this script is above the Equipment Slots Script
and make sure you have the compatability patch.
Allows learning of skills by equipment with the
option to learn skills pernamently.
----------------------
Instructions
----------------------
Set Learn_Skills to false if you want the skills to
only be temporary.
If you can learn skills then you need to set up AP for
each skill you put on an item.
In the notes section put:
AP:n
where n is the ap required to learn pernamently.
Then follow the instructions below about how to add skills
to weapons and armor.
----------------------
Change Log
----------------------
1.0 -> 1.1 Fixed a bug which caused skills learnt from
          armour to not display they were learnt.
----------------------
Known bugs
----------------------
None
=end
 
 
module Equipment_Skills
 
  # If set to false then characters will not
  # learn the skills pernamently and you will
  # not need an ap system
  Learn_Skills = true
 
  Weapons = []
  # Add weapon skills in this format
  # Weapons[weapon_id] = [skillid1, skillid2]
  Weapons[1] = [8]
 
  Armors = []
  # Add weapon skills in this format
  # Armors[armor_id] = [skillid1, skillid2]
  Armors[3] = [9]
 
  def self.get_ap_cost(skill_id)
    t = $data_skills[skill_id].note
    if t.include?("AP:")
      ap = /AP:(\d+)/.match(t)
      ap = ap[0].split(":")
      return ap[1].to_i
    end
    return 999
  end
 
end
 
class Game_Actor < Game_Battler
  attr_reader  :ap
  #--------------------------------------------------------------------------
  # ● Aliases setup
  #--------------------------------------------------------------------------
  alias eqskills_setup setup
  def setup(actor_id)
    eqskills_setup(actor_id)
    if Equipment_Skills::Learn_Skills
      @ap = []
    end
  end
  #--------------------------------------------------------------------------
  # ● Rewrites change_equip
  #--------------------------------------------------------------------------
  def change_equip(slot_id, item)
    return unless trade_item_with_party(item, equips[slot_id])
    if equips[slot_id].is_a?(RPG::Weapon)
      unless Equipment_Skills::Weapons[equips[slot_id].id] == nil
        for skill in Equipment_Skills::Weapons[equips[slot_id].id]
          if Equipment_Skills::Learn_Skills
            if @ap[skill] == nil
              @ap[skill] = 0
            end
            unless @ap[skill] >= Equipment_Skills.get_ap_cost(skill)
              forget_skill(skill)
            end
          else
            forget_skill(skill)
          end
        end
      end
    end
    if equips[slot_id].is_a?(RPG::Armor)
      unless Equipment_Skills::Armors[equips[slot_id].id] == nil
        for skill in Equipment_Skills::Armors[equips[slot_id].id]
          if Equipment_Skills::Learn_Skills
            if @ap[skill] == nil
              @ap[skill] = 0
            end
            unless @ap[skill] >= Equipment_Skills.get_ap_cost(skill)
              forget_skill(skill)
            end
          else
            forget_skill(skill)
          end
        end
      end
    end
    return if item && equip_slots[slot_id] != item.etype_id
    @equips[slot_id].object = item
    refresh
  end
  #--------------------------------------------------------------------------
  # ● New Method or Rewrites gain_ap
  #--------------------------------------------------------------------------
  def gain_ap(ap)
    if Equipment_Skills::Learn_Skills
      for item in self.equips
        if item.is_a?(RPG::Weapon)
          unless Equipment_Skills::Weapons[item.id] == nil
            for skill in Equipment_Skills::Weapons[item.id]
              if @ap[skill] == nil
                @ap[skill] = 0
              end
              last_ap = @ap[skill]
              @ap[skill] += ap
              if last_ap < Equipment_Skills.get_ap_cost(skill) and Equipment_Skills.get_ap_cost(skill) <= @ap[skill]
                SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill].name + ".")
              end
            end
          end
        end
        if item.is_a?(RPG::Armor)
          unless Equipment_Skills::Armors[item.id] == nil
            for skill in Equipment_Skills::Armors[item.id]
              if @ap[skill] == nil
                @ap[skill] = 0
              end
              last_ap = @ap[skill]
              @ap[skill] += ap
              if last_ap < Equipment_Skills.get_ap_cost(skill) and Equipment_Skills.get_ap_cost(skill) <= @ap[skill]
                SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill].name + ".")
              end
            end
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● Aliases refresh
  #--------------------------------------------------------------------------
  alias eqskills_refresh refresh
  def refresh
    eqskills_refresh
    for item in self.equips
      if item.is_a?(RPG::Weapon)
        unless Equipment_Skills::Weapons[item.id] == nil
          for skill in Equipment_Skills::Weapons[item.id]
            learn_skill(skill)
          end
        end
      end
      if item.is_a?(RPG::Armor)
        unless Equipment_Skills::Armors[item.id] == nil
          for skill in Equipment_Skills::Armors[item.id]
            learn_skill(skill)
          end
        end
      end
    end
    # relearn any class skills you may have forgotten
    self.class.learnings.each do |learning|
      learn_skill(learning.skill_id) if learning.level <= @level
    end
  end
end
 
 
class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● Rewrites col_max
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # ● Aliases update_help
  #--------------------------------------------------------------------------
  alias eqskills_update_help update_help
  def update_help
    eqskills_update_help
    if @actor && @status_window
      @status_window.refresh(item)
    end
  end
end
 
class Scene_Equip < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● Rewrites create_item_window
  #--------------------------------------------------------------------------
  alias eqskills_create_item_window create_item_window
  def create_item_window
    wx = @status_window.width # Edited line if you need to merge
    wy = @slot_window.y + @slot_window.height
    ww = @slot_window.width  # Edited line if you need to merge
    wh = Graphics.height - wy
    @item_window = Window_EquipItem.new(wx, wy, ww, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.status_window = @status_window
    @item_window.actor = @actor
    @item_window.set_handler(:ok,    method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @slot_window.item_window = @item_window
  end
end
 
 
class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● Rewrites window_height
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - (2 * line_height + standard_padding * 2)#fitting_height(visible_line_number)
  end
  #--------------------------------------------------------------------------
  # ● Aliases refresh
  #--------------------------------------------------------------------------
  alias eqskills_refresh refresh
  def refresh(item = nil)
    eqskills_refresh
    contents.clear
    draw_actor_name(@actor, 4, 0) if @actor
    6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
      unless item == nil
      if item.is_a?(RPG::Weapon)
        unless Equipment_Skills::Weapons[item.id] == nil
          skills = Equipment_Skills::Weapons[item.id]
        end
      end
      if item.is_a?(RPG::Armor)
        unless Equipment_Skills::Armors[item.id] == nil
          skills = Equipment_Skills::Armors[item.id]
        end
      end
      unless skills == nil
        change_color(normal_color)
        draw_text(4, 168, width, line_height, "Equipment Skills")
        change_color(system_color)
        i = 1
        for skill in skills
          draw_text(4, 168 + 24 * i, width, line_height, $data_skills[skill].name)
          if Equipment_Skills::Learn_Skills and @actor.ap[skill] == nil
            @actor.ap[skill] = 0
          end
          i = i + 1
          if Equipment_Skills::Learn_Skills
            draw_current_and_max_values(4, 168 + 24 * i, width - 50, [@actor.ap[skill],Equipment_Skills.get_ap_cost(skill)].min, Equipment_Skills.get_ap_cost(skill), system_color, system_color)
            i = i + 1
          end
        end
      end
    end
  end
end
 
 
class Window_EquipSlot < Window_Selectable
  #--------------------------------------------------------------------------
  # ● Aliases update
  #--------------------------------------------------------------------------
  alias eqskills_update update
  def update
    eqskills_update
    @status_window.refresh(self.item) if self.active == true
  end
end
 
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● New method add_text
  #--------------------------------------------------------------------------
  def add_message(text)
    $game_message.add('\.' + text)
  end
end
Revenir en haut Aller en bas
City Hunter
Administrateur
Administrateur
City Hunter

Masculin
Messages postés : 6524
Date d'inscription : 25/05/2011
Jauge LPC :
Equipement Skill System 891527140040 / 10040 / 100Equipement Skill System 8915271400

Equipement Skill System Staffe10
Equipement Skill System Mappeu10
Equipement Skill System Membre15
Equipement Skill System Testeu10
Equipement Skill System Promot10
Equipement Skill System Projet10
Equipement Skill System Projet16
Equipement Skill System Riche_10
Equipement Skill System Travai10
Equipement Skill System Collec10
Equipement Skill System Collec11
Equipement Skill System Collec12
Equipement Skill System Collec13
Equipement Skill System Pandac10
Equipement Skill System 10000011


Equipement Skill System Empty
MessageSujet: Re: Equipement Skill System   Equipement Skill System EmptySam 10 Aoû 2013 - 11:00

Merci pour ton partage choco Smile
Revenir en haut Aller en bas
Zexion
Administrateur
Administrateur
Zexion

Masculin
Messages postés : 6228
Date d'inscription : 04/01/2012
Jauge LPC :
Equipement Skill System 891527140097 / 10097 / 100Equipement Skill System 8915271400

Equipement Skill System Membre15
Equipement Skill System Event-10
Equipement Skill System Altrui10
Equipement Skill System Action10
Equipement Skill System Travai10
Equipement Skill System Collec10
Equipement Skill System Collec11
Equipement Skill System Collec12
Equipement Skill System Staffe11
Equipement Skill System Dessin10


Equipement Skill System Empty
MessageSujet: Re: Equipement Skill System   Equipement Skill System EmptySam 10 Aoû 2013 - 11:08

Merci Choco, je t'ajoute des points. oui
Revenir en haut Aller en bas
Contenu sponsorisé




Equipement Skill System Empty
MessageSujet: Re: Equipement Skill System   Equipement Skill System Empty

Revenir en haut Aller en bas
 
Equipement Skill System
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Zibroph Skill State System
» [VX] CC skill menu
» [XP] Auto-équipement
» Equipement visible
» Slot équipement

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Le Palais Créatif :: ~ PARTAGE ~ :: Scripts et plugins :: RPG Maker VXAce :: Système-
Sauter vers: