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



Le Deal du moment :
Pokémon EV06 : où acheter le Bundle Lot ...
Voir le deal

Partagez
 

 [VX] Modification de la fenêtre des sorts

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Invité
Invité
Anonymous


[VX] Modification de la fenêtre des sorts Empty
MessageSujet: [VX] Modification de la fenêtre des sorts   [VX] Modification de la fenêtre des sorts EmptyMer 21 Sep 2011 - 19:52

Instruction
Compatible avec le SBS + ATB uniquement
Placer se script en dessous des scripts du SBS

Auteur
Zanghter

[VX] Modification de la fenêtre des sorts Captur11
[VX] Modification de la fenêtre des sorts Captur12
Code:
#==============================================================================
# ** HUD compétences Modifié
#------------------------------------------------------------------------------
#  Par Zangther pour CloudStrife.
#==============================================================================
# Script Plug'n Play. Certains éléments sont modifiables.
module Zang_HUDCombat
 
  # Texte + N° de l'icon qui sera affiché au dessus du coût
  Z_TextCost = "Coût en MP"
  Z_IconCost = 11665
  # Affichage de base de la fenètre de sorts ( true : oui, false : non )
  Z_AfficherDesc = true
  # Texte pour activer / désactiver les infos
  Z_IndicationDesc = "SHIFT : Info"
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  Modification de Scene_Battle pour afficher les sorts différemment.
#==============================================================================
class Scene_Battle < Scene_Base
  include Zang_HUDCombat
  #--------------------------------------------------------------------------
  # * Start Skill Selection
  #--------------------------------------------------------------------------
  def start_skill_selection
    win_wid = @status_window.width
    win_hei = @status_window.height
    @help_window = Window_Help.new
    @skill_window = Window_Skill_Combat.new(0, 416 - @status_window.height, win_wid, win_hei, @commander)
    @skill_window.z = 1000000
    @help_window.y = 416 - (@help_window.height + @skill_window.height)
    @skill_window.help_window = @help_window
    @mp_cost_window = Window_Help_MPCost.new
    @actor_command_window.active = false
    @status_window.visible = false
    @actor_command_window.visible = false
    @help_window.visible = Z_AfficherDesc
  end
  #--------------------------------------------------------------------------
  # * End Skill Selection
  #--------------------------------------------------------------------------
  alias old_end_skill end_skill_selection
  def end_skill_selection
    if @skill_window != nil
      @mp_cost_window.dispose
    end
    old_end_skill
    @status_window.visible = true
    @actor_command_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * Update Skill Selection
  #--------------------------------------------------------------------------
  alias old_update_skill update_skill_selection
  def update_skill_selection
    @mp_cost_window.update
    @mp_cost_window.set_text(create_text, 1) if create_text
    old_update_skill
    if Input.trigger?(Input::SHIFT)
      if @help_window.visible
        @help_window.visible = false
      else
        @help_window.visible = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Skill Selection
  #--------------------------------------------------------------------------
  def create_text
    sorts = []
    for skill in @commander.skills
      sorts.push(skill)
    end
    sort_selec = sorts[@skill_window.index - 1]
    if sort_selec
      return sort_selec.mp_cost.to_s + "/" + @commander.base_maxmp.to_s
    else
      return nil
    end
  end
end
#==============================================================================
# ** Window_Skill_Combat
#------------------------------------------------------------------------------
#  Cette Window affichera les compétances disponibles.
#==============================================================================
class Window_Skill_Combat < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    x      : window x-coordinate
  #    y      : window y-coordinate
  #    width  : window width
  #    height : window height
  #    actor  : actor
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    @column_max = 2
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for skill in @actor.skills
      @data.push(skill)
      if skill.id == @actor.last_skill_id
        self.index = @data.size - 1
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end
#==============================================================================
# ** Window_Help_MPCost
#------------------------------------------------------------------------------
#  Fenêtre qui affiche le coût et l'indication pour la description.
#==============================================================================

class Window_Help_MPCost < Window_Base
  include Zang_HUDCombat
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 128, 128)
    self.x = 544 - self.width
    self.y = 416 - self.height
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : character string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(costmp, align = 0)
    if costmp != @costmp or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      if costmp
        self.contents.draw_text(4, 0, self.width - 40, WLH, Z_TextCost, 0)
        draw_icon(Z_IconCost, (self.width-32) / 2 - 12,24)
        self.contents.draw_text(4, 48, self.width - 40, WLH, costmp, align)
        self.contents.draw_text(4, 72, self.width - 40, WLH, Z_IndicationDesc, align)
      else
      end
      @costmp = costmp
      @align = align
    end
  end
 
end
Revenir en haut Aller en bas
 
[VX] Modification de la fenêtre des sorts
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» [XP]Fenêtre qui change en fonction du curseur
» Problème avec la fenêtre en combat
» [XP]Modification du menu
» [Résolu]Augmenter la limite d'espace d'une fenêtre.
» fenetre custom [toutes version](difficulté : *)

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 VX :: Combat-
Sauter vers: