RPG maker VX


Unirse al foro, es rápido y fácil

RPG maker VX
RPG maker VX
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.
Últimos temas
» Script de menu
por maxi Jue 04 Dic 2014, 1:44 pm

» Ayuda intro animado!!!
por maxi Miér 03 Dic 2014, 9:41 pm

» ayuda con este engin
por maxi Miér 03 Dic 2014, 8:42 am

» Hud de Vida 100% Personalizable - Engine Sencillo! Sin Scripts :)
por davidaikago Jue 20 Nov 2014, 10:58 am

» Ultimate parallax control by:GDS [ace]
por arellano Miér 08 Oct 2014, 8:28 pm

» Script Touhou (animated) Map name (v1.4)
por davidaikago Miér 08 Oct 2014, 2:09 pm

» tutorial puerta nueva
por davidaikago Miér 08 Oct 2014, 9:08 am

» cámara de fotos
por davidaikago Miér 08 Oct 2014, 9:05 am

» Imperial Action System II Demo
por davidaikago Miér 08 Oct 2014, 8:47 am

» VE Batalla animada [ACE]
por FhierusIV Jue 18 Sep 2014, 10:57 am

» Nuevo Reglamento del Foro [Vigente desde Septiembre 2014]
por maxi Miér 17 Sep 2014, 8:37 am

» MOG|Animated Title
por Souta21 Mar 09 Sep 2014, 7:24 pm

» Tutorial Engine - Cambiar Character al Equipar Objeto
por maxi Lun 21 Jul 2014, 10:19 am

» Script de climas
por gambasoxd Sáb 19 Jul 2014, 8:58 am

» Script de contraseña(codigo) para abrir un cofre
por rpgame Jue 03 Jul 2014, 6:03 pm

¿Quién está en línea?
En total hay 1 usuario en línea: 0 Registrados, 0 Ocultos y 1 Invitado

Ninguno

[ Ver toda la lista ]


El record de usuarios en línea fue de 117 durante el Mar 09 Ago 2011, 3:39 pm

[Aporte]Script Sistema Nuevo de tiendas[VX]

4 participantes

Ir abajo

[Aporte]Script Sistema Nuevo de tiendas[VX] Empty [Aporte]Script Sistema Nuevo de tiendas[VX]

Mensaje por luistop12 Dom 21 Oct 2012, 2:47 pm

les traigo el sistema de tiendas de mog hunter
ASI
[Tienes que estar registrado y conectado para ver esa imagen]

como notan les digo que las imagenes de la derecha son personalizables

es decir que si quieres que tu personaje tenga nombre debes ponerlo asi si tu personaje se llama Yivo la imagen se llamara Yivo_name

deben poner estas imagenes en graphic\Menu si no esta la crean


Spoiler:

y esta en graphic\system

Spoiler:




script
Código:
#==============================================================================
# MOG VX - Scene Shop V1.2
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Menu com layout em imagens.
# Para customizar basta mudar as imagens, criando seus próprios layouts.
#==============================================================================
# 1 - Crie uma pasta com o nome MENUS. (GRAPHICS/MENUS)
# 2 - Deverão conter as seguintes imagens nesta pasta.
#
# Background
# Item_Back
# Shop_Par_Text
# Shop_Possession
# Shop_Status_Back
# Shop01
# Shop02
# Shop03
# Shop04
#
# 3 - Será necessário ter a seguinte imagem na pasta System.
#
# Number_01
#
# 4 - Opcional, você poderá criar os nomes dos personagems em pictures, para
# isso crie uma imagem com o nome do personagem e nomeie da seguinte forma
#
# Nome_do_personagem + _name.png
#
# Exemplo - Ralph_name.png
# Grave a imagem na pasta GRAPHICS/MENUS
#
#==============================================================================
module MOG_SCENE_SHOP
  #Texto da janela de ajuda de compras.
  BUY_TEXT = "Comprar Itens."
  #Texto da janela de ajuda de vendas.
  SELL_TEXT = "Vender Itens"
  #Velocidade de movimento das janelas.
  SLIDE_SPEED = 20
  #Delizar a imagem de fundo.
  SLIDE_BACKGROUND = true
end
#==============================================================================
# ■ Cache
#==============================================================================
module Cache
  #--------------------------------------------------------------------------
  # Menu
  #-------------------------------------------------------------------------- 
  def self.menu(filename)
    load_bitmap("Graphics/Menus/", filename)
  end 
end 
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)   
  #--------------------------------------------------------------------------
  # X - Posição na horizontal
  # Y - Posição na vertical
  # VALUE - Valor Numérico
  # FILE_NAME - Nome do arquivo
  # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita 
  # SPACE - Espaço entre os números.
  # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  # FRAME_INDEX - Definição do quadro a ser utilizado.
  #-------------------------------------------------------------------------- 
  def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)   
    number_image = Cache.system(file_name)
    frame_max = 1 if frame_max < 1
    frame_index = frame_max if frame_index > frame_max
    align = 2 if align > 2
    cw = number_image.width / 10
    ch = number_image.height / frame_max
    h = ch * frame_index
    number = value.abs.to_s.split(//)
    case align
        when 0
          plus_x = (-cw + space) * number.size
        when 1
          plus_x = (-cw + space) * number.size
          plus_x /= 2
        when 2 
          plus_x = 0
    end
    for r in 0..number.size - 1     
        number_abs = number[r].to_i
        number_rect = Rect.new(cw * number_abs, h, cw, ch)
        self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)       
    end     
  end       
  #--------------------------------------------------------------------------
  # * draw_actor_face_shop
  #--------------------------------------------------------------------------         
  def draw_actor_face_shop(actor, x, y, size = 96)
    draw_face_shop(actor.face_name, actor.face_index, x, y, size)
  end
  #--------------------------------------------------------------------------
  # * draw_face_shop
  #--------------------------------------------------------------------------       
  def draw_face_shop(face_name, face_index, x, y, size = 32)
    bitmap = Cache.face(face_name)
    rx = face_index % 4 * 96 + (96 - size) / 2
    ry = face_index / 4 * 96 + (96 - size) / 2
    rect = Rect.new(rx,ry + 20, 96,32)   
    bitmap.stretch_blt( bitmap.rect, bitmap, bitmap.rect)   
    self.contents.blt(x, y, bitmap, rect)
    bitmap.dispose
  end 
  #--------------------------------------------------------------------------
  # * draw_possession
  #--------------------------------------------------------------------------       
  def draw_possession(x,y)
      image = Cache.menu("Shop_Possession")   
      cw = image.width 
      ch = image.height
      src_rect = Rect.new(0, 0, cw, ch)   
      self.contents.blt(x , y , image, src_rect)   
      image.dispose
  end   
  #--------------------------------------------------------------------------
  # * draw_status_back
  #--------------------------------------------------------------------------       
  def draw_status_back(x,y)
      image = Cache.menu("Shop_Status_Back")   
      cw = image.width 
      ch = image.height
      src_rect = Rect.new(0, 0, cw, ch)   
      self.contents.blt(x , y , image, src_rect)   
      image.dispose
  end   
  #--------------------------------------------------------------------------
  # * image_name_exist?
  #--------------------------------------------------------------------------     
  def image_name_exist?(actor)     
      Cache.menu(actor.name + "_Name") rescue return false 
  end 
  #--------------------------------------------------------------------------
  # * Draw_Name_Menu
  #-------------------------------------------------------------------------- 
  def draw_actor_name_menu(actor,x,y)
    if image_name_exist?(actor)   
        image_name = actor.name + "_Name" 
        image = Cache.menu(image_name)   
        cw = image.width 
        ch = image.height
        src_rect = Rect.new(0, 0, cw, ch)   
        self.contents.blt(x , y , image, src_rect) 
        image.dispose
      else   
        self.contents.font.name = "Georgia"   
        self.contents.font.bold = true
        self.contents.font.size = 18
        self.contents.font.color = Color.new(255,255,255,255)
        self.contents.draw_text(x, y, 108, WLH, actor.name)
      end
  end 
  #--------------------------------------------------------------------------
  # * draw_item_back
  #--------------------------------------------------------------------------         
  def draw_item_back(x,y,type)
    if type == 1
      image = Cache.menu("Item_Back2")   
    else 
      image = Cache.menu("Item_Back")   
    end
    cw = image.width 
    ch = image.height
    src_rect = Rect.new(0, 0, cw, ch)   
    self.contents.blt(x , y , image, src_rect)
    image.dispose
  end 
  #--------------------------------------------------------------------------
  # * draw_parameter_text
  #--------------------------------------------------------------------------         
  def draw_parameter_text(x,y)
    image = Cache.menu("Shop_Par_Text")   
    cw = image.width 
    ch = image.height
    src_rect = Rect.new(0, 0, cw, ch)   
    self.contents.blt(x , y , image, src_rect)
    image.dispose
  end 
  #--------------------------------------------------------------------------
  # * Draw Item Name 2
  #--------------------------------------------------------------------------
  def draw_item_name_menu(item, x, y, size = 172 ,align = 0,enabled = true)
    if item != nil
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, size, WLH, item.name,align)
    end
  end 
end 

#==============================================================================
# ■ Window_Help
#==============================================================================
class Window_Help < Window_Base
      attr_accessor :text
end 
#==============================================================================
# ■ Window_ShopBuy
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 284, 296)
    @shop_goods = $game_temp.shop_goods
    refresh
    self.opacity = 0
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < 99)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    self.contents.font.name = "Georgia"
    self.contents.font.bold = true
    self.contents.font.size = 18 
    draw_item_back(rect.x,rect.y,0)
    draw_item_name_menu(item, rect.x , rect.y, 120,0,enabled)
    rect.width -= 4
    file_name = "Number_01"
    draw_picture_number(rect.x + 250 ,rect.y ,item.price,file_name,0,0,3,0)
  end
  #--------------------------------------------------------------------------
  # ● update_help
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  end
end
#==============================================================================
# ■ Window_Item_Shop
#==============================================================================
class Window_Item_Shop < Window_Selectable
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 2
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● include
  #--------------------------------------------------------------------------
  def include?(item)
    return false if item == nil
    if $game_temp.in_battle
      return false unless item.is_a?(RPG::Item)
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ● enable
  #--------------------------------------------------------------------------
  def enable?(item)
    return $game_party.item_can_use?(item)
  end
  #--------------------------------------------------------------------------
  # ● refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      next unless include?(item)
      @data.push(item)
      if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    self.contents.font.name = "Georgia"
    self.contents.font.bold = true
    self.contents.font.size = 18   
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      enabled = enable?(item)
      rect.width -= 4
      draw_item_back(rect.x,rect.y,0)
      draw_item_name(item, rect.x, rect.y, enabled)
      file_name = "Number_01"
      draw_picture_number(rect.x + 247,rect.y,number,file_name,0,0,3,0)     
    end
  end
  #--------------------------------------------------------------------------
  # ● update_help
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  end
end

#==============================================================================
# ■ Window_ShopSell
#==============================================================================

class Window_ShopSell < Window_Item_Shop
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.opacity = 0
  end
  #--------------------------------------------------------------------------
  # ● include?
  #--------------------------------------------------------------------------
  def include?(item)
    return item != nil
  end
  #--------------------------------------------------------------------------
  # ● enable?
  #--------------------------------------------------------------------------
  def enable?(item)
    return (item.price > 0)
  end
end

#==============================================================================
# ■ Window_ShopNumber
#==============================================================================

class Window_ShopNumber < Window_Base
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 310, 225)
    @item = nil
    @max = 1
    @price = 0
    @number = 1
    self.opacity = 0
  end
  #--------------------------------------------------------------------------
  # ● set
  #--------------------------------------------------------------------------
  def set(item, max, price)
    @item = item
    @max = max
    @price = price
    @number = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # ● number
  #--------------------------------------------------------------------------
  def number
    return @number
  end
  #--------------------------------------------------------------------------
  # ● refresh
  #--------------------------------------------------------------------------
  def refresh
    y = 96
    self.contents.clear
    self.contents.font.name = "Georgia"
    self.contents.font.bold = true
    self.contents.font.size = 18   
    draw_item_name(@item, 0, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(212, y, 20, WLH, "×")
    file_name = "Number_01"
    draw_picture_number(280 ,y ,@number,file_name,0,0,3,0)   
    self.cursor_rect.set(244, y, 34, WLH)
    valor = @price * @number
    draw_picture_number(280 ,y + 32,valor,file_name,0,0,3,0)
  end
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
    super
    if self.active
      last_number = @number
      if Input.repeat?(Input::RIGHT) and @number < @max
        @number += 1
      end
      if Input.repeat?(Input::LEFT) and @number > 1
        @number -= 1
      end
      if Input.repeat?(Input::UP) and @number < @max
        @number = [@number + 10, @max].min
      end
      if Input.repeat?(Input::DOWN) and @number > 1
        @number = [@number - 10, 1].max
      end
      if @number != last_number
        Sound.play_cursor
        refresh
      end
    end
  end
end

#==============================================================================
# ■ Window_ShopStatus
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 280, 380)
    @item = nil
    self.opacity = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @item != nil
      number = $game_party.item_number(@item)
      self.contents.font.color = normal_color
      file_name = "Number_01"
      draw_picture_number(204,0,number,file_name,0,0,3,0)
      draw_possession(60,0)
      for actor in $game_party.members
        x = 4
        y = 35 + (75 * actor.index)
        draw_actor_parameter_change(actor, x, y)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● draw_actor_parameter_change
  #--------------------------------------------------------------------------
  def draw_actor_parameter_change(actor, x, y)
    return if @item.is_a?(RPG::Item)
    enabled = actor.equippable?(@item)
    return if enabled == false
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.font.name = "Georgia"
    self.contents.font.bold = true
    self.contents.font.size = 18
    draw_status_back(x ,y )   
    draw_actor_name_menu(actor,x ,y )
    draw_actor_face_shop(actor,x + 125 ,y )
    if @item.is_a?(RPG::Weapon)
      item1 = weaker_weapon(actor)
    elsif actor.two_swords_style and @item.kind == 0
      item1 = nil
    else
      item1 = actor.equips[1 + @item.kind]
    end
    x2 = 60
    y2 = 48
    draw_parameter_text(x,y + 48)
    if enabled
      file_name = "Number_01"
        #ATK --------------------------------------------------------
        atk1 = item1 == nil ? 0 : item1.atk
        atk2 = @item == nil ? 0 : @item.atk
        change = atk2 - atk1
        if atk1 == atk2
          draw_picture_number(x + 45,y + y2,change,file_name,1,8,3,0)
        elsif atk1 > atk2 
          draw_picture_number(x + 45,y + y2,change,file_name,1,8,3,2)
        else 
          draw_picture_number(x + 45 ,y + y2,change,file_name,1,8,3,1)
        end 
        #DEF --------------------------------------------------------
        def1 = item1 == nil ? 0 : item1.def
        def2 = @item == nil ? 0 : @item.def
        change = def2 - def1
        if def1 == def2
          draw_picture_number(x + 45 + x2 * 1,y + y2,change,file_name,1,8,3,0)
        elsif def1 > def2 
          draw_picture_number(x + 45 + x2 * 1,y + y2,change,file_name,1,8,3,2)
        else 
          draw_picture_number(x + 45 + x2 * 1,y + y2,change,file_name,1,8,3,1)
        end 
        #MAG --------------------------------------------------------
        spi1 = item1 == nil ? 0 : item1.spi
        spi2 = @item == nil ? 0 : @item.spi
        change = spi2 - spi1
        if spi1 == spi2
          draw_picture_number(x + 45 + x2 * 2,y + y2,change,file_name,1,8,3,0)
        elsif spi1 > spi2 
          draw_picture_number(x + 45 + x2 * 2,y + y2,change,file_name,1,8,3,2)
        else 
          draw_picture_number(x + 45 + x2 * 2,y + y2,change,file_name,1,8,3,1)
        end           
        #AGI --------------------------------------------------------
        agi1 = item1 == nil ? 0 : item1.agi
        agi2 = @item == nil ? 0 : @item.agi
        change = agi2 - agi1
        if agi1 == agi2
          draw_picture_number(x + 45 + x2 * 3,y + y2,change,file_name,1,8,3,0)
        elsif agi1 > agi2 
          draw_picture_number(x + 45 + x2 * 3,y + y2,change,file_name,1,8,3,2)
        else 
          draw_picture_number(x + 45 + x2 * 3,y + y2,change,file_name,1,8,3,1)
        end           
    end
    draw_item_name(item1, x + 15, y + WLH, enabled)
  end
  #--------------------------------------------------------------------------
  # ● weaker_weapon
  #--------------------------------------------------------------------------
  def weaker_weapon(actor)
    if actor.two_swords_style
      weapon1 = actor.weapons[0]
      weapon2 = actor.weapons[1]
      if weapon1 == nil or weapon2 == nil
        return nil
      elsif weapon1.atk < weapon2.atk
        return weapon1
      else
        return weapon2
      end
    else
      return actor.weapons[0]
    end
  end
  #--------------------------------------------------------------------------
  # ● item
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
end

#==============================================================================
# ■ Scene_Shop
#==============================================================================

class Scene_Shop < Scene_Base
  include MOG_SCENE_SHOP
  #--------------------------------------------------------------------------
  # ● Start
  #--------------------------------------------------------------------------
  def start
    super
  # create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @help_window.y = 410
    @help_window_time = 0
    @help_window.opacity = 0
    @help_text = @help_window.text
    @buy_window = Window_ShopBuy.new(0, 80)
    @buy_window.active = false
    @buy_window_slide = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    @sell_window = Window_ShopSell.new(-20, 80, 570, 225)
    @sell_window.active = false
    @sell_window_slide = false
    @sell_window.visible = false
    @sell_window.help_window = @help_window   
    @number_window = Window_ShopNumber.new(0, 75)
    @number_window.active = false
    @number_window.visible = false
    @number_window_slide = false
    @status_window = Window_ShopStatus.new(304, 32)
    @status_window.visible = false
    @status_window_slide = false
    @help_window.contents_opacity = 255
    create_layout
    command_refresh
  end
  #--------------------------------------------------------------------------
  # ● Create_layout
  #-------------------------------------------------------------------------- 
  def create_layout
    @menu_back = Plane.new   
    @menu_back.bitmap = Cache.menu("Background")
    #LAYOUT 1 ----------------------
    @menu_layout1 = Sprite.new 
    @menu_layout1.bitmap = Cache.menu("Shop01")
    @menu_layout1.oy = 48
    #LAYOUT 2 ---------------------
    @menu_image = Cache.menu("Shop02")
    @menu_bitmap = Bitmap.new(@menu_image.width,@menu_image.height)
    @menu_width = @menu_image.width
    @menu_height = @menu_image.height / 2   
    @menu_src_rect = Rect.new(0, @command_index * @menu_height, @menu_width, @menu_height)
    @menu_bitmap.blt(0,0, @menu_image, @menu_src_rect)   
    @menu_layout2 = Sprite.new 
    @menu_layout2.bitmap = @menu_bitmap   
    @menu_layout2.oy = 48
    #LAYOUT 3 ----------------------
    @menu_layout3 = Sprite.new 
    @menu_layout3.bitmap = Cache.menu("Shop03")
    @menu_layout3.oy = -48 - 318
    #LAYOUT 4 ----------------------
    @menu_layout4 = Sprite.new 
    @menu_layout4.bitmap = Cache.menu("Shop04") 
    @menu_layout4.opacity = 0
  end 
  #--------------------------------------------------------------------------
  # ● Pre Terminate
  #-------------------------------------------------------------------------- 
  def pre_terminate
    super
      for i in 0..15
      @menu_back.ox += 1
      @menu_layout1.oy += 4
      @menu_layout2.oy += 4
      @buy_window.x -= 12     
      @sell_window.x -= 12
      @menu_layout3.oy -= 4
      @help_window.oy += 4
      @help_window.visible = false
      @menu_layout1.opacity -= 14
      @menu_layout2.opacity -= 14
      @menu_layout3.opacity -= 14
      @menu_layout4.opacity -= 14
      @command_window.visible = false
      @help_window.contents_opacity -= 14
      @sell_window.contents_opacity -= 14
      @buy_window.contents_opacity -= 14
      @gold.update_dispose
      Graphics.update 
    end 
  end   
  #--------------------------------------------------------------------------
  # ● Terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_command_window
    @help_window.dispose
    @buy_window.dispose
    @sell_window.dispose
    @number_window.dispose
    @status_window.dispose
    @menu_back.bitmap.dispose
    @menu_back.dispose
    @menu_layout1.bitmap.dispose
    @menu_layout1.dispose
    @menu_bitmap.dispose
    @menu_layout2.bitmap.dispose
    @menu_layout2.dispose
    @menu_layout3.bitmap.dispose
    @menu_layout3.dispose
    @menu_layout4.bitmap.dispose
    @menu_layout4.dispose   
  end
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
    super
    @menu_back.ox += 1 if SLIDE_BACKGROUND == true
    update_slide
    update_menu_background
    @help_window.update
    @command_window.update
    @buy_window.update
    @sell_window.update
    @number_window.update
    @status_window.update
    update_text_slide
    update_buy_slide
    update_sell_slide
    update_number_slide
    update_status_slide
    command_refresh if @command_index != @command_window.index
    text_refresh if @help_text != @help_window.text
    if @command_window.active
      update_command_selection
    elsif @buy_window.active
      update_buy_selection
    elsif @sell_window.active
      update_sell_selection
    elsif @number_window.active
      update_number_input
    end
  end
  #--------------------------------------------------------------------------
  # ● update_text_slide
  #-------------------------------------------------------------------------   
  def update_text_slide
      @help_window_time -= 1 if @help_window_time > 0
      @help_window.contents_opacity += 10 if @help_window.contents_opacity < 255
    case @help_window_time
      when 11..20
          @help_window.x -= 3
      when 1..10 
          @help_window.x += 3
    end   
  end   
 
  #--------------------------------------------------------------------------
  # ● update_status_slide
  #--------------------------------------------------------------------------   
  def update_status_slide
    if @status_window_slide == true
        if @status_window.x > 274
          @status_window.x -= SLIDE_SPEED
          @status_window.contents_opacity += 15
          @status_window.visible = true
        else 
          @status_window.x = 274
          @status_window.contents_opacity = 255
        end 
    else
        if @status_window.x < 454
          @status_window.x += SLIDE_SPEED
          @status_window.contents_opacity -= 15
        else
          @status_window.x = 454
          @status_window.contents_opacity = 0
          @status_window.visible = false
        end 
    end 
  end   
 
  #--------------------------------------------------------------------------
  # ● update_number_slide
  #--------------------------------------------------------------------------   
  def update_number_slide
    if @number_window_slide == true
        if @number_window.x < 0
          @number_window.x += SLIDE_SPEED
          @number_window.contents_opacity += 15
          @number_window.visible = true
        else 
          @number_window.x = 0
          @number_window.contents_opacity = 255
        end 
    else
        if @number_window.x > -150
          @number_window.x -= SLIDE_SPEED
          @number_window.contents_opacity -= 15
        else
          @number_window.x = -150
          @number_window.contents_opacity = 0
          @number_window.visible = false
        end 
    end 
  end 
 
  #--------------------------------------------------------------------------
  # ● update_buy_slide
  #--------------------------------------------------------------------------   
  def update_buy_slide
    if @buy_window_slide == true
        if @buy_window.x < 0
          @buy_window.x += SLIDE_SPEED
          @buy_window.contents_opacity += 15
          @buy_window.visible = true
        else 
          @buy_window.x = 0
          @buy_window.contents_opacity = 255
        end 
    else
        if @buy_window.x > -150
          @buy_window.x -= SLIDE_SPEED
          @buy_window.contents_opacity -= 15
        else
          @buy_window.x = -150
          @buy_window.contents_opacity = 0
          @buy_window.visible = false
        end 
    end 
  end   
  #--------------------------------------------------------------------------
  # ● update_buy_slide
  #--------------------------------------------------------------------------   
  def update_sell_slide
    if @sell_window_slide == true
        if @sell_window.x < -10
          @sell_window.x += SLIDE_SPEED
          @sell_window.contents_opacity += 15
          @sell_window.visible = true
        else 
          @sell_window.x = -10
          @sell_window.contents_opacity = 255
        end 
    else
        if @sell_window.x > -150
          @sell_window.x -= SLIDE_SPEED
          @sell_window.contents_opacity -= 15
        else
          @sell_window.x = -150
          @sell_window.contents_opacity = 0
          @sell_window.visible = false
        end 
    end 
  end   
  #--------------------------------------------------------------------------
  # ● text_refresh
  #-------------------------------------------------------------------------     
  def text_refresh
      @help_text = @help_window.text
      @help_window.contents_opacity = 0
      @help_window_time = 20
      @help_window.x = 0
  end   
  #--------------------------------------------------------------------------
  # ● command_refresh
  #--------------------------------------------------------------------------   
  def command_refresh
      @command_index = @command_window.index
      @menu_layout2.bitmap.clear
      if @command_index == 0
        @help_window.set_text(BUY_TEXT)
      else 
        @help_window.set_text(SELL_TEXT)
      end       
      @menu_src_rect = Rect.new(0, @command_index * @menu_height, @menu_width, @menu_height)
      @menu_bitmap.blt(0,0, @menu_image, @menu_src_rect)         
  end 
  #--------------------------------------------------------------------------
  # ● create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = ""
    s2 = ""
    @command_window = Window_Command.new(400, [s1, s2], 3)
    @command_window.x = 244
    @command_window.y = 0
    @command_window.opacity = 0
    @command_window.contents_opacity = 0
    @command_index = @command_window.index
    if $game_temp.shop_purchase_only
      @command_window.draw_item(1, false)
    end
  end
  #--------------------------------------------------------------------------
  # ● dispose_command_window
  #--------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● update_slide
  #-------------------------------------------------------------------------- 
  def update_slide
    @menu_layout4.opacity += 5
    @menu_layout1.opacity += 10
    @menu_layout2.opacity += 10
    @menu_layout3.opacity += 10
    #layout 1
    if @menu_layout1.oy > 0
      @menu_layout2.oy -= 4
      @menu_layout1.oy -= 4
    else
      @menu_layout1.oy = 0
      @menu_layout2.oy = 0
    end 
    #Layout 3
    if @menu_layout3.oy < -318 
      @menu_layout3.oy += 4
      @help_window.y -=4
    else
      @menu_layout3.oy = -318 
      @help_window.y = 372
    end     
  end   
  #--------------------------------------------------------------------------
  # ● update_command_selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @status_window.item = nil
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0 
        Sound.play_decision
        @command_window.active = false
        @buy_window.active = true
        @buy_window_slide = true
        @buy_window.refresh
        @status_window_slide = true
      when 1 
        if $game_temp.shop_purchase_only
          Sound.play_buzzer
        else
          Sound.play_decision
          @command_window.active = false
          @sell_window.active = true
          @sell_window_slide = true
          @sell_window.refresh
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● update_buy_selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @buy_window.active = false
      @buy_window_slide = false
      @status_window_slide = false
      @help_window.set_text("")
      command_refresh
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or number == 99
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? 99 : $game_party.gold / @item.price
        max = [max, 99 - number].min
        @buy_window.active = false
        @buy_window_slide = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window_slide = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● update_sell_selection
  #--------------------------------------------------------------------------
  def update_sell_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @sell_window.active = false
      @sell_window_slide = false
      @status_window.item = nil
      @help_window.set_text("")
      command_refresh
    elsif Input.trigger?(Input::C)
      @item = @sell_window.item
      @status_window.item = @item
      if @item == nil or @item.price == 0
        Sound.play_buzzer
      else
        Sound.play_decision
        max = $game_party.item_number(@item)
        @sell_window.active = false
        @sell_window_slide = false
        @number_window.set(@item, max, @item.price / 2)
        @number_window.active = true
        @number_window_slide = true
        @status_window_slide = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● update_number_input
  #--------------------------------------------------------------------------
  def update_number_input
    if Input.trigger?(Input::B)
      cancel_number_input
    elsif Input.trigger?(Input::C)
      decide_number_input
    end
  end
  #--------------------------------------------------------------------------
  # ● cancel_number_input
  #--------------------------------------------------------------------------
  def cancel_number_input
    Sound.play_cancel
    @number_window.active = false
    @number_window_slide = false
    case @command_window.index
    when 0
      @buy_window.active = true
      @buy_window_slide = true
    when 1 
      @sell_window.active = true
      @sell_window_slide = true
      @status_window_slide = false
    end
  end
  #--------------------------------------------------------------------------
  # ● decide_number_input
  #--------------------------------------------------------------------------
  def decide_number_input
    Sound.play_shop
    @number_window.active = false
    @number_window_slide = false
    case @command_window.index
    when 0
      $game_party.lose_gold(@number_window.number * @item.price)
      $game_party.gain_item(@item, @number_window.number)
      @buy_window.refresh
      @status_window.refresh
      @buy_window.active = true
      @buy_window_slide = true
    when 1
      $game_party.gain_gold(@number_window.number * (@item.price / 2))
      $game_party.lose_item(@item, @number_window.number)
      @sell_window.refresh
      @status_window.refresh
      @sell_window.active = true
      @sell_window_slide = true
      @status_window_slide = false
    end
  end
end
#===============================================================================
# Gold_Sprite
#===============================================================================
class Gold_Sprite < Sprite
  include MOG_SCENE_SHOP
#--------------------------------------------------------------------------
# Initialize
#--------------------------------------------------------------------------
  def initialize
    super
    create_sprite
  end
  #--------------------------------------------------------------------------
  # * create_sprite
  #--------------------------------------------------------------------------   
  def create_sprite
    @gold = $game_party.gold
    @gold_old = @gold
    @gold_ref = @gold_old
    @gold_refresh = false   
    @gold_number_image = Cache.system("Number_01")
    @gold_number_bitmap = Bitmap.new(@gold_number_image.width,@gold_number_image.height)
    @gold_number_sprite = Sprite.new
    @gold_number_sprite.bitmap = @gold_number_bitmap
    @gold_number_sprite.z = 1012
    @gold_number_sprite.opacity = 0
    @gold_number_sprite.x = 60
    @gold_number_sprite.y = 53 + 48
    @gold_im_cw = @gold_number_image.width / 10
    @gold_im_ch = @gold_number_image.height / 3 
    @gold_number_text = @gold.abs.to_s.split(//)
    for r in [Tienes que estar registrado y conectado para ver este vínculo] - 1
      @gold_number_abs = @gold_number_text[r].to_i
      @gold_src_rect = Rect.new(@gold_im_cw * @gold_number_abs, 0, @gold_im_cw, @gold_im_ch)
      @gold_number_bitmap.blt(0 + ((@gold_im_cw - 5) *  r), 2, @gold_number_image, @gold_src_rect)       
    end   
  end
  #--------------------------------------------------------------------------
  # * dispose
  #-------------------------------------------------------------------------- 
  def dispose
    @gold_number_sprite.bitmap.dispose
    @gold_number_sprite.dispose
    @gold_number_bitmap.dispose   
    super
  end
  #--------------------------------------------------------------------------
  # * Update Dispose
  #-------------------------------------------------------------------------- 
  def update_dispose
    @gold_number_sprite.oy += 4
    @gold_number_sprite.opacity -= 14
  end
  #--------------------------------------------------------------------------
  # * update
  #--------------------------------------------------------------------------
  def update
    super
    update_slide
    gold_number_down if @gold > $game_party.gold
    gold_number_up if @gold < $game_party.gold   
    gold_number_update if @gold_refresh == true   
  end 
  #--------------------------------------------------------------------------
  # * update_slide
  #-------------------------------------------------------------------------- 
  def update_slide
    if @gold_number_sprite.oy < 48
      @gold_number_sprite.oy += 4
      @gold_number_sprite.opacity += 25
    end 
  end
  #--------------------------------------------------------------------------
  # * gold_number_up
  #--------------------------------------------------------------------------
  def gold_number_up
      @gold_refresh = true
      @gold_ref = 20 * (@gold - @gold_old) / 100
      @gold_ref = 1 if @gold_ref < 1
      @gold += @gold_ref   
      if @gold >= $game_party.gold
          @gold_old = $game_party.gold
          @gold = $game_party.gold
          @gold_ref = 0
      end 
  end       
  #--------------------------------------------------------------------------
  # * gold_number_down
  #--------------------------------------------------------------------------
  def gold_number_down
      @gold_refresh = true
      @gold_ref = 10 * (@gold_old - @gold) / 100
      @gold_ref = 1 if @gold_ref < 1
      @gold -= @gold_ref   
      if @gold <= $game_party.gold
          @gold_old = $game_party.gold
          @gold = $game_party.gold
          @gold_ref = 0
      end   
  end   
  #--------------------------------------------------------------------------
  # * gold_number_update
  #--------------------------------------------------------------------------
  def gold_number_update 
    @gold_number_sprite.bitmap.clear
    @gold_number_text = @gold.abs.to_s.split(//)
      for r in [Tienes que estar registrado y conectado para ver este vínculo] - 1       
        @gold_number_abs = @gold_number_text[r].to_i
        @gold_src_rect = Rect.new(@gold_im_cw * @gold_number_abs, 0, @gold_im_cw, @gold_im_ch)
        @gold_number_bitmap.blt(0 + ((@gold_im_cw - 5) *  r), 2, @gold_number_image, @gold_src_rect)       
      end 
    @gold_refresh = false if @gold == $game_party.gold 
  end   
end 
#===============================================================================
# Scene_Shop
#===============================================================================
class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * start
  #--------------------------------------------------------------------------     
  alias mog_gold_start start
  def start
      mog_gold_start
      create_gold
  end 
  #--------------------------------------------------------------------------
  # * create_gold 
  #--------------------------------------------------------------------------   
  def create_gold 
    @gold = Gold_Sprite.new   
  end 
  #--------------------------------------------------------------------------
  # * terminate
  #--------------------------------------------------------------------------
  alias mog_gold_terminate terminate
  def terminate
      mog_gold_terminate
      @gold.dispose
  end 
  #--------------------------------------------------------------------------
  # * update
  #--------------------------------------------------------------------------   
  alias mog_gold_update update
  def update
      mog_gold_update
      @gold.update
  end     
end 

$mog_rgssvx_scene_shop = true

CREDITOS:moghunter[center]
luistop12
luistop12
500
500

Masculino

Edad 33

Cantidad de envíos 759

Maker Cash 944

Reputación 42


Volver arriba Ir abajo

[Aporte]Script Sistema Nuevo de tiendas[VX] Empty :)

Mensaje por ymr16 Vie 18 Oct 2013, 10:29 pm

pero como lo utilizo. perdona esque soy nuevo y quiero saver, pork tengoo un npc pero nose como puedo agregarle ese codigo al npc que va hacer la tienda. ayuda!!
ymr16
ymr16
0
0

Masculino

Edad 33

Cantidad de envíos 4

Maker Cash 6

Reputación 0


Volver arriba Ir abajo

[Aporte]Script Sistema Nuevo de tiendas[VX] Empty Re: [Aporte]Script Sistema Nuevo de tiendas[VX]

Mensaje por Martin Arguello Sáb 19 Oct 2013, 12:22 am

Esta bueno lástima que ponga BUY y SELL en vez de COMPRAR y VENDER!
Martin Arguello
Martin Arguello
50
50

Masculino

Edad 31

Cantidad de envíos 64

Maker Cash 93

Reputación 1


Volver arriba Ir abajo

[Aporte]Script Sistema Nuevo de tiendas[VX] Empty Re: [Aporte]Script Sistema Nuevo de tiendas[VX]

Mensaje por Muzgar Sáb 19 Oct 2013, 5:37 am

Lo mismo de antes, necropost de hace 1 año. Como no te avisé antes de que cometieses el doble necropost lo dejaré pasar pero ten más cuidado ymr16 y Martín no sigas el necro xDD

Respondiéndoos de paso, Ymr16 primero leete una guía para principiantes. Segundo, copia y pega el script encima de main y debajo de personalizado, mete las imágenes que se te indican en el lugar correcto y debería irte correctamente, el Npc que quieres que tenga la tienda simplemente añádele el comando "insertar tienda" (y por si acaso ten en cuenta que este script es para VX y no para Ace) 

Y Martín, sip tienes razón, pero no es algo que no se pueda arreglar con un poco de photoshop xD

Cierro el tema
Muzgar
Muzgar
500
500

Masculino

Edad 33

Cantidad de envíos 700

Maker Cash 2736

Reputación 78


Volver arriba Ir abajo

[Aporte]Script Sistema Nuevo de tiendas[VX] Empty Re: [Aporte]Script Sistema Nuevo de tiendas[VX]

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.