O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

Scene_Equip

Iniciado por LoboShow, 26/01/2013 às 14:02

Scene_Equip

Compativel com: RMVX
Compatibilidade: ?
Facilidade de uso: ?
Lag gerado: ?

[box class=titlebg]
Para que serve o script
[/box]
.Nova aparência no menu de equipamentos;
.Adicionada a face do personagem;
.Opção para optimizar (equipar as melhores armas).

[box class=titlebg]
Instruções
[/box]
Copie e cole o script acima do main. Coloque a imagem "logo" na pasta Graphics/Pictures do projeto.

[box class=titlebg]
Imagens
[/box]

[box class=titlebg]
Imagem necessária
[/box]

[box class=titlebg]
Script
[/box]
=begin
[   ===================================================================   ]
[   ===================================================================   ]
[   =============   ]        SCRIPT CRIADO POR:       [   =============   ]
[   =============   ]                                 [   =============   ]
[   =============   ]        >>> Dark Chocobo         [   =============   ]
[   =============   ]                                 [   =============   ]
[   =============   ]                                 [   =============   ]
[   =============   ]         > Scene_Equip <         [   =============   ]
[   =============   ]                                 [   =============   ]
[   ===================================================================   ]
[   ===============   ] : Comunidade RPG Maker VX : [   ===============   ]
[   =====   ] http://www.orkut.com/Community.aspx?cmm=40232098 [   ====   ]
[   ===================================================================   ]
[   ===================================================================   ]

Resumo:
 - Modifica a classe scene_equip(entre outras) criando alguns efeitos e
    funçíµes bem intereçantes.
Funçíµes:
 - Frase indicativa para espaços sem equipamentos.
 - Opção extra: 'Optimizar' (auto-equip)
 - Mostra as propriedades das armas(duas mãos, iniciativa, ataque duplo
    e frequíªncia de crí­tico)
 - Mostra uma imagem personalisável no menu.
 - Opção de embação ou distorcer esta imagem.
Instruçíµes:
 - Mude a 'Frase indicativa para espaços sem equipamentos' na linha 50.
 - Mude o nome das propriedades das armas nas linhas de 55 a 58.
 - Mude a cor de texto que aparece para as propriedades das armas na
    linha 54.
 - Mude o diretório da imagem na linha 59.
Observaçíµes:
 - O comando 'Optimizar' equipa automaticamente os equipamentos mais
    poderosos no personagem, porém ele não considera equipamentos de
    duas mãos(exceto se o herói nao usa escudo), nem equipamentos de
    efeitos, como acessórios. Por tanto, nada substitue a boa
    estratégia do jogador.
 - Vocíª pode deichar a imagem sem diretório("") para que não seja exibida
    qualquer imagem.
 - Vocíª deve usar duas barras (\\) quando for digitar o diretório da
    imagem, a partir da pasta do jogo, e não é necessário a expecificação
    da extenção do arquivo. Exemplo: "Graphics\\Pictures\\Logo"
 - A imagem ideal deve ter dimençíµes de 304 x 176.
=end

  # Cria as configuraçíµes iniciais do script.  
  $DarkChocoboScripts = {} if $DarkChocoboScripts.nil?
  $DarkChocoboScripts["Scene_Equip"] = {}
  $DarkChocoboScripts["Scene_Equip"]["Nada Equipado"] = "Nada Equipado."
  $DarkChocoboScripts["Scene_Equip"]["Equip"] = "Equipar"
  $DarkChocoboScripts["Scene_Equip"]["Auto"]  = "Optimizar"
  $DarkChocoboScripts["Scene_Equip"]["Quit"]  = "Sair"
  $DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"] = 16
  $DarkChocoboScripts["Scene_Equip"]["two_handed"] = "Duas Mãos"
  $DarkChocoboScripts["Scene_Equip"]["fast_attack"] = "Iniciativa"
  $DarkChocoboScripts["Scene_Equip"]["dual_attack"] = "Ataque Duplo"
  $DarkChocoboScripts["Scene_Equip"]["critical_bonus"] = "Freqiíªncia Crí­tica"
  $DarkChocoboScripts["Scene_Equip"]["Imagem"] = "Graphics\\Pictures\\Logo"
  $DarkChocoboScripts["Scene_Equip"]["Embaçar Imagem"] = false
  $DarkChocoboScripts["Scene_Equip"]["Distorcer Imagem"] = false
  $DarkChocoboScripts["Scene_Equip"]["Força de Distorção"] = 0 # 0~100
  
class DC_Window_EquipItem < Window_EquipItem
  $DarkChocoboScripts["Scene_Equip"]["WLH"] = WLH
  def initialize(x, y, width, height, actor, equip_type)
    super(x, y, width, height, actor, equip_type)
    @column_max = 1
    self.width = 544-208
    self.x = 208
    self.refresh
  end
end
class Window_Equip < Window_Selectable
  attr_accessor :refresher
  alias dc_scene_equip_update update
  def update
    dc_scene_equip_update
    @speed = 1 if @speed == nil
    return if @refresher == "max"
    if @refresher == "down"
      self.width -= @speed
      self.x += @speed
      @speed += 1
      if self.width < 24
        @refresher = "min"
        self.width = 24
        @speed = nil
      end
    elsif @refresher == "up"
      self.width += @speed
      self.x -= @speed
      @speed += 1
      if self.width > 544-208
        @refresher = "max"
        self.width = 544-208
        @speed = nil
      end
    end
    if @refresher == "min"
      case @nextrefresh
      when "refresh1"
        refresh1
        @refresher2 = nil
      when "refresh2"
        refresh2
        @refresher2 = nil
      end
    end
  end
  alias dc_scene_equip_refresh refresh
  def refresh
    dc_scene_equip_refresh
    text = $DarkChocoboScripts["Scene_Equip"]["Nada Equipado"]
    self.contents.font.color = text_color(7)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = 128
    self.contents.draw_text(116, WLH * 0, 256, WLH, text) if @data[0] == nil
    self.contents.draw_text(116, WLH * 1, 256, WLH, text) if @data[1] == nil
    self.contents.draw_text(116, WLH * 2, 256, WLH, text) if @data[2] == nil
    self.contents.draw_text(116, WLH * 3, 256, WLH, text) if @data[3] == nil
    self.contents.draw_text(116, WLH * 4, 256, WLH, text) if @data[4] == nil
  end
  def refresh1
    if @refresher != "min"
      @refresher = "down"
      @nextrefresh = "refresh1"
      return
    end
    refresh
    @refresher = "up"
  end
  def refresh2
    if @refresher != "min"
      @refresher = "down"
      @nextrefresh = "refresh2"
      return
    end
    self.contents.clear
    size = 0
    for i in 0 ... @data.size
      size += 1 if @data[i] != nil
    end
    distance = size == 1 ? 120/2-4 :
               size == 2 ? 120/3-4 :
               size == 3 ? 120/4-4 :
               size == 4 ? 120/5-4 :
               size == 5 ? 120/6-4 :
               0
    size = 1
    @data[0] != nil ? draw_item_name(@data[0], 114, distance * size)  : size -= 1
    size += 1
    @data[1] != nil ? draw_item_name(@data[1], 114, distance * size)  : size -= 1
    size += 1
    @data[2] != nil ? draw_item_name(@data[2], 114, distance * size)  : size -= 1
    size += 1
    @data[3] != nil ? draw_item_name(@data[3], 114, distance * size)  : size -= 1
    size += 1
    @data[4] != nil ? draw_item_name(@data[4], 114, distance * size)  : size -= 1
    draw_actor_face(@actor, 4,14)
    @refresher = "up"
  end
end
class Window_EquipStatus < Window_Base
  def nil_color
    self.contents.font.color.alpha = 0
    return text_color(0)
  end
  def draw_parameter(x, y, type)
    case type
    when 0
      name = Vocab::atk
      value = @actor.atk
      new_value = @new_atk
    when 1
      name = Vocab::def
      value = @actor.def
      new_value = @new_def
    when 2
      name = Vocab::spi
      value = @actor.spi
      new_value = @new_spi
    when 3
      name = Vocab::agi
      value = @actor.agi
      new_value = @new_agi
    end
    self.contents.font.color = system_color
    self.contents.draw_text(x + 4, y, 80, WLH, name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 90, y, 30, WLH, value, 2)
    if new_value != nil
      self.contents.font.color = system_color
      self.contents.draw_text(x + 122, y, 20, WLH, " >", 1)
      self.contents.font.color = new_parameter_color(value, new_value)
      self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2)
      self.contents.font.color = normal_color
    end
  end
  def initialize(x, y, actor)
    super(x, y, 208, 416-56)
    @actor = actor
    refresh
  end
  def refresh(nao_mostrar_propriedades = false)
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 104, 0)
    draw_actor_level(@actor, 0, WLH * 1)
    draw_actor_state(@actor, 104, WLH * 1)
    draw_actor_hp(@actor, 0, WLH * 2)
    draw_actor_mp(@actor, 0, WLH * 3)
    draw_parameter(0, WLH * 5, 0)
    draw_parameter(0, WLH * 6, 1)
    draw_parameter(0, WLH * 7, 2)
    draw_parameter(0, WLH * 8, 3)
    return if $game_actors[@actor.id].weapons[0] == nil or nao_mostrar_propriedades == true
    self.contents.font.color = text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    x_plus = 1
    self.contents.draw_text(4, WLH * 9 + x_plus * WLH - 6, 176, WLH, $DarkChocoboScripts["Scene_Equip"]["two_handed"]) if $game_actors[@actor.id].weapons[0].two_handed
    x_plus += 1 if $game_actors[@actor.id].weapons[0].two_handed
    self.contents.draw_text(4, WLH * 9 + x_plus * WLH - 6, 176, WLH, $DarkChocoboScripts["Scene_Equip"]["fast_attack"]) if $game_actors[@actor.id].weapons[0].fast_attack
    x_plus += 1 if $game_actors[@actor.id].weapons[0].fast_attack
    self.contents.draw_text(4, WLH * 9 + x_plus * WLH - 6, 176, WLH, $DarkChocoboScripts["Scene_Equip"]["dual_attack"]) if $game_actors[@actor.id].weapons[0].dual_attack
    x_plus += 1 if $game_actors[@actor.id].weapons[0].dual_attack
    self.contents.draw_text(4, WLH * 9 + x_plus * WLH - 6, 176, WLH, $DarkChocoboScripts["Scene_Equip"]["critical_bonus"]) if $game_actors[@actor.id].weapons[0].critical_bonus
  end
