LODM (L'Oasis des Makers)
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

LODM (L'Oasis des Makers)

Forum d'étude sur le Making RMXP
 
AccueilPortailRechercherDernières imagesS'enregistrerConnexion
Le Deal du moment : -28%
Précommande : Smartphone Google Pixel 8a 5G ...
Voir le deal
389 €

 

 S'équiper de deux armes et/ou d'une arme à deux mains

Aller en bas 
AuteurMessage
Saga_fire

Saga_fire


Nombre de messages : 12
Age : 36
Projet Principal : Secret
Aide Recherchée pour : Characters/Battlers nouveaux
Date d'inscription : 19/05/2007

S'équiper de deux armes et/ou d'une arme à deux mains Empty
MessageSujet: S'équiper de deux armes et/ou d'une arme à deux mains   S'équiper de deux armes et/ou d'une arme à deux mains Icon_minitimeMar 29 Mai - 6:14

Voilà, j'ai trouvé ce script sur un forum anglais et je l'ai corrigé et modifié afin que le créateur puisse choisir le personnage qui s'équipe de deux armes, que le personnage puisse s'équiper d'une arme à deux mains et que les personnages ne puis pas s'équiper de deux boucliers. Pour l'installer, il suffit de coller le script ci-dessous au dessus de main avec le nom que vous désirez.Pour se servir du script lisez les commentaires.
Attention : ce script est fonctionnel, cependant il peut être non combatible avec d'éventuelles scripts concernant les menus ou les systèmes de combat donc si ça vous arrive précisez vos rajouts sur vos projets des scripts de ce genre afin qu'ils puisse ètre compatible avec ce script.
Code:

#==============================================================================
# ** Deux armes
#------------------------------------------------------------------------------
#  Pour s'équiper d'une deuxième arme
# Auteur : Makeamidget
# Modifié et édité par Saga_fire
=begin
Utilisation :
Si vous voulez vous équiper de deux armes allez a la l.1068 et mettez le nom de votre
personnage entre les guillemets.Si vous voulez plusieurs personnages avec deux armes,
rajouter sur cette ligne : and @actor.name != "nomdupersonnage"

L'arme 1 est l'arme de la main droite, le bouclier 1 est le bouclier de la main droite,
l'arme 2 est l'arme de la main gauche, le bouclier 2 est le bouclier de la main gauche.
Si vous voulez lors d'un nouveau jeu changer l'accessibilitée des armes et boucliers,
changer les valeurs avec "true" pour non équipable et false pour "équipable"
aux lignes 59 a 62.
ATTENTION : lorsque qu'un personnage entre en cours de jeu, l'accessibilitée des
armes et boucliers sera comme si c'est un nouveau jeu (pour lui).
=end
#==============================================================================
# ** Arme a deux mains
#------------------------------------------------------------------------------
#  Pour s'équiper d'une arme à deux mains
# Auteur : Saga_fire
=begin
Utilisation :
Si vous voulez équiper une arme a deux mains, allez dans base de donnée,
arme, description et mettez "deux main" ou vous voulez (les guillemets ne sont pas
obligatoire et vous pouvez écrire par exemple dans description : une épée a deux mains.
=end
#==============================================================================

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :weapon_type
  attr_accessor :armor_type
  attr_accessor :sec_attack
  attr_accessor :arme1
  attr_accessor :bouclier1
  attr_accessor :arme2
  attr_accessor :bouclier2
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    actor_id : actor ID
  #--------------------------------------------------------------------------
  alias double_weapons_initialize initialize
  def initialize(actor_id)
    double_weapons_initialize(actor_id)
    @weapon_type = $data_weapons[@weapon_id]
    @armor_type = $data_armors[@armor1_id]
    @sec_attack = nil
    @arme1 = false # L'arme 1 est équipable
    @bouclier1 = true # Le bouclier 1 n'est pas équipable
    @arme2 = true # L'arme 2 n'est pas équipable
    @bouclier2 = false # Le bouclier 2 est équipable
  end
  #--------------------------------------------------------------------------
  # * Get Element Revision Value
  #    element_id : element ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # Get values corresponding to element effectiveness
    table = [0,200,150,100,50,0,-100]
    result = table[$data_classes[@class_id].element_ranks[element_id]]
    if self.armor_type.is_a?(RPG::Weapon)
      # If this element is protected by armor, then it's reduced by half
      for i in [@armor2_id, @armor3_id, @armor4_id]
        armor = $data_armors[i]
        if armor != nil and armor.guard_element_set.include?(element_id)
          result /= 2
        end
      end
    else
      for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
        armor = $data_armors[i]
        if armor != nil and armor.guard_element_set.include?(element_id)
          result /= 2
        end
      end
    end
    # If this element is protected by states, then it's reduced by half
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # End Method
    return result
  end
  #--------------------------------------------------------------------------
  # * Determine State Guard
  #    state_id : state ID
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    if self.armor_type.is_a?(RPG::Weapon)
      for i in [@armor2_id, @armor3_id, @armor4_id]
        armor = $data_armors[i]
        if armor != nil
          if armor.guard_state_set.include?(state_id)
            return true
          end
        end
      end
    else
      return false
      for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
        armor = $data_armors[i]
        if armor != nil
          if armor.guard_state_set.include?(state_id)
            return true
          end
        end
      end
      return false
    end
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack Element
  #--------------------------------------------------------------------------
  def element_set
    n = []
    unless self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_weapons[@weapon_id]
      n += weapon != nil ? weapon.element_set : []
    end
    unless self.armor_type.is_a?(RPG::Armor)
      weapon2 = $data_weapons[@armor1_id]
      n += weapon2 != nil ? weapon2.element_set : []
    end
    n.flatten!
    n.uniq!
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (+)
  #--------------------------------------------------------------------------
  def plus_state_set
    n = []
    unless self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_weapons[@weapon_id]
      n += weapon != nil ? weapon.plus_state_set : []
    end
    unless self.armor_type.is_a?(RPG::Armor)
      weapon2 = $data_weapons[@armor1_id]
      n += weapon2 != nil ? weapon2.plus_state_set : []
    end
    n.flatten!
    n.uniq!
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (-)
  #--------------------------------------------------------------------------
  def minus_state_set
    n = []
    unless self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_weapons[@weapon_id]
      n += weapon != nil ? weapon.minus_state_set : []
    end
    unless self.armor_type.is_a?(RPG::Armor)
      weapon2 = $data_weapons[@armor1_id]
      n += weapon2 != nil ? weapon2.minus_state_set : []
    end
    n.flatten!
    n.uniq!
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Strength
  #--------------------------------------------------------------------------
  def base_str
    #took out the armor1 addition to the base_str
    n = $data_actors[@actor_id].parameters[2, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.str_plus : 0
    n += armor1 != nil ? armor1.str_plus : 0
    n += armor2 != nil ? armor2.str_plus : 0
    n += armor3 != nil ? armor3.str_plus : 0
    n += armor4 != nil ? armor4.str_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Dexterity
  #--------------------------------------------------------------------------
  def base_dex
    n = $data_actors[@actor_id].parameters[3, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.dex_plus : 0
    n += armor1 != nil ? armor1.dex_plus : 0
    n += armor2 != nil ? armor2.dex_plus : 0
    n += armor3 != nil ? armor3.dex_plus : 0
    n += armor4 != nil ? armor4.dex_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  def base_agi
    n = $data_actors[@actor_id].parameters[4, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.agi_plus : 0
    n += armor1 != nil ? armor1.agi_plus : 0
    n += armor2 != nil ? armor2.agi_plus : 0
    n += armor3 != nil ? armor3.agi_plus : 0
    n += armor4 != nil ? armor4.agi_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Intelligence
  #--------------------------------------------------------------------------
  def base_int
    n = $data_actors[@actor_id].parameters[5, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.int_plus : 0
    n += armor1 != nil ? armor1.int_plus : 0
    n += armor2 != nil ? armor2.int_plus : 0
    n += armor3 != nil ? armor3.int_plus : 0
    n += armor4 != nil ? armor4.int_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack Power
  #--------------------------------------------------------------------------
  def base_atk
    n = 0
    unless self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_weapons[@weapon_id]
      n += weapon != nil ? weapon.atk : 0
    end
    unless self.armor_type.is_a?(RPG::Armor)
      weapon2 = $data_weapons[@armor1_id]
      n += weapon2 != nil ? weapon2.atk : 0
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Physical Defense
  #--------------------------------------------------------------------------
  def base_pdef
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    pdef1 = weapon != nil ? weapon.pdef : 0
    pdef2 = armor1 != nil ? armor1.pdef : 0
    pdef3 = armor2 != nil ? armor2.pdef : 0
    pdef4 = armor3 != nil ? armor3.pdef : 0
    pdef5 = armor4 != nil ? armor4.pdef : 0
    return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  end
  #--------------------------------------------------------------------------
  # * Get Basic Magic Defense
  #--------------------------------------------------------------------------
  def base_mdef
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    mdef1 = weapon != nil ? weapon.mdef : 0
    mdef2 = armor1 != nil ? armor1.mdef : 0
    mdef3 = armor2 != nil ? armor2.mdef : 0
    mdef4 = armor3 != nil ? armor3.mdef : 0
    mdef5 = armor4 != nil ? armor4.mdef : 0
    return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  end
  #--------------------------------------------------------------------------
  # * Get Offensive Animation ID for Normal Defense
  #--------------------------------------------------------------------------
  def animation3_id
    weapon = $data_weapons[@armor1_id]
    return (weapon != nil ? weapon.animation1_id : 0)
  end
  #--------------------------------------------------------------------------
  # * Get Target Animation ID for Normal defense
  #--------------------------------------------------------------------------
    def animation4_id
    weapon = $data_weapons[@armor1_id]
    return (weapon != nil ? weapon.animation2_id : 0)
  end
  def two_shields
    if (self.weapon_type.is_a?(RPG::Armor) and self.armor_type.is_a?(RPG::Armor)) and
    (self.weapon_id != 0 and self.armor1_id != 0)
      return true
    else
      return false
    end
  end
  def two_weapons
    if (self.weapon_type.is_a?(RPG::Weapon) and self.armor_type.is_a?(RPG::Weapon)) and
    (self.weapon_id != 0 and self.armor1_id != 0)
      return true
    else
      return false
    end
  end
Revenir en haut Aller en bas
Saga_fire

Saga_fire


Nombre de messages : 12
Age : 36
Projet Principal : Secret
Aide Recherchée pour : Characters/Battlers nouveaux
Date d'inscription : 19/05/2007

S'équiper de deux armes et/ou d'une arme à deux mains Empty
MessageSujet: Re: S'équiper de deux armes et/ou d'une arme à deux mains   S'équiper de deux armes et/ou d'une arme à deux mains Icon_minitimeMar 29 Mai - 6:16

A la suite :
Code:

#--------------------------------------------------------------------------
  # * Change Equipment
  #    equip_type : type of equipment
  #    id    : weapon or armor ID (If 0, remove equipment)
  #--------------------------------------------------------------------------
  def equip(equip_type, id, item = RPG::Armor)
    case equip_type
    when 0  # Arme ou bouclier
      # Si rien n'est équipé
      if @weapon_id == 0
        # Si on équipe une arme
        if item.is_a?(RPG::Weapon)
          if id == 0 or $game_party.weapon_number(id) > 0
            self.weapon_type = $data_weapons[id]
            @weapon_id = id
            $game_party.lose_weapon(id, 1)
          end
        # Si on équipe un bouclier
        elsif item.is_a?(RPG::Armor)
          if id == 0 or $game_party.weapon_number(id) > 0
            self.weapon_type = $data_armors[id]
            @weapon_id = id
            $game_party.lose_armor(id, 1)
          end
        end
      end
      # Si on déséquipe l'arme ou l'armure
      if item == nil
        # Si une arme est équipée
        if self.weapon_type.is_a?(RPG::Weapon)
          if id == 0 or $game_party.weapon_number(id) > 0
            $game_party.gain_weapon(@weapon_id, 1)
            @weapon_id = id
          end
        # Sinon si un bouclier est équipé
        elsif self.weapon_type.is_a?(RPG::Armor)
          if id == 0 or $game_party.armor_number(id) > 0
            $game_party.gain_armor(@weapon_id, 1)
            @weapon_id = id
          end
        end
      #Sinon si on équipe une arme
      elsif item.is_a?(RPG::Weapon)
        # Si une arme est équipée
        if self.weapon_type.is_a?(RPG::Weapon)
          if id == 0 or $game_party.weapon_number(id) > 0
            $game_party.gain_weapon(@weapon_id, 1)
            self.weapon_type = $data_weapons[id]
            @weapon_id = id
            $game_party.lose_weapon(id, 1)
          end
        # Sinon si un bouclier est équipé
        elsif self.weapon_type.is_a?(RPG::Armor)
          if id == 0 or $game_party.weapon_number(id) > 0
            $game_party.gain_armor(@weapon_id, 1)
            self.weapon_type = $data_weapons[id]
            @weapon_id = id
            $game_party.lose_weapon(id, 1)
          end
        end
      # Sinon si on équipe un bouclier
      elsif item.is_a?(RPG::Armor)
        # Si un bouclier est équipé
        if self.weapon_type.is_a?(RPG::Armor)
          if id == 0 or $game_party.armor_number(id) > 0
            $game_party.gain_armor(@weapon_id, 1)
            self.weapon_type = $data_armors[id]
            @weapon_id = id
            $game_party.lose_armor(id, 1)
          end
        # Sinon si une arme est équipée
        elsif self.weapon_type.is_a?(RPG::Weapon)
          if id == 0 or $game_party.armor_number(id) > 0
            $game_party.gain_weapon(@weapon_id, 1)
            self.weapon_type = $data_armors[id]
            @weapon_id = id
            $game_party.lose_armor(id, 1)
          end
        end
      end
    when 1  # Bouclier et arme
      # Si rien n'est équipé
      if @armor1_id == 0
        # Si on équipe une arme
        if item.is_a?(RPG::Weapon)
          if id == 0 or $game_party.weapon_number(id) > 0
            self.armor_type = $data_weapons[id]
            @armor1_id = id
            $game_party.lose_weapon(id, 1)
          end
        # Sinon si on équipe un bouclier
        elsif item.is_a?(RPG::Armor)
          if id == 0 or $game_party.armor_number(id) > 0
            self.armor_type = $data_armors[id]
            @armor1_id = id
            $game_party.lose_armor(id, 1)
          end
        end
      end
      # Si on déséquipe
      if item == nil
        # Si une arme est équipée
        if self.armor_type.is_a?(RPG::Weapon)
          if id == 0 or $game_party.weapon_number(id) > 0
            $game_party.gain_weapon(@armor1_id, 1)
            @armor1_id = id
          end
        # Sinon si un bouclier est équipé
        elsif self.armor_type.is_a?(RPG::Armor)
          if id == 0 or $game_party.armor_number(id) > 0
            $game_party.gain_armor(@armor1_id, 1)
            @armor1_id = id
          end
        end
      # Sinon si on équipe une arme
      elsif item.is_a?(RPG::Weapon)
        # Si une arme est équipée
        if self.armor_type.is_a?(RPG::Weapon)
          if id == 0 or $game_party.weapon_number(id) > 0
            $game_party.gain_weapon(@armor1_id, 1)
            self.armor_type = $data_weapons[id]
            @armor1_id = id
            $game_party.lose_weapon(id, 1)
          end
        # Sinon si un bouclier est équipé
        elsif self.armor_type.is_a?(RPG::Armor)
          if id == 0 or $game_party.weapon_number(id) > 0
            $game_party.gain_armor(@armor1_id, 1)
            self.armor_type = $data_weapons[id]
            @armor1_id = id
            $game_party.lose_weapon(id, 1)
          end
        end
      # Sinon si on équipe un bouclier
      elsif item.is_a?(RPG::Armor)
        # Si un bouclier est équipé
        if self.armor_type.is_a?(RPG::Armor)
          if id == 0 or $game_party.armor_number(id) > 0
            $game_party.gain_armor(@armor1_id, 1)
            self.armor_type = $data_armors[id]
            @armor1_id = id
            $game_party.lose_armor(id, 1)
          end
        # Sinon si une arme est équipée
        elsif self.armor_type.is_a?(RPG::Weapon)
          if id == 0 or $game_party.armor_number(id) > 0
            $game_party.gain_weapon(@armor1_id, 1)
            self.armor_type = $data_armors[id]
            @armor1_id = id
            $game_party.lose_armor(id, 1)
          end
        end
      end
    when 2  # Head
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor2_id], $data_armors[id])
        $game_party.gain_armor(@armor2_id, 1)
        @armor2_id = id
        $game_party.lose_armor(id, 1)
      end
    when 3  # Body
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor3_id], $data_armors[id])
        $game_party.gain_armor(@armor3_id, 1)
        @armor3_id = id
        $game_party.lose_armor(id, 1)
      end
    when 4  # Accessory
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor4_id], $data_armors[id])
        $game_party.gain_armor(@armor4_id, 1)
        @armor4_id = id
        $game_party.lose_armor(id, 1)
      end
    end
  end
  # -------------------------------------
  def base_str
    if $game_temp.god_mode
      return 999
    end
    #took out the armor1 addition to the base_str
    n = $data_actors[@actor_id].parameters[2, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.str_plus : 0
    n += armor1 != nil ? armor1.str_plus : 0
    n += armor2 != nil ? armor2.str_plus : 0
    n += armor3 != nil ? armor3.str_plus : 0
    n += armor4 != nil ? armor4.str_plus : 0
    return [[n, 1].max, 999].min
  end
  # -------------------------------------
  def base_dex
    if $game_temp.god_mode
      return 999
    end
    n = $data_actors[@actor_id].parameters[3, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.dex_plus : 0
    n += armor1 != nil ? armor1.dex_plus : 0
    n += armor2 != nil ? armor2.dex_plus : 0
    n += armor3 != nil ? armor3.dex_plus : 0
    n += armor4 != nil ? armor4.dex_plus : 0
    return [[n, 1].max, 999].min
  end
  # -------------------------------------
  def base_agi
    if $game_temp.god_mode
      return 999
    end
    n = $data_actors[@actor_id].parameters[4, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.agi_plus : 0
    n += armor1 != nil ? armor1.agi_plus : 0
    n += armor2 != nil ? armor2.agi_plus : 0
    n += armor3 != nil ? armor3.agi_plus : 0
    n += armor4 != nil ? armor4.agi_plus : 0
    return [[n, 1].max, 999].min
  end
  # -------------------------------------
  def base_int
    if $game_temp.god_mode
      return 999
    end
    n = $data_actors[@actor_id].parameters[5, @level]
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.int_plus : 0
    n += armor1 != nil ? armor1.int_plus : 0
    n += armor2 != nil ? armor2.int_plus : 0
    n += armor3 != nil ? armor3.int_plus : 0
    n += armor4 != nil ? armor4.int_plus : 0
    return [[n, 1].max, 999].min
  end
  # -------------------------------------
  def base_atk
    if $game_temp.god_mode
      return 9999999
    end
    n = 0
    unless self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_weapons[@weapon_id]
      n += weapon != nil ? weapon.atk : 0
    end
    unless self.armor_type.is_a?(RPG::Armor)
      weapon2 = $data_weapons[@armor1_id]
      n += weapon2 != nil ? weapon2.atk : 0
    end
    return n
  end
  # -------------------------------------
  def base_pdef
    if $game_temp.god_mode
      return 999999
    end
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    pdef1 = weapon != nil ? weapon.pdef : 0
    pdef2 = armor1 != nil ? armor1.pdef : 0
    pdef3 = armor2 != nil ? armor2.pdef : 0
    pdef4 = armor3 != nil ? armor3.pdef : 0
    pdef5 = armor4 != nil ? armor4.pdef : 0
    return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  end
  # -------------------------------------
  def base_mdef
    if $game_temp.god_mode
      return 999999
    end
    if self.weapon_type.is_a?(RPG::Weapon)
      weapon = $data_weapons[@weapon_id]
    elsif self.weapon_type.is_a?(RPG::Armor)
      weapon = $data_armors[@weapon_id]
    end
    if self.armor_type.is_a?(RPG::Armor)
      armor1 = $data_armors[@armor1_id]
    elsif self.armor_type.is_a?(RPG::Weapon)
      armor1 = $data_weapons[@armor1_id]
    end
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    mdef1 = weapon != nil ? weapon.mdef : 0
    mdef2 = armor1 != nil ? armor1.mdef : 0
    mdef3 = armor2 != nil ? armor2.mdef : 0
    mdef4 = armor3 != nil ? armor3.mdef : 0
    mdef5 = armor4 != nil ? armor4.mdef : 0
    return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  end
end


#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================

class Window_Command
  #--------------------------------------------------------------------------
  # * Enable Item
  #    index : item number
  #--------------------------------------------------------------------------
  def enable_item(index)
    draw_item(index, normal_color)
  end
end


#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
#  This window displays items the actor is currently equipped with on the
#  equipment screen.
#==============================================================================

class Window_EquipRight < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @data = []
    @data.push($data_weapons[@actor.weapon_id])
    @data.push($data_armors[@actor.armor1_id])
    if @actor.weapon_type.is_a?(RPG::Weapon)
      @data[0] = $data_weapons[@actor.weapon_id]
    elsif @actor.weapon_type.is_a?(RPG::Armor)
      @data[0] = $data_armors[@actor.weapon_id]
    end
    if @actor.armor_type.is_a?(RPG::Weapon)
      @data[1] = $data_weapons[@actor.armor1_id]
    elsif @actor.armor_type.is_a?(RPG::Armor)
      @data[1] = $data_armors[@actor.armor1_id]
    end
    @data.push($data_armors[@actor.armor2_id])
    @data.push($data_armors[@actor.armor3_id])
    @data.push($data_armors[@actor.armor4_id])
    @item_max = @data.size
    self.contents.font.color = system_color
    self.contents.draw_text(4, 32 * 0, 92, 32, "Main droite")
    self.contents.draw_text(4, 32 * 1, 92, 32, "Main gauche")
    self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
    self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
    self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
    draw_item_name(@data[0], 92, 32 * 0)
    draw_item_name(@data[1], 92, 32 * 1)
    draw_item_name(@data[2], 92, 32 * 2)
    draw_item_name(@data[3], 92, 32 * 3)
    draw_item_name(@data[4], 92, 32 * 4)
  end
end

Revenir en haut Aller en bas
Saga_fire

Saga_fire


Nombre de messages : 12
Age : 36
Projet Principal : Secret
Aide Recherchée pour : Characters/Battlers nouveaux
Date d'inscription : 19/05/2007

S'équiper de deux armes et/ou d'une arme à deux mains Empty
MessageSujet: Re: S'équiper de deux armes et/ou d'une arme à deux mains   S'équiper de deux armes et/ou d'une arme à deux mains Icon_minitimeMar 29 Mai - 6:17

Encore a la suite :
Code:

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
#  This window displays choices when opting to change equipment on the
#  equipment screen.
#==============================================================================

class Window_EquipItem < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add equippable weapons
    if @equip_type == 0
      weapon_set = $data_classes[@actor.class_id].weapon_set
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
          @data.push($data_weapons[i])
        end
      end
      armor_set = $data_classes[@actor.class_id].armor_set
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and armor_set.include?(i)
          if $data_armors[i].kind == 0
            @data.push($data_armors[i])
          end
        end
      end
    end
    if @equip_type != 0
      if @equip_type == 1
        weapon_set = $data_classes[@actor.class_id].weapon_set
        for i in 1...$data_weapons.size
          if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
            @data.push($data_weapons[i])
          end
        end
      end
      armor_set = $data_classes[@actor.class_id].armor_set
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and armor_set.include?(i)
          if $data_armors[i].kind == @equip_type-1
            @data.push($data_armors[i])
          end
        end
      end
    end
    # Add blank page
    @data.push(nil)
    # Make a bit map and draw all items
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    for i in 0...@item_max-1
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    if @equip_type == 0
      if item.is_a?(RPG::Weapon)
        if @actor.arme1 == false
          self.contents.font.color = normal_color
        elsif @actor.arme1 == true
          self.contents.font.color = disabled_color
        end
      end
      if item.is_a?(RPG::Armor)
        if @actor.bouclier1 == false
          self.contents.font.color = normal_color
        elsif @actor.bouclier1 == true
          self.contents.font.color = disabled_color
        end
      end
    elsif @equip_type == 1
      if item.is_a?(RPG::Weapon)
        if @actor.arme2 == false
          self.contents.font.color = normal_color
        elsif @actor.arme2 == true
          self.contents.font.color = disabled_color
        end
      end
      if item.is_a?(RPG::Armor)
        if @actor.bouclier2 == false
          self.contents.font.color = normal_color
        elsif @actor.bouclier2 == true
          self.contents.font.color = disabled_color
        end
      end
    else
      self.contents.font.color = normal_color
    end
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end


#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs equipment screen processing.
#==============================================================================

class Scene_Equip
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Set item window to visible
    @item_window1.visible = (@right_window.index == 0)
    @item_window2.visible = (@right_window.index == 1)
    @item_window3.visible = (@right_window.index == 2)
    @item_window4.visible = (@right_window.index == 3)
    @item_window5.visible = (@right_window.index == 4)
    # Get currently equipped item
    item1 = @right_window.item
    # Set current item window to @item_window
    case @right_window.index
    when 0
      @item_window = @item_window1
    when 1
      @item_window = @item_window2
    when 2
      @item_window = @item_window3
    when 3
      @item_window = @item_window4
    when 4
      @item_window = @item_window5
    end
    # If right window is active
    if @right_window.active
      # Erase parameters for after equipment change
      @left_window.set_new_parameters(nil, nil, nil)
    end
    # If item window is active
    if @item_window.active
      # Get currently selected item
      item2 = @item_window.item
      # Change equipment
      last_hp = @actor.hp
      last_sp = @actor.sp
      @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id, item2)
      # Get parameters for after equipment change
      new_atk = @actor.atk
      new_pdef = @actor.pdef
      new_mdef = @actor.mdef
      # Return equipment
      @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id, item1)
      @actor.hp = last_hp
      @actor.sp = last_sp
      # Draw in left window
      @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @left_window.update
    @right_window.update
    @item_window.update
    # Remake item window1 and item window2 contents
    @item_window1.refresh
    @item_window2.refresh
    refresh
    # If right window is active: call update_right
    if @right_window.active
      update_right
      return
    end
    # If item window is active: call update_item
    if @item_window.active
      update_item
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when right window is active)
  #--------------------------------------------------------------------------
  def update_right
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # interrupteur to menu screen
      $scene = Scene_Menu.new(2)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If equipment is fixed
      if @actor.equip_fix?(@right_window.index)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Si on est dans la main droite et...
      if @item_window == @item_window1 and
        # ...que l'arme 1 et le bouclier 1 ne sont pas équipable
        @actor.arme1 == true and @actor.bouclier1 == true
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      # Sinon si on est dans la main gauche et...
      elsif @item_window == @item_window2 and
        # ...que l'arme 2 et le bouclier 2 ne sont pas équipables
        @actor.arme2 == true and @actor.bouclier2 == true
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Activate item window
      @right_window.active = false
      @item_window.active = true
      @item_window.index = 0
      return
    end
    # If R button was pressed
    if Input.trigger?(Input::R)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To next actor
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # interrupteur to different equipment screen
      $scene = Scene_Equip.new(@actor_index, @right_window.index)
      return
    end
    # If L button was pressed
    if Input.trigger?(Input::L)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To previous actor
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # interrupteur to different equipment screen
      $scene = Scene_Equip.new(@actor_index, @right_window.index)
      return
    end
  end

Revenir en haut Aller en bas
Saga_fire

Saga_fire


Nombre de messages : 12
Age : 36
Projet Principal : Secret
Aide Recherchée pour : Characters/Battlers nouveaux
Date d'inscription : 19/05/2007

S'équiper de deux armes et/ou d'une arme à deux mains Empty
MessageSujet: Re: S'équiper de deux armes et/ou d'une arme à deux mains   S'équiper de deux armes et/ou d'une arme à deux mains Icon_minitimeMar 29 Mai - 6:18

Toujours a la suite :
Code:

#--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = 0
      @item_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      item = @item_window.item
      if @actor.name != "Arshes"
        # Si on est dans la main droite
        if @item_window == @item_window1
          #Si on équipe une arme et que c'est écrit dans description deux mains
          if item != nil and item.description.include?("deux mains")
            # Si l'arme 1 n'est pas équipable
            if @actor.arme1 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Change equipment
            @actor.equip(1, 0, item)
            # L'arme 1 est équipable
            @actor.arme1 = false
            # Le bouclier 1 est équipable
            @actor.bouclier1 = false
            # L'arme 2 n'est pas équipable
            @actor.arme2 = true
            # Le bouclier 2 n'est pas équipable
            @actor.bouclier2 = true
          #Sinon si on équipe une arme
          elsif item.is_a?(RPG::Weapon)
            # Si l'arme 1 n'est pas équipable
            if @actor.arme1 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            # Sinon si le bouclier 1 n'est pas équipable
            elsif @actor.bouclier1 == true
              # L'arme 1 est équipable
              @actor.arme1 = false
              # L'arme 2 n'est pas équipable
              @actor.arme2 = true
            # Sinon
            else
              # L'arme 1 est équipable
              @actor.arme1 = false
              # Le bouclier 1 est équipable
              @actor.bouclier1 = false
            end
            # Si l'arme 1 est équipable
            if @actor.arme1 == false
              # L'arme 2 n'est pas équipable
              @actor.arme2 = true
              # Le bouclier 2 est équipable
              @actor.bouclier2 = false
            end
          # Sinon si on équipe un bouclier
          elsif item.is_a?(RPG::Armor)
            # Si le bouclier 1 n'est pas équipable
            if @actor.bouclier1 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            # Sinon si l'arme 1 n'est pas équipable
            elsif @actor.arme1 == true
              # Le bouclier 1 est équipable
              @actor.bouclier1 = false
              # Le bouclier 2 n'est pas équipable
              @actor.bouclier2 = true
            # Sinon
            else
              # L'arme 1 est équipable
              @actor.arme1 = false
              # Le bouclier 1 est équipable
              @actor.bouclier1 = false
            end
            # Si le bouclier 1 est équipable
            if @actor.bouclier1 == false
              # L'arme 2 est équipable
              @actor.arme2 = false
              # Le bouclier 2 n'est pas équipable
              @actor.bouclier2 = true
            end
          # Sinon si on déséquipe et que l'arme 1 et le bouclier 1 sont équipables
          elsif item == nil and @actor.arme1 == false and @actor.bouclier1 == false
            # L'arme 2 est équipable
            @actor.arme2 = false
            # Le bouclier 2 est équipable
            @actor.bouclier2 = false
          # Sinon si on déséquipe et que l'arme 2 est équipable
          elsif item == nil and @actor.arme2 == false
            # L 'arme 1 n'est  pas équipable
            @actor.arme1 = true
            # Le bouclier est équipable
            @actor.bouclier1 = false
            # Le bouclier 2 est équipable
            @actor.bouclier2 = false
          # Sinon si on déséquipe et que le bouclier 2 est équipable
          elsif item == nil and @actor.bouclier2 == false
            # L'arme 1 est équipable
            @actor.arme1 = false
            # Le bouclier 1 n'est pas équipable
            @actor.bouclier1 = true
            # L'arme 2 est équipable
            @actor.arme2 = false
          end
        # Sinon si on est dans la mains gauche
        elsif @item_window == @item_window2
          #Si on équipe une arme et que c'est écrit dans description deux mains
          if item != nil and item.description.include?("deux mains")
            # Si l'arme 2 n'est  pas équipable
            if @actor.arme2 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Change equipment
            @actor.equip(0, 0, item)
            # L'arme 2 est équipable
            @actor.arme2 = false
            # Le bouclier 2 est équipable
            @actor.bouclier2 = false
            # L'arme 1 n'est pas équipable
            @actor.arme1 = true
            # Le bouclier 1 n'est pas équipable
            @actor.bouclier1 = true
          #Sinon si on équipe une arme
          elsif item.is_a?(RPG::Weapon)
            # Si l'arme 2 n'est  pas équipable
            if @actor.arme2 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            # Sinon si le bouclier 2 n'est pas équipable
            elsif @actor.bouclier2 == true
              # L'arme 2 est équipable
              @actor.arme2 = false
              # L'arme 1 n'est pas équipable
              @actor.arme1 = true
            # Sinon
            else
              # L'arme 2 est équipable
              @actor.arme2 = false
              # Le bouclier 2 est équipable
              @actor.bouclier2 = false
            end
            # Si l'arme 2 est équipable
            if @actor.arme2 == false
              # L'arme 1 n'est pas équipable
              @actor.arme1 = true
              # Le bouclier 1 est équipable
              @actor.bouclier1 = false
            end
          # Sinon si on équipe un bouclier
          elsif item.is_a?(RPG::Armor)
            # Si le bouclier 2 n'est pas équipable
            if @actor.bouclier2 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            # Sinon si l'arme 2 n'est pas équipable
            elsif @actor.arme2 == true
              # Le bouclier 2 est équipable
              @actor.bouclier2 = false
              # Le bouclier 1 n'est pas équipable
              @actor.bouclier1 = true
            # Sinon
            else
              # L'arme 2 est équipable
              @actor.arme2 = false
              # Le bouclier 2 est équipable
              @actor.bouclier2 = false
            end
            # Si le bouclier 2 est équipable
            if @actor.bouclier2 == false
              # L'arme 1 est équipable
              @actor.arme1 = false
              # Le bouclier 1 n'est pas équipable
              @actor.bouclier1 = true
            end
          # Sinon si on déséquipe et que l'arme 2 et le bouclier 2 sont équipables
          elsif item == nil and @actor.arme2 == false and @actor.bouclier2 == false
            # L'arme 1 est équipable
            @actor.arme1 = false
            # Le bouclier 1 est équipable
            @actor.bouclier1 = false
          # Sinon si on déséquipe et que l'arme 1 est équipable
          elsif item == nil and @actor.arme1 == false
            # L 'arme 2 n'est  pas équipable
            @actor.arme2 = true
            # Le bouclier est équipable
            @actor.bouclier2 = false
            # Le bouclier 1 est équipable
            @actor.bouclier1 = false
          # Sinon si on déséquipe et que le bouclier 1 est équipable
          elsif item == nil and @actor.bouclier1 == false
            # L'arme 2 est équipable
            @actor.arme2 = false
            # Le bouclier 2 n'est pas équipable
            @actor.bouclier2 = true
            # L'arme 1 est équipable
            @actor.arme1 = false
          end
        end
      # Sinon
      else
        # Si on est dans la main droite
        if @item_window == @item_window1
          #Si on équipe une arme et que c'est écrit dans description deux mains
          if item != nil and item.description.include?("deux mains")
            # Change equipment
            @actor.equip(1, 0, item)
            # L'arme 1 est équipable
            @actor.arme1 = false
            # Le bouclier 2 est équipable
            @actor.bouclier1 = false
            # L'arme 2 n'est pas équipable
            @actor.arme2 = true
            # Le bouclier 2 n'est pas équipable
            @actor.bouclier2 = true
          #----------FIN----------
          # Sinon si on équipe une arme
          elsif item.is_a?(RPG::Weapon)
            # L'arme 2 est équipable
            @actor.arme2 = false
            # Le bouclier 2 est équipable
            @actor.bouclier2 = false
          # Sinon si on équipe un bouclier
          elsif item.is_a?(RPG::Armor)
            # Si le bouclier 1 n'est pas équipable
            if @actor.bouclier1 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # L'arme 2 est équipable
            @actor.arme2 = false
            # Le bouclier 2 n'est pas équipable
            @actor.bouclier2 = true
          # Sinon si on déséquipe et que le bouclier 2 n'est pas équipable
          elsif item == nil and @actor.bouclier2 == true
            # Le bouclier 2 est équipable
            @actor.bouclier2 = false
          end
        # Sinon si on est dans la main gauche
        elsif @item_window == @item_window2
          #Si on équipe une arme et que c'est écrit dans description deux mains
          if item != nil and item.description.include?("deux mains")
            # Change equipment
            @actor.equip(0, 0, item)
            # L'arme 2 est équipable
            @actor.arme2 = false
            # Le bouclier 2 est équipable
            @actor.bouclier2 = false
            # L'arme 1 n'est pas équipable
            @actor.arme1 = true
            # Le bouclier 1 n'est pas équipable
            @actor.bouclier1 = true
          # Sinon si on équipe une arme
          elsif item.is_a?(RPG::Weapon)
            # L'arme 1 est équipable
            @actor.arme1 = false
            # Le bouclier 1 est équipable
            @actor.bouclier1 = false
          # Sinon si on équipe un bouclier
          elsif item.is_a?(RPG::Armor)
            # Si le bouclier 2 n'est pas équipable
            if @actor.bouclier2 == true
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # L'arme 1 est équipable
            @actor.arme1 = false
            # Le bouclier 1 n'est pas équipable
            @actor.bouclier1 = true
          # Sinon si on déséquipe et que le bouclier 1 n'est pas équipable
          elsif item == nil and @actor.bouclier1 == true
            # Le bouclier 1 est équipable
            @actor.bouclier1 = false
          end
        end
      end
      # Change equipment
      @actor.equip(@right_window.index, item == nil ? 0 : item.id, item)
      # Play equip SE
      $game_system.se_play($data_system.equip_se)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = 0
      @item_window.index = -1
      # Remake right window and item window contents
      @right_window.refresh
      @item_window1.refresh
      @item_window2.refresh
      @item_window.refresh
      return
    end
  end
end

Revenir en haut Aller en bas
Saga_fire

Saga_fire


Nombre de messages : 12
Age : 36
Projet Principal : Secret
Aide Recherchée pour : Characters/Battlers nouveaux
Date d'inscription : 19/05/2007

S'équiper de deux armes et/ou d'une arme à deux mains Empty
MessageSujet: Re: S'équiper de deux armes et/ou d'une arme à deux mains   S'équiper de deux armes et/ou d'une arme à deux mains Icon_minitimeMar 29 Mai - 6:19

Enfin a la suite :
Code:

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Go to command input for previous actor
phase3_prior_actor
return
end
if @active_battler.two_shields
@actor_command_window.disable_item(0)
else
@actor_command_window.enable_item(0)
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
if @active_battler.two_shields
# Play decision SE
$game_system.se_play($data_system.buzzer_se)
return
end
if @active_battler.two_weapons == true
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 4
else
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
$game_system.se_play($data_system.decision_se)
start_enemy_select
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
when 2 # guard
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
when 3 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
end
return
end
end
#--------------------------------------------------------------------------
# * Make Basic Action Results
#--------------------------------------------------------------------------
def make_basic_action_result
# If attack
if @active_battler.current_action.basic == 0
# Set anaimation ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# If action battler is enemy
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# If action battler is actor
if @active_battler.is_a?(Game_Actor)
if @active_battler.armor_type.is_a?(RPG::Weapon)
@animation1_id = @active_battler.animation3_id
@animation2_id = @active_battler.animation4_id
end
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# Set array of targeted battlers
@target_battlers = [target]
# Apply normal attack results
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
# If guard
if @active_battler.current_action.basic == 1
# Display "Guard" in help window
@help_window.set_text($data_system.words.guard, 1)
return
end
# If escape
if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
# Display "Escape" in help window
@help_window.set_text("Escape", 1)
# Escape
@active_battler.escape
return
end
# If doing nothing
if @active_battler.current_action.basic == 3
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
if @active_battler.current_action.basic == 4
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
@animation3_id = @active_battler.animation3_id
@animation4_id = @active_battler.animation4_id
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
@target_battlers = [target]
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
def update_phase4_step4
if @active_battler.is_a?(Game_Actor)
if @active_battler.two_weapons == true && @active_battler.sec_attack == 0
for target in @target_battlers
target.animation_id = @animation4_id
target.animation_hit = (target.damage != "Raté")
@phase4_step = 5
return
end
end
end
# Animation for target
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Raté")
end
# Animation has at least 8 frames, regardless of its length
@wait_count = 8
# Shift to step 5
@phase4_step = 5
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
def update_phase4_step5
# Hide help window
@help_window.visible = false
# Refresh status window
@status_window.refresh
if @active_battler.is_a?(Game_Actor)
if @active_battler.current_action.basic == 4
if @active_battler.two_weapons == true && @active_battler.sec_attack == nil
@active_battler.sec_attack = 0
@phase4_step = 3
return
else
@active_battler.sec_attack = nil
end
end
end
# Display damage
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
end
end
# Shift to step 6
@phase4_step = 6
end
end

Bon, c'est long j'avoue mais c'est sympa. Je précise qu'avec deux armes, on attaque deux fois en combat.
Revenir en haut Aller en bas
Contenu sponsorisé





S'équiper de deux armes et/ou d'une arme à deux mains Empty
MessageSujet: Re: S'équiper de deux armes et/ou d'une arme à deux mains   S'équiper de deux armes et/ou d'une arme à deux mains Icon_minitime

Revenir en haut Aller en bas
 
S'équiper de deux armes et/ou d'une arme à deux mains
Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
LODM (L'Oasis des Makers) :: Groupe pour Scripts :: Scripts Divers-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser