MOG Scene Equip Asuka V1.5

3 de julho de 2014

MOG Scene Equip Asuka é um script de Scene Equip com layout em pictures e movimento, desenvolvido pelo Moghunter, para ser usado em algum jogo ou projeto do RPG Maker XP.

Screenshot

MOG Scene Equip Asuka

Utilização

Para dar nome as imagens dos personagens, renomeie os arquivos das figuras da seguinte forma: Aluxes_FC2.png .

Ou seja, coloque o nome do personagem mais o sufixo _FC2. Caso você não tiver essa imagem o script automaticamente vai colocar a imagem do battler padrão.

Baixe a demo que já possui todas as imagens exemplos e o script, fica mais fácil para entender como funciona e tal.

Código

O código abaixo vai acima do Main, no editor de scripts do seu projeto:

#_______________________________________________________________________________
# MOG_Scene_Equip V1.7           
#_______________________________________________________________________________
# By Moghunter     
# http://www.atelier-rgss.com
#_______________________________________________________________________________
module MOG
  #Transition Time.  
  MSEQPT= 10
  #Transition Type.
  MSEQPTT= "004-Blind04"
  # Set Maximum (STR,DEX,AGL,INT)
  MST_ST = 999
  # Set Maximum (ATK,PDEF,MDEF)
  MST_STE = 999
end

#===============================================================================
# Window_Base
#===============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# nada2
#--------------------------------------------------------------------------  
  def nada2(actor)
    face = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  end   
#--------------------------------------------------------------------------
# draw_heroface2
#--------------------------------------------------------------------------  
  def draw_heroface2(actor,x,y)
    face = RPG::Cache.picture(actor.name + "_fc2") rescue nada2(actor)
    cw = face.width 
    ch = face.height 
    src_rect = Rect.new(0, 0, cw, ch)
    if face == RPG::Cache.battler(actor.battler_name, actor.battler_hue)
      self.contents.blt(x + 40 , y - ch - 240, face, src_rect)    
    else  
      self.contents.blt(x , y - ch, face, src_rect)    
    end
  end     
#--------------------------------------------------------------------------
# drw_eqpup
#--------------------------------------------------------------------------
  def drw_eqpup(x,y,type)
    case type
      when 0
      est = RPG::Cache.icon("ST_EQU")
      when 1
      est = RPG::Cache.icon("ST_UP")
      when 2
      est = RPG::Cache.icon("ST_DOWN")  
    end  
    cw = est.width 
    ch = est.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch, est, src_rect)    
  end   
#--------------------------------------------------------------------------
# drw_equist
#--------------------------------------------------------------------------
  def drw_equist(x,y)
    equist = RPG::Cache.picture("Equip_St")
    cw = equist.width 
    ch = equist.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch, equist, src_rect)    
  end  
#--------------------------------------------------------------------------
# draw_actor_parameter2
#--------------------------------------------------------------------------
  def draw_actor_parameter2(actor, x, y, type)
    back = RPG::Cache.picture("STBAR_Back")    
    cw = back.width  
    ch = back.height 
    src_rect = Rect.new(0, 0, cw, ch)    
    self.contents.blt(x + 50 , y - ch + 20, back, src_rect)  
    meter = RPG::Cache.picture("STBAR.png")    
    case type
      when 0
      parameter_value = actor.atk
      cw = meter.width  * actor.atk / MOG::MST_STE
      when 1
      parameter_value = actor.pdef
      cw = meter.width  * actor.pdef / MOG::MST_STE
      when 2
      parameter_value = actor.mdef
      cw = meter.width  * actor.mdef / MOG::MST_STE
      when 3
      parameter_value = actor.str
      cw = meter.width  * actor.str / MOG::MST_ST
      when 4
      parameter_value = actor.dex
      cw = meter.width  * actor.dex / MOG::MST_ST
      when 5
      parameter_value = actor.agi
      cw = meter.width  * actor.agi / MOG::MST_ST
      when 6
      parameter_value = actor.int
      cw = meter.width  * actor.int / MOG::MST_ST
    end
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 120, y - 2, 36, 32, parameter_value.to_s, 2)
    ch = meter.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x + 50 , y - ch + 20, meter, src_rect) 
  end
#--------------------------------------------------------------------------
# draw_actor_parameter2
#--------------------------------------------------------------------------
  def nada
    face = RPG::Cache.picture("")
  end  
#--------------------------------------------------------------------------
# draw_heroface3
#--------------------------------------------------------------------------
  def draw_heroface3(actor,x,y)
    face = RPG::Cache.picture(actor.name + "_fc3") rescue nada
    cw = face.width 
    ch = face.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch, face, src_rect)    
  end  
end

#===============================================================================
# Window_EquipLeft
#===============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------  
  def initialize(actor)
    super(0, 64, 272, 446)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.name = "Georgia"    
    @actor = actor
    refresh
  end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------  
  def refresh
    self.contents.clear
    draw_heroface2(@actor, 20, 460)      
    drw_equist(0,390)    
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 4, 32)
    draw_actor_parameter2(@actor, 10, 164 , 0)
    draw_actor_parameter2(@actor, 10, 196 , 1)
    draw_actor_parameter2(@actor, 10, 228 , 2)
    draw_actor_parameter2(@actor, 10, 260 , 3)
    draw_actor_parameter2(@actor, 10, 292 , 4)
    draw_actor_parameter2(@actor, 10, 324 , 5)
    draw_actor_parameter2(@actor, 10, 356 , 6)        
    if @new_atk != nil
      self.contents.font.color = system_color
      if @new_atk < @actor.atk
      drw_eqpup(170,190,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_atk > @actor.atk
      drw_eqpup(170,190,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,190,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end      
      self.contents.draw_text(190, 162, 36, 32, @new_atk.to_s, 2)
    end
    if @new_pdef != nil
      if @new_pdef < @actor.pdef
      drw_eqpup(170,226,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_pdef > @actor.pdef
      drw_eqpup(170,226,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,226,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end  
      self.contents.draw_text(190, 194, 36, 32, @new_pdef.to_s, 2)
    end
    if @new_mdef != nil
      if @new_mdef < @actor.mdef
      drw_eqpup(170,258,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_mdef > @actor.mdef
      drw_eqpup(170,258,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,258,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end
      self.contents.draw_text(190, 226, 36, 32, @new_mdef.to_s, 2)
    end
    if @new_str  != nil
      if @new_str < @actor.str
      drw_eqpup(170,290,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_str > @actor.str
      drw_eqpup(170,290,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,290,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end
      self.contents.draw_text(190, 258, 36, 32, @new_str.to_s, 2)
    end
    if @new_dex  != nil
      if @new_dex < @actor.dex
      drw_eqpup(170,322,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_dex > @actor.dex
      drw_eqpup(170,322,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,322,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end
      self.contents.draw_text(190, 290, 36, 32, @new_dex.to_s, 2)
    end
    if @new_agi  != nil
      if @new_agi < @actor.agi
      drw_eqpup(170,354,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_agi > @actor.agi
      drw_eqpup(170,354,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,354,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end
      self.contents.draw_text(190, 322, 36, 32, @new_agi.to_s, 2)
    end
    if @new_int  != nil
      if @new_int < @actor.int
      drw_eqpup(170,386,2)  
      self.contents.font.color = Color.new(255,50,50,255)      
      elsif @new_int > @actor.int
      drw_eqpup(170,386,1)  
      self.contents.font.color = Color.new(50,250,150,255)
      else
      drw_eqpup(170,386,0)        
      self.contents.font.color = Color.new(255,255,255,255)      
      end
      self.contents.draw_text(190, 354, 36, 32, @new_int.to_s, 2)
    end
  end
  
#--------------------------------------------------------------------------
# Set_new_parameters
#--------------------------------------------------------------------------  
  def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
    new_agi, new_int)
    if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
      @new_str != new_str or @new_dex != new_dex or @new_agl != new_agi or
      @new_int != new_int      
      @new_atk = new_atk
      @new_pdef = new_pdef
      @new_mdef = new_mdef
      @new_str = new_str
      @new_dex = new_dex
      @new_agi = new_agi
      @new_int = new_int
      refresh
    end
  end
end

#===============================================================================
# Window_EquipRight
#===============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------    
  def initialize(actor)
    super(272, 64, 368, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.name = "Georgia"        
    @actor = actor
    refresh
    self.index = 0
  end
#--------------------------------------------------------------------------
# Item
#--------------------------------------------------------------------------    
  def item
    return @data[self.index]
  end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------    
  def refresh
    self.contents.clear
    @data = []
    @data.push($data_weapons[@actor.weapon_id])
    @data.push($data_armors[@actor.armor1_id])
    @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
    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
#--------------------------------------------------------------------------
# Update_Help
#--------------------------------------------------------------------------    
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#===============================================================================
# Window_EquipItem
#===============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------      
  def initialize(actor, equip_type)
    super(272, 256, 368, 224)
    self.opacity = 0
    @actor = actor
    @equip_type = equip_type
    @column_max = 1
    refresh
    self.active = false
    self.index = -1
  end
#--------------------------------------------------------------------------
# Item
#--------------------------------------------------------------------------      
  def item
    return @data[self.index]
  end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------      
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    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
    end
    if @equip_type != 0
      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
    @data.push(nil)
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    for i in 0...@item_max-1
      draw_item(i)
    end
  end
#--------------------------------------------------------------------------
# Draw_Item
#--------------------------------------------------------------------------      
  def draw_item(index)
    self.contents.font.name = "Georgia"        
    item = @data[index]
    x = 4 + index % 1 * (288 + 32)
    y = index / 1 * 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))
    self.contents.font.color = normal_color
    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
#--------------------------------------------------------------------------
# Update Help
#--------------------------------------------------------------------------      
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#===============================================================================
# Scene_Equip
#===============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------        
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
    @equip_index = equip_index
  end
#--------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------        
  def main
    @mnback = Plane.new
    @mnback.bitmap = RPG::Cache.picture("MN_BK")
    @mnback.z = 1
    @mnlay = Sprite.new
    @mnlay.bitmap = RPG::Cache.picture("Equip_Lay")
    @mnlay.z = 2
    @actor = $game_party.actors[@actor_index]
    @help_window = Window_Help.new
    @help_window.opacity = 0
    @help_window.x = -300
    @help_window.contents_opacity = 0
    @left_window = Window_EquipLeft.new(@actor)
    @left_window.x = -300
    @left_window.contents_opacity = 0
    @right_window = Window_EquipRight.new(@actor)
    @item_window1 = Window_EquipItem.new(@actor, 0)
    @item_window2 = Window_EquipItem.new(@actor, 1)
    @item_window3 = Window_EquipItem.new(@actor, 2)
    @item_window4 = Window_EquipItem.new(@actor, 3)
    @item_window5 = Window_EquipItem.new(@actor, 4)
    @item_window1.x = 640
    @item_window2.x = 640
    @item_window3.x = 640
    @item_window4.x = 640
    @item_window5.x = 640    
    @right_window.help_window = @help_window
    @item_window1.help_window = @help_window
    @item_window2.help_window = @help_window
    @item_window3.help_window = @help_window
    @item_window4.help_window = @help_window
    @item_window5.help_window = @help_window
    @right_window.index = @equip_index
    @right_window.x = 640
    refresh
    Graphics.transition(MOG::MSEQPT, "Graphics/Transitions/" + MOG::MSEQPTT)
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    for i in 0..10
      @left_window.x -= 25
      @left_window.contents_opacity -= 15
      @item_window.x += 30
      @item_window.contents_opacity -= 20
      @right_window.x += 30
      @right_window.contents_opacity -= 20
      Graphics.update  
    end  
    Graphics.freeze
    @help_window.dispose
    @left_window.dispose
    @right_window.dispose
    @item_window1.dispose
    @item_window2.dispose
    @item_window3.dispose
    @item_window4.dispose
    @item_window5.dispose
    @mnback.dispose
    @mnlay.dispose
  end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------        
  def refresh
    @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)
    item1 = @right_window.item
    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.active
      @left_window.set_new_parameters(nil, nil, nil,nil, nil, nil,nil)
    end
    if @item_window.active
      item2 = @item_window.item
      last_hp = @actor.hp
      last_sp = @actor.sp
      @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
      new_atk = @actor.atk
      new_pdef = @actor.pdef
      new_mdef = @actor.mdef
      new_str = @actor.str
      new_dex = @actor.dex
      new_agi = @actor.agi
      new_int = @actor.int     
      @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
      @actor.hp = last_hp
      @actor.sp = last_sp
      @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
      new_dex,new_agi,new_int)      
    end
  end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------        
  def update
    if @right_window.x > 272
       @right_window.x -= 30
    elsif @right_window.x <= 272
       @right_window.x = 272
    end  
    if @item_window.x > 272
       @item_window.x -= 30 
    elsif @item_window.x <= 272
        @item_window.x = 272
    end
    if @item_window.active == false  
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
    @item_window.x = 640  
    end  
    end
    if @left_window.x < 0
    @left_window.x += 25
    @left_window.contents_opacity += 15
    elsif @left_window.x >= 0
    @left_window.x = 0
    @left_window.contents_opacity = 255
    end
    if @help_window.x < 0 
    @help_window.x  += 25
    @help_window.contents_opacity += 15
    elsif @help_window.x >= 0
    @help_window.x = 0
    @help_window.contents_opacity = 255
  end    
    @mnback.ox += 1    
    @left_window.update
    @right_window.update
    @item_window.update
    if Input.trigger?(Input::B) or Input.trigger?(Input::C) or
    Input.trigger?(Input.dir4) or Input.trigger?(Input::L) or
    Input.trigger?(Input::R) or Input.press?(Input.dir4)
    @help_window.x = -300
    @help_window.contents_opacity = 0
    refresh
    end    
    if @right_window.active
      update_right
      return
    end
    if @item_window.active
      update_item
      return
    end
  end
#--------------------------------------------------------------------------
# Update Right
#--------------------------------------------------------------------------        
  def update_right
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(2)
      return
    end
    if Input.trigger?(Input::C)
      if @actor.equip_fix?(@right_window.index)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @right_window.active = false
      @item_window.active = true
      @item_window.index = 0
      refresh      
      return
    end
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Equip.new(@actor_index, @right_window.index)
      return
    end
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Equip.new(@actor_index, @right_window.index)
      return
    end
  end
#--------------------------------------------------------------------------
# Update Item
#--------------------------------------------------------------------------        
  def update_item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      refresh
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.equip_se)
      item = @item_window.item
      @actor.equip(@right_window.index, item == nil ? 0 : item.id)
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      @right_window.refresh
      @item_window.refresh
      refresh      
      return
    end
  end
end


$mog_rgss_Scene_Equip = true

Download e ficha técnica

  • Download (clique com o botão esquerdo do mouse ou toque no link).
  • Desenvolvedor, publisher e/ou distribuidor: Moghunter
  • SO: Windows 98/98SE/Me/2000/XP/Vista/7
  • Tamanho: 591KB
  • Licença: Grátis
  • Categoria: Programação XP
  • Tag: RPG Maker XP
  • Adicionado por: LichKing
  • Acessos: 33

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!