end
class Scene_Equip < Scene_Base
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @delay == 0 ? $scene = Scene_Menu.new(2) : return
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0
        if @equip_window.width != 544-208
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        @command_window.active = false
        @command_window.visible = false
        @equip_window.active = true
        @help_window.visible = true
        @equip_window.index = 0
        @equip_window.refresh1
      when 1
        Sound.play_decision
        dc_optimize_equips
        @equip_window.refresh2
      when 2
        Sound.play_decision
        @delay == 0 ? $scene = Scene_Menu.new(2) : return
      end
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    end
  end
  def return_scene
    return
  end
  alias dc_scene_equip_update_equip_selection update_equip_selection
  def update_equip_selection
    dc_scene_equip_update_equip_selection
    if Input.trigger?(Input::B)
        if @equip_window.width != 544-208
          Sound.play_buzzer
          return
        end
      @delay = 1
      @command_window.active = true
      @command_window.visible = true
      @equip_window.active = false
      @help_window.visible = false
      @equip_window.index = -1
      @equip_window.refresh2
    end
  end
  alias dc_scene_equip_start start
  def start
    dc_scene_equip_start
    dc_create_base_window
    @delay = 0
    @command_window = Window_Command.new(544, [
    $DarkChocoboScripts["Scene_Equip"]["Equip"],
    $DarkChocoboScripts["Scene_Equip"]["Auto"],
    $DarkChocoboScripts["Scene_Equip"]["Quit"]],3)
    @command_window.active = true
    @help_window.visible = false
    @equip_window.active = false
    @equip_window.index = -1
    @equip_window.refresh2
  end
  def dc_create_base_window
    @base_window = Window_Base.new(208,208,336,208)
    @base_window.contents.dispose
    if $DarkChocoboScripts["Scene_Equip"]["Imagem"] == ""
      @base_window.contents = Bitmap.new(304,176)
    else
      @base_window.contents = Bitmap.new($DarkChocoboScripts["Scene_Equip"]["Imagem"])
      @base_window.contents.blur if $DarkChocoboScripts["Scene_Equip"]["Embaçar Imagem"]
      @base_window.contents.radial_blur($DarkChocoboScripts["Scene_Equip"]["Força de Distorção"]*3,$DarkChocoboScripts["Scene_Equip"]["Força de Distorção"]) if $DarkChocoboScripts["Scene_Equip"]["Distorcer Imagem"]
    end
  end
  def create_item_windows
    @item_windows = []
    for i in 0...EQUIP_TYPE_MAX
      @item_windows[i] = DC_Window_EquipItem.new(0, 208, 544, 208, @actor, i)
      @item_windows[i].help_window = @help_window
      @item_windows[i].visible = (@equip_index == i)
      @item_windows[i].y = 208
      @item_windows[i].height = 208
      @item_windows[i].active = false
      @item_windows[i].index = -1
    end
  end
  alias dc_scene_equip_update update
  def update
    unless @item_window.nil?
    if @item_window.visible
      @base_window.visible = false
    else
      @base_window.visible = true
    end
    end
    @delay -= 1 if @delay > 0
    @command_window.update
    @base_window.update
    dc_scene_equip_update
    dc_update_new_atrubutes
    update_command_selection if @command_window.active
  end
  alias dc_scene_equip_terminate terminate
  def terminate
    @base_window.dispose
    @command_window.dispose
    dc_scene_equip_terminate
  end
  def update_status_window
    if @equip_window.active
      @status_window.set_new_parameters(nil, nil, nil, nil)
    end
    if @item_window != nil
      return unless @item_window.active
      temp_actor = @actor.clone
      temp_actor.change_equip(@equip_window.index, @item_window.item, true)
      new_atk = temp_actor.atk
      new_def = temp_actor.def
      new_spi = temp_actor.spi
      new_agi = temp_actor.agi
      @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
    end
    @status_window.update
  end
  def dc_optimize_equips
    #weapon
    result = []
    for item in $game_party.items
      result.push(item) if item.is_a?(RPG::Weapon)
    end
    best_weapon = $data_weapons[@actor.weapon_id]
    for weapon in result
      if best_weapon == nil
        best_weapon = weapon
        next
      end
      best_weapon = weapon if weapon.atk > best_weapon.atk
    end
    #shield
    result.clear
    for item in $game_party.items
      if item.is_a?(RPG::Armor) and item.kind == 0
        result.push(item)
      end
    end
    best_shield = $data_armors[@actor.armor1_id]
    for shield in result
      if best_shield == nil
        best_shield = shield
        next
      end
      best_shield = shield if shield.def > best_shield.def
    end
    #helmet
    result.clear
    for item in $game_party.items
      if item.is_a?(RPG::Armor) and item.kind == 1
        result.push(item)
      end
    end
    best_helmet = $data_armors[@actor.armor2_id]
    for helmet in result
      if best_helmet == nil
        best_helmet = helmet
        next
      end
      best_helmet = helmet if helmet.def > best_helmet.def
    end
    #armor
    result.clear
    for item in $game_party.items
      if item.is_a?(RPG::Armor) and item.kind == 2
        result.push(item)
      end
    end
    best_armor = $data_armors[@actor.armor3_id]
    for armor in result
      if best_armor == nil
        best_armor = armor
        next
      end
      best_armor = armor if armor.def > best_armor.def
    end
    #accessory
    result.clear
    for item in $game_party.items
      if item.is_a?(RPG::Armor) and item.kind == 3
        result.push(item)
      end
    end
    best_accessory = $data_armors[@actor.armor3_id]
    for accessory in result
      if best_accessory == nil
        best_accessory = accessory
        next
      end
      best_accessory = accessory if accessory.def > best_accessory.def
    end
    #and finaly...
    $game_actors[@actor.id].change_equip(1, best_shield) if best_shield != nil
    $game_actors[@actor.id].change_equip(0, best_weapon) if best_weapon != nil
    $game_actors[@actor.id].change_equip(2, best_helmet) if best_helmet != nil
    $game_actors[@actor.id].change_equip(3, best_armor) if best_armor != nil
    $game_actors[@actor.id].change_equip(4, best_accessory) if best_accessory != nil
    #@equip_window.refresh2
    @equip_window.refresh
    for item_window in @item_windows
      item_window.refresh
    end
  end
  def dc_update_new_atrubutes
    if @item_window.active and @equip_window.index == 0 and @item_window.item != nil
      @status_window.refresh(true)
      x_plus = 1
    @status_window.contents.font.color.alpha = 255
    @status_window.contents.font.color =
    if @item_window.item.nil? and $game_actors[@actor.id].weapons[0].nil?
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif @item_window.item.nil?
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].nil?
      @status_window.power_up_color
    elsif $game_actors[@actor.id].weapons[0].two_handed and @item_window.item.two_handed
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif $game_actors[@actor.id].weapons[0].two_handed and @item_window.item.two_handed == false
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].two_handed == false and @item_window.item.two_handed
      @status_window.power_up_color
    else
      @status_window.nil_color
    end
      @status_window.contents.draw_text(4, $DarkChocoboScripts["Scene_Equip"]["WLH"] * 9 + x_plus * $DarkChocoboScripts["Scene_Equip"]["WLH"] - 6, 176, $DarkChocoboScripts["Scene_Equip"]["WLH"], $DarkChocoboScripts["Scene_Equip"]["two_handed"]) if @item_window.item.two_handed
      x_plus += 1 if @item_window.item.two_handed
    @status_window.contents.font.color.alpha = 255
    @status_window.contents.font.color =
    if @item_window.item.nil? and $game_actors[@actor.id].weapons[0].nil?
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif $game_actors[@actor.id].weapons[0].nil?
      @status_window.power_up_color
    elsif $game_actors[@actor.id].weapons[0].fast_attack and @item_window.item.fast_attack
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif $game_actors[@actor.id].weapons[0].fast_attack and @item_window.item.fast_attack == false
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].fast_attack == false and @item_window.item.fast_attack
      @status_window.power_up_color
    else
      @status_window.nil_color
    end
      @status_window.contents.draw_text(4, $DarkChocoboScripts["Scene_Equip"]["WLH"] * 9 + x_plus * $DarkChocoboScripts["Scene_Equip"]["WLH"] - 6, 176, $DarkChocoboScripts["Scene_Equip"]["WLH"], $DarkChocoboScripts["Scene_Equip"]["fast_attack"]) if @item_window.item.fast_attack
      x_plus += 1 if @item_window.item.fast_attack
    @status_window.contents.font.color.alpha = 255
    @status_window.contents.font.color =
    if @item_window.item.nil? and $game_actors[@actor.id].weapons[0].nil?
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif @item_window.item.nil?
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].nil?
      @status_window.power_up_color
    elsif $game_actors[@actor.id].weapons[0].dual_attack and @item_window.item.dual_attack
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif $game_actors[@actor.id].weapons[0].dual_attack and @item_window.item.dual_attack == false
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].dual_attack == false and @item_window.item.dual_attack
      @status_window.power_up_color
    else
      @status_window.nil_color
    end
      @status_window.contents.draw_text(4, $DarkChocoboScripts["Scene_Equip"]["WLH"] * 9 + x_plus * $DarkChocoboScripts["Scene_Equip"]["WLH"] - 6, 176, $DarkChocoboScripts["Scene_Equip"]["WLH"], $DarkChocoboScripts["Scene_Equip"]["dual_attack"]) if @item_window.item.dual_attack
      x_plus += 1 if @item_window.item.dual_attack
    @status_window.contents.font.color.alpha = 255
    @status_window.contents.font.color =
    if @item_window.item.nil? and $game_actors[@actor.id].weapons[0].nil?
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif @item_window.item.nil?
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].nil?
      @status_window.power_up_color
    elsif $game_actors[@actor.id].weapons[0].critical_bonus and @item_window.item.critical_bonus
      @status_window.text_color($DarkChocoboScripts["Scene_Equip"]["Cor das propriedades da arma"])
    elsif $game_actors[@actor.id].weapons[0].critical_bonus and @item_window.item.critical_bonus == false
      @status_window.power_down_color
    elsif $game_actors[@actor.id].weapons[0].critical_bonus == false and @item_window.item.critical_bonus
      @status_window.power_up_color
    else
      @status_window.nil_color
    end
      @status_window.contents.draw_text(4, $DarkChocoboScripts["Scene_Equip"]["WLH"] * 9 + x_plus * $DarkChocoboScripts["Scene_Equip"]["WLH"] - 6, 176, $DarkChocoboScripts["Scene_Equip"]["WLH"], $DarkChocoboScripts["Scene_Equip"]["critical_bonus"]) if @item_window.item.critical_bonus
    end
  end
end


[box class=titlebg]
Créditos e Avisos
[/box]
Criador: Dark Chocobo