Quedada del ChatBox
Conectarse
Estadísticas
Tenemos 3236 miembros registrados.El último usuario registrado es MarcTR.
Nuestros miembros han publicado un total de 52425 mensajes en 6952 argumentos.
Últimos temas
» TORNEO BATTLE ROYAL CHARAS VOTACIONES RONDA 2por Sky Hoy a las 07:17
» FESTIMUNDOMAKER XD
por orochii Hoy a las 05:21
» [Pedido] ¿Alguien sabe cuál es este sistema de batalla?
por Albert-Chamomile Hoy a las 01:17
» [Ayuda] Animación al caminar en FPLE engine VX
por Albert-Chamomile Hoy a las 00:29
» [RMXP] Window Message Mod
por PROmaster Ayer a las 23:48
» [RMXP]Mensajes autoformateados
por orochii Ayer a las 19:31
» Nada más hacerse un chara xD
por Leaser Ayer a las 18:48
» Recopilación de blogs
por Seba Ayer a las 18:00
» El Truco Final - [Misterio & Suspense]
por Dorvin Ayer a las 15:09
» Escuela de Engines
por Seba Ayer a las 14:56
Temas importantes
----------------------------------------
Páginas con recursos RPG Maker
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Tienda mejorada 2.0
Tienda mejorada 2.0
Este script añade una opcion perdida de los antiguos rpgmakers: la opcion de
elegir si solo quieres comprar, vender o los dos a la vez.
Ademas incluye la opcion de hacer descuentos positivos o negativos en compra
y venta.
En la version 2.0 puedes definir cualquier tipo de moneda ademas del dinero,
(como experiencia o una variable de evento) y añadir items especiales que al
comprarse activan un switch o llaman a un evento comun.
Usando esto(y otras opciones) puedes crear tus propias tiendas personalizadas
para que se adapten a lo que necesites
-------CARACTERISTICAS COMPLETAS-------------
Caracteristica clasica: Descuentos, y opcion de si puedes comprar o vender.
Interfaz de las tiendas: Puedes crear qualquier numero de interfaces de tienda asi
como una por defecto, y luego cambiar estas opciones para cada una:
-Tipo de dinero: experiencia, oro o variable de evento.
-Nombre del dinero
-Personalizar los comandos de compra, venta y salir y sus nombres
-Opcion para no mostrar nombre o para seleccionar numero
-Opcion para autosalir cuando se ha comprado una vez
-Windowskin
-Titulo/Introduccion
Cosas especiales: Estos son objetos excepcionales con comportamientos unicos:
-Restriccion de compra por personaje y clase
-Activar interruptor, modificar variable o llamar evento comun al ser comprado.
-Interruptor que define si puedes comprar o no una cosa u otra y otra para que
al comprar algo ya no lo puedas usar mas.

(version inglesa)
Demo:
megaupload.com PV6FWYC6
Codigo en un unico script:
- Código:
=begin
#==============================================================================
# Tienda mejorada
# By gerkrt/gerrtunk
# Version: 2.0
# Visita http://usuarios.multimania.es/kisap/spanish_list.html para encontrar
# la version mas corregida o actualizada de este script
#==============================================================================
Este script añade una opcion perdida de los antiguos rpgmakers: la opcion de
elegir si solo quieres comprar, vender o los dos a la vez.
Ademas incluye la opcion de hacer descuentos positivos o negativos en compra
y venta.
En la version 2.0 puedes definir cualquier tipo de moneda ademas del dinero,
(como experiencia o una variable de evento) y añadir items especiales que al
comprarse activan un switch o llaman a un evento comun.
Usando esto(y otras opciones) puedes crear tus propias tiendas personalizadas
para que se adapten a lo que necesites
-------CARACTERISTICAS COMPLETAS-------------
Caracteristica clasica: Descuentos, y opcion de si puedes comprar o vender.
Interfaz de las tiendas: Puedes crear qualquier numero de interfaces de tienda asi
como una por defecto, y luego cambiar estas opciones para cada una:
-Tipo de dinero: experiencia, oro o variable de evento.
-Nombre del dinero
-Personalizar los comandos de compra, venta y salir y sus nombres
-Opcion para no mostrar nombre o para seleccionar numero
-Opcion para autosalir cuando se ha comprado una vez
-Windowskin
-Titulo/Introduccion
Cosas especiales: Estos son objetos excepcionales con comportamientos unicos:
-Restriccion de compra por personaje y clase
-Activar interruptor, modificar variable o llamar evento comun al ser comprado.
-Interruptor que define si puedes comprar o no una cosa u otra y otra para que
al comprar algo ya no lo puedas usar mas.
--------DESCUENTO Y TIPO---------
Antes de llamar una tienda, llama este script:
$game_temp.type = 1
$game_temp.buy_discount = 1.2
$game_temp.sell_discount = 0.8
Explicacion del ejemplo:
$game_temp.type : Cuando es 2 solo puede vender, cuando 1 solo comprar, y
cuando 0 los dos.
$game_temp.buy_discount : El precio de compra se multiplica por este numero.
$game_temp.sell_discount : El precio de venta se multiplica por este numero.
Nota el 0.2 . El . es como un ,
Despues de la compra estos valores se resetean a los por defecto, asi que si
no vas a hacer cambios no tienes que llamar al script.
$game_temp.type = 1
$game_temp.buy_discount = 1.2
$game_temp.sell_discount = 0.8
Como opcion final, puedes poner cualquiera de estas opciones usando el valor
de una variable de evento mediante este llamar script:
v = $game_variables[1]
$game_temp.sell_discount = v
Donde 1 es la id de la variable usada.
--------TIENDAS PERSONALIZADAS---------
La idea principal de estas opciones es que puedes crear configuraciones para que
la tienda normal haga cosas especiales. Por ejemplo:
-Una tienda de viaje en la que si compras, sales y viajas automaticamente.
Tienes la configuracion ya hecha, solo llama una tienda con los objetos 5,6,7,8 y
cambiando la interfaz a :viajar.
-----INTERFACES------
Definenen las cosas basicas usadas en las tiendas, por ejemplo, el vocabulario,
dinero, etc, pudiendo crear distintas tiendas usando una interfaz unica cada vez.
Para añadir una nueva interfaz añade esto cada vez:
:viajar => {
:gold_type => [:var, 6],
:gold_word => 'Patatas',
:commands_used => [[:buy, 'Viajar'], [:exit, 'Salir']],
:dont_show_number => true,
:exit_when_buy => false,
:windowskin => 'greenieskin',
:title => 'Mercader viajante: ¿Donde te llevo?'
},
Donde :viajar es un codigo unico usado cada vez, y solo respeta la sintaxis
con el ,{}, etc.
gold type: El dinero usado. Puede ser :gold(dinero normal) :exp(exp grupo), y
:var(por variable de evento).
Nota que para las variables la sintaxi es diferente: [:var, 6], donde el 6
es la id de la variable usada.
gold word: La palabra para el dinero.
commands used: Esto sirve para personalizar los comandos para que hagan lo
que tu quieras. Puedes usar :buy(comprar), :sell(vender) y :exit(salir tienda).
Lo que tienes que hacer es añadir hasta los 3 comandos en la lista de los que quieras
usar, asi:
[[:code, 'nombre'], [:code2, 'nombre2'], [:code3, 'nombre3'], ]
dont_show_number: Usa esto si no necesitas seleccionar ninguna cantidad y sera
automaticamente 1. No puede ser usado cuando vendiendo.
:exit_when_buy: Sale al comprar el primer objeto.
windowskin : windowskin usado por las ventanas
title : texto usado para la introduccion de la tienda
Llamar interface:
$game_temp.shop_interface = :viajar
Donde viaajr es el nombre de interfaz que escribes, que debe ser nuevo
cada vez. Cada vez es reseteada esta vasriable.
Nota que existe una interfaz por defecto, llamado default, se usara cuando no haya
ninguna seleccionada especialmente.
Finalmente puedes desactivar cualquier opcion poniendo => false.
-----COSAS ESPECIALES----
Funcionan como excepciones a los objetos normales. Nota que solo puedes usarlas
con las opciones de compra.
# South Amband
5 => {
:variable => [2,10],
:switch => 1,
:switch_can_buy => 5,
:common_event => 1,
:switch_adquired => nil,
:can_be_adquired_by_class => false,
:can_be_adquired_by_actor => [1],
},
variable: esto hace que cuando compras ese objeto, la variable x es
sumada al valor z, osea, [X,Z].
switch: activa switch de id Z al comprarse.
switch_can_buy: es necesario tener este interruptor activo para comprar el item
common_event: evento comun llamado al comprar el item
switch_adquired: cuando esta activo, la cosa no se puede comprar ya mas, usalo
para cosas que se compren 1 sola vez
can_be_adquired_by_class: Lista de clases que pueden comprar este
objeto. Nota que buscara en todo el grupo de aliados. [id1, id2, id3]
can_be_adquired_by_actor: Lista de clases que pueden comprar este
objeto. Nota que buscara en todo el grupo de aliados. [id1, id2, id3]
Para desactivar cualquier opcion: => false
La sintaxis para añadir nuevas cosas es:
# Nuevo comentario
23 => {
:variable => [2,10],
:switch => 1,
:switch_can_buy => 5,
:common_event => 1,
:switch_adquired => nil,
:can_be_adquired_by_class => false,
:can_be_adquired_by_actor => [1],
},
Donde 23 es el id del objeto que quieres usar y # new comment un texto
modificable usado para ordenarlo mejor.
Respeta la sintaxis añadiendo cada vez usando los , {}, etc.
=end
module Wep
# Interfaces
Shop_interfaces = {
:travel => {
:gold_type => [:var, 6],
:gold_word => 'Patatas',
:commands_used => [[:buy, 'Viajar'], [:exit, 'Salir']],
:dont_show_number => true,
:exit_when_buy => true,
:windowskin => false,
:title => 'Mercader viajante: ¿Donde te llevo?'
},
# Por defecto
:default => {
:gold_type => :gold,
:gold_word => 'Oro',
:commands_used => [[:buy, 'Comprar'], [:sell, 'Vender'], [:exit, 'Salir']],
:dont_show_number => false,
:exit_when_buy => false,
:windowskin => false,
:title => false
}
}
# Cosas especiales
Things = {
# South Amband
5 => {
:variable => [2,10],
:switch => 1,
:switch_can_buy => 5,
:common_event => 1,
:switch_adquired => false,
:can_be_adquired_by_class => false,
:can_be_adquired_by_actor => [1],
},
# Fantastica
6 => {
:variable => [2,10],
:switch => 1,
:switch_can_buy => 5,
:common_event => 1,
:switch_adquired => false,
:can_be_adquired_by_class => [1],
:can_be_adquired_by_actor => [1],
},
# Ridinia
7 => {
:variable => [2,10],
:switch => 1,
:switch_can_buy => 5,
:common_event => 1,
:switch_adquired => false,
:can_be_adquired_by_class => [1],
:can_be_adquired_by_actor => [1],
},
# Wepcondia
8 => {
:variable => [2,10],
:switch => 1,
:switch_can_buy => 5,
:common_event => 1,
:switch_adquired => false,
:can_be_adquired_by_class => [1],
:can_be_adquired_by_actor => [1],
},
}
end
#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
# This window displays buyable goods on the shop screen.
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@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
# Only push the ones that arent adquired and if item
if item.is_a? RPG::Item and Wep::Things[item.id] != nil and
Wep::Things[item.id][:switch_adquired] != false and
$game_switches[Wep::Things[item.id][:switch_adquired]]
# Or if the switch to buy isnt active
elsif item.is_a? RPG::Item and Wep::Things[item.id] != nil and
Wep::Things[item.id][:switch_can_buy] != false and not
$game_switches[Wep::Things[item.id][:switch_can_buy]]
else
@data.push(item)
end
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
# Get items in possession
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
# If price is less than money in possession, and amount in possession is
# not 99, then set to normal text color. Otherwise set to disabled color
if item.price * $game_temp.buy_discount <= $game_party.shop_gold and number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
rebajado = item.price * $game_temp.buy_discount
rebajado = rebajado.to_i
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# When dont show numbers, number more to the right
if $game_temp.act_shop_interface[:dont_show_number]
self.contents.draw_text(x + 480, y, 88, 32, rebajado.to_s, 2)
else
self.contents.draw_text(x + 240, y, 88, 32, rebajado.to_s, 2)
end
end
end
#==============================================================================
# ** Window_ShopCommand
#------------------------------------------------------------------------------
# This window is used to choose your business on the shop screen.
#==============================================================================
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@column_max = 3
#Excepciones de tipo
cums = Wep::Shop_interfaces[$game_temp.shop_interface][:commands_used]
# Make custom commmands
@commands = []
for cu in cums
@commands.push cu[1]
end
@item_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 160
#Excepciones de tipo
case $game_temp.type
when 1
#Canvio de color de fuente y retorno de la misma
if index == 1
self.contents.font.color = disabled_color
end
if index == 2
self.contents.font.color = normal_color
end
when 2
#Canvio de color de fuente y retorno de la misma
if index == 0
self.contents.font.color = disabled_color
end
if index == 1...2
self.contents.font.color = normal_color
end
end
#p @commands, index
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
class Scene_Shop
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make help window
@help_window = Window_Help.new
# Make command window
@command_window = Window_ShopCommand.new
# Make gold window
@gold_window = Window_GoldShop.new
@gold_window.x = 480
@gold_window.y = 64
# Make dummy window
@dummy_window = Window_Base.new(0, 128, 640, 352)
# Make buy window
@buy_window = Window_ShopBuy.new($game_temp.shop_goods)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# Make sell window
@sell_window = Window_ShopSell.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# Make quantity input window
@number_window = Window_ShopNumber.new
@number_window.active = false
@number_window.visible = false
# Make status window
@status_window = Window_ShopStatus.new
@status_window.visible = false
# If dont show number
if Wep::Shop_interfaces[$game_temp.shop_interface][:dont_show_number]
@number_window.visible = false
@status_window.visible = false
@buy_window.width = 640
@buy_window.z = @status_window.z + 80
end
# Windoskin
if Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin]
@sell_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@number_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@status_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@buy_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@help_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@gold_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@command_window.windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
@dummy_window .windowskin = RPG::Cache.windowskin( Wep::Shop_interfaces[$game_temp.shop_interface][:windowskin])
end
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# Set title
if Wep::Shop_interfaces[$game_temp.shop_interface][:title]
@help_window.set_text (Wep::Shop_interfaces[$game_temp.shop_interface][:title])
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Reset shop variables
$game_temp.type = 0
$game_temp.buy_discount = 1
$game_temp.sell_discount = 1
$game_temp.shop_interface = :default
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Trasnlate command index as command code used
case $game_temp.act_shop_interface[:commands_used][@command_window.index][0]
when :buy
command_buy
when :sell
command_sell
when :exit
command_exit
return
end
end
end
#--------------------------------------------------------------------------
# * Command buy: execute command buy
#--------------------------------------------------------------------------
def command_buy
if $game_temp.type== 0 or $game_temp.type== 1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Change windows to buy mode
@command_window.active = false
@dummy_window.visible = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@status_window.visible = true
else
$game_system.se_play($data_system.cancel_se)
return
end
end
#--------------------------------------------------------------------------
# * Command sell: execute command sell
#--------------------------------------------------------------------------
def command_sell
if $game_temp.type== 0 or $game_temp.type== 2
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Change windows to sell mode
@command_window.active = false
@dummy_window.visible = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
else
$game_system.se_play($data_system.cancel_se)
return
end
end
#--------------------------------------------------------------------------
# * Command exit: execute command exit
#--------------------------------------------------------------------------
def command_exit
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Reset shop variables
$game_temp.type = 0
$game_temp.buy_discount = 1
$game_temp.sell_discount = 1
$game_temp.shop_interface = :default
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Check item class restriction
#--------------------------------------------------------------------------
def item_class_restriction
# If its special one and cant be purchased by actors or classes
if Wep::Things[@item.id] != nil
class_valid = true
if Wep::Things[@item.id][:can_be_adquired_by_class]
for adq_class in Wep::Things[@item.id][:can_be_adquired_by_class]
class_valid = false unless $game_party.include_class?(adq_class)
end
end
unless class_valid
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return false
end
end
return true
end
#--------------------------------------------------------------------------
# * Check item actor restriction
#--------------------------------------------------------------------------
def item_actor_restriction
# If its special one and cant be purchased by actors or classes
if Wep::Things[@item.id] != nil
actor_valid = true
if Wep::Things[@item.id][:can_be_adquired_by_actor]
for adq_actor in Wep::Things[@item.id][:can_be_adquired_by_actor]
actor_valid = false unless $game_party.include_actor?(adq_actor)
end
end
unless actor_valid
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return false
end
end
return true
end
#--------------------------------------------------------------------------
# * Frame Update (when buy window is active)
#--------------------------------------------------------------------------
def update_buy
# Set status window item
@status_window.item = @buy_window.item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Change windows to initial mode
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
# Erase help text
@help_window.set_text("")
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get item
@item = @buy_window.item
# If item is invalid, or price is higher than money possessed
if @item == nil or @item.price > $game_party.shop_gold
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If dont show number, automatically gain 1 item and skip number
if Wep::Shop_interfaces[$game_temp.shop_interface][:dont_show_number]
# Buy process only if normal
unless Wep::Things[@item.id] != nil
modificado = @item.price * $game_temp.buy_discount
$game_party.shop_lose_gold(modificado.to_i)
case @item
when RPG::Item
$game_party.gain_item(@item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(@item.id, 1)
when RPG::Armor
$game_party.gain_armor(@item.id, 1)
end
# Special items
else
# Check items restrictions
return unless item_actor_restriction
return unless item_class_restriction
modificado = @item.price * $game_temp.buy_discount
$game_party.shop_lose_gold(modificado.to_i)
# Modifiy var
if Wep::Things[@item.id][:variable]
$game_variables[Wep::Things[@item.id][:variable][0]] += Wep::Things[@item.id][:variable][1]
end
# Mod sw
if Wep::Things[@item.id][:switch]
$game_switches[Wep::Things[@item.id][:switch]] = true
end
# Call comm ev
if Wep::Things[@item.id][:common_event]
$game_temp.common_event_id = Wep::Things[@item.id][:common_event]
end
end
# Refresh each window
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# End execution and play se
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Or exit if configurated
if Wep::Shop_interfaces[$game_temp.shop_interface][:exit_when_buy]
$scene = Scene_Map.new
end
return
end
# Get items in possession count
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# If 99 items are already in possession
if number == 99
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Calculate maximum amount possible to buy
rebaja = @item.price*$game_temp.buy_discount
max = @item.price == 0 ? 99 : $game_party.shop_gold / rebaja.to_i
max = [max, 99 - number].min
# Change windows to quantity input mode
@buy_window.active = false
@buy_window.visible = false
descuento = @item.price * $game_temp.buy_discount
@number_window.set(@item, max, descuento.to_i)
@number_window.active = true
@number_window.visible = true
end
end
#--------------------------------------------------------------------------
# * Frame Update (when sell window is active)
#--------------------------------------------------------------------------
def update_sell
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Change windows to initial mode
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
# Erase help text
@help_window.set_text("")
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get item
@item = @sell_window.item
# Set status window item
@status_window.item = @item
# If item is invalid, or item price is 0 (unable to sell)
if @item == nil or @item.price == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Get items in possession count
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# Maximum quanitity to sell = number of items in possession
max = number
# Change windows to quantity input mode
@sell_window.active = false
@sell_window.visible = false
descuento = (@item.price * $game_temp.vend_desc) / 2
@number_window.set(@item, max, descuento.to_i)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
#--------------------------------------------------------------------------
# * Frame Update (when quantity input window is active)
#--------------------------------------------------------------------------
def update_number
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Set quantity input window to inactive / invisible
@number_window.active = false
@number_window.visible = false
# Branch by command window cursor position
case @command_window.index
when 0 # buy
# Change windows to buy mode
@buy_window.active = true
@buy_window.visible = true
when 1 # sell
# Change windows to sell mode
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play shop SE
$game_system.se_play($data_system.shop_se)
# Set quantity input window to inactive / invisible
@number_window.active = false
@number_window.visible = false
# Branch by command window cursor position
case @command_window.index
when 0 # buy
# Buy process only if normal
unless Wep::Things[@item.id] != nil
modificado = @number_window.number * @item.price * $game_temp.buy_discount
$game_party.shop_lose_gold(modificado.to_i)
case @item
when RPG::Item
$game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
end
# Special items
else
# Check items restrictions
return unless item_actor_restriction
return unless item_class_restriction
modificado = @number_window.number * @item.price * $game_temp.buy_discount
$game_party.shop_lose_gold(modificado.to_i)
# Modifiy var
if Wep::Things[@item.id][:variable]
$game_variables[Wep::Things[@item.id][:variable][0]] += Wep::Things[@item.id][:variable][1]
end
# Mod sw
if Wep::Things[@item.id][:switch]
$game_switches[Wep::Things[@item.id][:switch]] = true
end
# Call comm ev
if Wep::Things[@item.id][:common_event]
$game_temp.common_event_id = Wep::Things[@item.id][:common_event]
end
end
# Refresh each window
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# Change windows to buy mode
@buy_window.active = true
@buy_window.visible = true
# Or exit if configurated
if Wep::Shop_interfaces[$game_temp.shop_interface][:exit_when_buy]
$scene = Scene_Map.new
end
when 1 # sell
# Sell process
modificado = (@item.price * $game_temp.vend_desc) / 2
$game_party.shop_gain_gold(@number_window.number * modificado.to_i)
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
end
# Refresh each window
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# Change windows to sell mode
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
end
end
class Game_Temp
attr_accessor :type # 2: Sell/1: Buy/0: Both
attr_accessor :buy_discount # Buy discount +- %
attr_accessor :sell_discount # Sell discount +- %
attr_accessor :shop_interface # Sell discount +- %
alias gt_init initialize
def initialize
gt_init
@type = 0
@shop_interface = :default
@buy_discount = 1
@sell_discount = 1
end
# Return shop interface
def act_shop_interface
Wep::Shop_interfaces[$game_temp.shop_interface]
end
end
class Game_Actor
attr_reader :actor_id
end
class Game_Party
#--------------------------------------------------------------------------
# * Seeks if at least a actor in the party have the actor id
#--------------------------------------------------------------------------
def include_actor?(id)
f=false
for a in @actors
f=true if a.actor_id == id
end
f
end
#--------------------------------------------------------------------------
# * Seeks if at least a actor in the party have the class id
#--------------------------------------------------------------------------
def include_class?(id)
f=false
for a in @actors
f=true if a.class_id == id
end
f
end
#--------------------------------------------------------------------------
# * Shop gold
# gold method used only in shop
#--------------------------------------------------------------------------
def shop_gold
type = Wep::Shop_interfaces[$game_temp.shop_interface][:gold_type]
# Normal gold
if type == :gold
return @gold
# Experience
elsif type == :exp
v = 0
@actors.each {|a| v += a.exp}
return v
# Event variable
else
return $game_variables[Wep::Shop_interfaces[$game_temp.shop_interface][:gold_type][1]]
end
end
#--------------------------------------------------------------------------
# * Shop Gain Gold (or lose)
# n : amount of gold
#--------------------------------------------------------------------------
def shop_gain_gold(n)
type = Wep::Shop_interfaces[$game_temp.shop_interface][:gold_type]
# Normal gold
if type == :gold
@gold = [[@gold + n, 0].max, 9999999].min
# Experience
elsif type == :exp
# Divide actor number by n
ratio = (n/@actors.size).to_i
# Modify each exp
@actors.each {|a| a.exp += ratio}
# Event variable
else
vid = Wep::Shop_interfaces[$game_temp.shop_interface][:gold_type][1]
$game_variables[vid] = [[$game_variables[vid] + n, 0].max, 9999999].min
end
end
#--------------------------------------------------------------------------
# * Shop Lose Gold
# n : amount of gold
#--------------------------------------------------------------------------
def shop_lose_gold(n)
# Reverse the numerical value and call it gain_gold
shop_gain_gold(-n)
end
end
#==============================================================================
# ** Window_GoldShop
#------------------------------------------------------------------------------
# This window displays amount of gold in shops
#==============================================================================
class Window_GoldShop < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
word = Wep::Shop_interfaces[$game_temp.shop_interface][:gold_word].to_s
cx = contents.text_size(word).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.shop_gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, word, 2)
end
end
module Wep
Scripts_list = [] unless defined? Scripts_list
Scripts_list.push ('Improved Shop')
end

gerrtunk- Soñador

-

207
Re: Tienda mejorada 2.0
Primero que todo... excelente demostración, realmente demuestra la versatilidad de la tienda =D! Y viendo eso, aparte, se puede ver que también puede cambiarse los nombres de los comandos dependiendo de cada tipo de tienda.
Y pues, en general, como siempre, te "pasas" con la versatilidad xDD! (en realidad es más que bienvenida :3). Ojala hayan muchos que le saquen buen provecho. Quizá yo también lo haga, pero por lo pronto creo que no D: (cuando prosiga mis proyectos de RMXP veré).
Excelente aporte Gerkt,
Orochii Zouveleki
Y pues, en general, como siempre, te "pasas" con la versatilidad xDD! (en realidad es más que bienvenida :3). Ojala hayan muchos que le saquen buen provecho. Quizá yo también lo haga, pero por lo pronto creo que no D: (cuando prosiga mis proyectos de RMXP veré).
Excelente aporte Gerkt,
Orochii Zouveleki
Re: Tienda mejorada 2.0
La tienda me recordo un poco a la de Final Fantasy tactics advance:
-¡Clan destino! Tengo un descuento especial para ustedes.
Esta BASTANTE bien como tienda, le pone límites a las cosas y hace unas nuevas la verdad es que me encantaría ver como estaria una tienda en un juego de esa forma, siempre he pensado que ese tipo de pequeños detalles hacen especial a un juego. (Hecho en RPG maker) Lo que si me parece mejorable es la ventana, ya que esa se ve bastante simple PERO eso ya es cosa de quien hizo el script y no soy nadie para críticar de una esa forma. (Aunque enserio, se podria hacer un diseño diferente)
-¡Clan destino! Tengo un descuento especial para ustedes.
Esta BASTANTE bien como tienda, le pone límites a las cosas y hace unas nuevas la verdad es que me encantaría ver como estaria una tienda en un juego de esa forma, siempre he pensado que ese tipo de pequeños detalles hacen especial a un juego. (Hecho en RPG maker) Lo que si me parece mejorable es la ventana, ya que esa se ve bastante simple PERO eso ya es cosa de quien hizo el script y no soy nadie para críticar de una esa forma. (Aunque enserio, se podria hacer un diseño diferente)

eolo32- Principiante

-

280
Re: Tienda mejorada 2.0
En esta version solo se puede cambiar el windowskin, pero espera a la 2.x, ya que permitira sacrla en mapa con qualquier tamaño y colores, fuentes,etc, y unos cuantos extras mas.
Para mi siguiente proyecto viene la 3.0, que añade tiendas unicas con su fondo, imagen, descripciones, vendedores, valores unicos, objetos secretos, aleatorios, mensajes y eventos en tienda, limite de objetos y memoria de venta, etc.
Para mi siguiente proyecto viene la 3.0, que añade tiendas unicas con su fondo, imagen, descripciones, vendedores, valores unicos, objetos secretos, aleatorios, mensajes y eventos en tienda, limite de objetos y memoria de venta, etc.

gerrtunk- Soñador

-

207
Re: Tienda mejorada 2.0
gerrtunk escribió:Este script añade una opcion perdida de los antiguos rpgmakers: la opcion de
elegir si solo quieres comprar, vender o los dos a la vez.
Yo tuve que hacer un script que hiciera eso también, para el RM2kXP xDDD
Se ve muy interesante tu script, muy currado, yo no hice tantas cosas porque no lo necesitaba. Lo hice a lo cutre, me ocupó unas 20 líneas:
Antes de insertar tienda tienes que poner por ejemplo, en un Insertar Script, $shoptype = 2
Así es cómo lo lee (dentro del def main del scene_shop), lo pongo por si interesa como se puede hacer de una manera sencilla y por si trae ideas a alguien.
- Código:
@buy_enabled = true
@sell_enabled = true
if $shoptype == 0
@buy_enabled = true
@sell_enabled = true
end
if $shoptype == 1
@buy_enabled = false
@sell_enabled = true
end
if $shoptype == 2
@buy_enabled = true
@sell_enabled = false
end
if @buy_enabled == false
@command_window.disable_item(0)
end
if @sell_enabled == false
@command_window.disable_item(1)
end
Y luego en el update_command dentro del Buy esto antes que lo que hay por defecto:
- Código:
if @buy_enabled == false
$game_system.se_play($data_system.buzzer_se)
return
end
y dentro del Sell exactamente igual, esto:
- Código:
if @sell_enabled == false
$game_system.se_play($data_system.buzzer_se)
return
end
Re: Tienda mejorada 2.0
La version 1.0 era mas simple, pasa que estava mal programada, porque por aquel entonces no sabia ni que se podian desactivar comandos del window command y lo hice a pelo yo mismo, XD.

gerrtunk- Soñador

-

207
Re: Tienda mejorada 2.0
Me encanto, es justo lo que buscaba para tiendas que se compren un item
solo una vez, y que con el tiempo, vuelva a aparecer.
Ademas de tener mercaderes mas caros y otros mas accesibles al precio.
El link de Megaupload esta roto obviamente, podrias subir un demo a otro link?
para ver como se ocupa el script, Gracias.
Edito:
Consulta, la variable:
v = $game_variables[1]
$game_temp.sell_discount = v
se puede ocupar tambien para ventas? :
v = $game_variables[1]
$game_temp.buy_discount = v
y asi usar items de regateo?
solo una vez, y que con el tiempo, vuelva a aparecer.
Ademas de tener mercaderes mas caros y otros mas accesibles al precio.
El link de Megaupload esta roto obviamente, podrias subir un demo a otro link?
para ver como se ocupa el script, Gracias.
Edito:
Consulta, la variable:
v = $game_variables[1]
$game_temp.sell_discount = v
se puede ocupar tambien para ventas? :
v = $game_variables[1]
$game_temp.buy_discount = v
y asi usar items de regateo?
Última edición por Ripher el 2012-12-20, 09:49, editado 1 vez

Ripher- Iniciado

-

55
Re: Tienda mejorada 2.0
Ripher escribió:Me encanto, es justo lo que buscaba para tiendas que se compren un item
solo una vez, y que con el tiempo, vuelva a aparecer.
Ademas de tener mercaderes mas caros y otros mas accesibles al precio.
El link de Megaupload esta roto obviamente, podrias subir un demo a otro link?
para ver como se ocupa el script, Gracias.
pidelo en el topic de links rotos y no hagas necroposting, gracias

Dangaioh- Administrador

-

4390
Re: Tienda mejorada 2.0
Ripher escribió:Me encanto, es justo lo que buscaba para tiendas que se compren un item
solo una vez, y que con el tiempo, vuelva a aparecer.
Ademas de tener mercaderes mas caros y otros mas accesibles al precio.
El link de Megaupload esta roto obviamente, podrias subir un demo a otro link?
para ver como se ocupa el script, Gracias.
Edito:
Consulta, la variable:
v = $game_variables[1]
$game_temp.sell_discount = v
se puede ocupar tambien para ventas? :
v = $game_variables[1]
$game_temp.buy_discount = v
y asi usar items de regateo?
Ni me acordaba que este script tenia demo en megaupload. Pues habre de buscarla en mis discos duros y resubirla si hay suerte.
Por lo demas no entiendo tu pregunta. Claro que puedes usar la misma variable o cambiarla por la que te interese cada vez, aunque no tendria mucho sentido ya que no es necesario y si usas la misma te limitas un huevo.
Es muy facil hacer items o habilidades de regateo con estas llamadas de script, pero hay que saber enginear algo.
Usa dos variables de eventos por cada tipo de descuento usado. Y luego haz un evento comun con unas condiciones y efectos en las cuales comprovas si tienes X objeto y si lo tienes pues sumas o restas cierto valor a esa variable de descuento que estas usando. Y esto es aplicable a todo.
Finalmente cuando llames a una tienda pues sumas la variable acumulada y general con los valores que quieras usar en cada tienda en particular y ya lo tienes hecho.

gerrtunk- Soñador

-

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

























