Quedada del ChatBox
Conectarse

Recuperar mi contraseña

Estadísticas
Tenemos 2162 miembros registrados.
El último usuario registrado es chichox.

Nuestros miembros han publicado un total de 37850 mensajes en 4923 argumentos.
Últimos temas
» No tienes photoshop? - PIXLR
por Leaser Hoy a las 6:11 pm

» Relato de Seytan
por mrhawi Hoy a las 5:46 pm

» Pequeño tilemap de Pokemon
por Wecoc Hoy a las 5:39 pm

» Vehiculos por agua
por orochii Hoy a las 5:30 pm

» Denme su opinión sobre este sprite
por mrhawi Hoy a las 5:13 pm

» Saludos gente
por orochii Hoy a las 4:43 pm

» CONCURSO DE TROFEOS (Nº2)
por EdénTheGame Hoy a las 4:40 pm

» script Titulo animado -Modificacion-
por Felipe_9595 Hoy a las 4:27 pm

» Galeria de Dibujos
por Wecoc Hoy a las 3:32 pm

» D.R.E.A.M.S [RPGXP] [DEMO 2.0!]
por ZeroTwilight Hoy a las 3:05 pm

Afiliados
Temas importantes
----------------------------------------
Páginas con recursos RPG Maker
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Topic de screens
----------------------------------------
Navega con Firefox
[DESCARGA]

[RPGVX] Tiendas especiales

 :: RPG Maker :: Scripts

Ver el tema anterior Ver el tema siguiente Ir abajo

RPG Maker VX [RPGVX] Tiendas especiales

Mensaje por Shirono el Lun Oct 04, 2010 10:59 pm

Buenas buenas, aca les traigo un script para VX bastante util: son "tiendas especiales".
Que hace? Bastante simple, despues de activar un interruptor, las tiendas se hacen especiales y en vez de usar dinero usan un objeto como bien de cambio. Me decis, y esto de que me sirve? de bastante ciertamente, en mi caso, lo uso para ciertos objetos que solo se le compran a un vendedor psicopata parecido al buhonero del RE4 xD, tambien se puede usar, que se yo, por ejemplo, para comprarle a un demonio ciertas armas o cosas asi y cambiarlo por almas (?) o etc.

El script es:

Spoiler:
#==============================================================================
# ** ExCommand_BarterShop ~ Item Version of Exchange Shop ~ (MACKIE)
#------------------------------------------------------------------------------
# This script allows you to exchange specific items, such as "coins" or
# "medals," for other items when running [Shop Processing].
#==============================================================================

# The ID of the switch used to enable the exchange shop.
# When set to ON, [Shop Processing] will replace the regular shop with the
# exchange shop ("Purchase Only" is also available here). This switch is turned
# OFF automatically after the player is finished shopping.
EXCMD_BTRSHOP_SID = 999

# Exchange shop command names.
# From left to right: [Buy] [Sell] [Finished]
EXCMD_BTRSHOP_VOCAB = ["Comprar", "Vender", "He terminado"]

# The exchange "item" used by the exchange shop.
# Specify the item representing shop "credits" here.
# Format is [Item ID, term for "credits", exchange rate]
# Item price = original price ÷ exchange rate, rounded to 1.
# (Example) If the exchange rate is 100, and an item costs 1650G normally, you
# will need to exchange 17 "credits" (100G each) to obtain the item.
EXCMD_BTRSHOP_ITEM = [999, "Monedas especiales", 50]

# Notebox string identifier for specifying a product's exchange rate.
# Items without this designation will use the default exchange rate above.
# (For more information, see below)
EXCMD_BTRSHOP_SIGNATURE = "*BARTER_RATE"

# The ID of the variable that will store the shop identification number.
# When an ID is assigned to this variable, [Shop Processing] will adjust the
# exchange rate set per item, per shop. This way, it is possible for the same
# item to have separate rates at each shop. (For more information, see below)
EXCMD_BTRSHOP_VID = 11

# * Setting the exchange rate of items:
# Format is "EXCMD_BTRSHOP_SIGNATURE [exchange rate] [shop ID: exchange rate]"
# "|" acts as a separator for each shop ID - exchange rate pairing.
# (Example 1) *BARTER_RATE[20] => the item's exchange rate is 20.
# (Example 2) *BARTER_RATE[1:20|2:15|3:25] => the item's exchange rate is
# 20 in shop 1, 15 in shop 2, and 25 in shop 3
# (Example 3) *BARTER_RATE[20][2:10|3:15] => the item's exchange rate is
# 10 in shop 2, 15 in shop 3, and 20 anywhere else.
#
# Priority is set as follows: shop ID rate > item rate > default shop rate

# * Event procedure for creating the exchange shop:
# 1) Set the exchange rate for individual items, if necessary.
# 2) To create an exchange shop, run the following operations:
# * Control Switches: [EXCMD_BTRSHOP_SID] = ON
# * Control Variables: [EXCMD_BTRSHOP_VID] = exchange shop ID (if used)
# * [Shop Processing...] (select items)

#------------------------------------------------------------------------------

class Game_Party
#--------------------------------------------------------------------------
# * Get Exchange Item
#--------------------------------------------------------------------------
def barter_item
return $data_items[EXCMD_BTRSHOP_ITEM[0]]
end
#--------------------------------------------------------------------------
# * Get Exchange Item Number
#--------------------------------------------------------------------------
def barter_item_number
return $game_party.item_number(barter_item)
end
#--------------------------------------------------------------------------
# * Get Exchange Rate
#--------------------------------------------------------------------------
def barter_rate(item)
rate = 0
shop_id = $game_variables[EXCMD_BTRSHOP_VID]
sig = EXCMD_BTRSHOP_SIGNATURE
reg = /#{Regexp.quote sig}(?:\[\d+\])?\[((\d+:\d+\|?)+)\]/
note = item.note.clone
note.gsub!(/\r\n/, "")
if shop_id > 0 and note.scan(reg).to_a[0]
for s in $~[1].split(/\s*\|\s*/)
r = s.split(/\s*:\s*/)
rate = r[1].to_i if r[0].to_i == shop_id
break if rate > 0
end
end
if rate == 0
if note[/#{Regexp.quote sig}\[(\d+)\]/].to_a[0]
rate = $1.to_i
else
rate = (item.price / EXCMD_BTRSHOP_ITEM[2]).round
end
end
return rate > 0 ? rate : 1
end
end

class Window_Base
alias _excbshop_initialize initialize unless $@
#--------------------------------------------------------------------------
# * Object Initialization (Definition added)
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
_excbshop_initialize(x, y, width, height)
self.currency = Vocab::gold
end
#--------------------------------------------------------------------------
# * Set Currency
#--------------------------------------------------------------------------
def currency=(currency)
@currency = currency
end
#--------------------------------------------------------------------------
# * Determine if the Currency Value is Gold
#--------------------------------------------------------------------------
def gold?
return @currency == Vocab::gold
end
#--------------------------------------------------------------------------
# * Draw number with currency unit (Redefined)
# value : Number (gold, etc)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
#--------------------------------------------------------------------------
def draw_currency_value(value, x, y, width)
cx = contents.text_size(@currency).width
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width - cx - 2, WLH, value, 2)
self.contents.font.color = system_color
self.contents.draw_text(x, y, width, WLH, @currency, 2)
end
end

class Window_Gold
alias _excbshop_refresh refresh unless $@
#--------------------------------------------------------------------------
# * Refresh (Definition added)
#--------------------------------------------------------------------------
def refresh
_excbshop_refresh
if $game_switches[EXCMD_BTRSHOP_SID]
self.contents.clear
value = gold? ? $game_party.gold : $game_party.barter_item_number
draw_currency_value(value, 4, 0, 120)
end
end
end

class Window_ShopBuy
alias _excbshop_refresh refresh unless $@
alias _excbshop_draw_item draw_item unless $@
#--------------------------------------------------------------------------
# * Refresh (Definition added)
#--------------------------------------------------------------------------
def refresh
unless $game_switches[EXCMD_BTRSHOP_SID]
_excbshop_refresh
else
@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 and item != $game_party.barter_item # No exchange items
@data.push(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item (Definition added)
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
unless $game_switches[EXCMD_BTRSHOP_SID]
_excbshop_draw_item(index)
else
item = @data[index]
number = $game_party.item_number(item)
barter_number = $game_party.barter_item_number
barter_rate = $game_party.barter_rate(item)
enabled = (barter_rate <= barter_number and number < 99)
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
self.contents.draw_text(rect, barter_rate, 2)
end
end
end

class Scene_Shop
alias _excbshop_start start unless $@
alias _excbshop_terminate terminate unless $@
alias _excbshop_create_command_window create_command_window unless $@
alias _excbshop_update_command_selection update_command_selection unless $@
alias _excbshop_update_buy_selection update_buy_selection unless $@
alias _excbshop_update_sell_selection update_sell_selection unless $@
alias _excbshop_decide_number_input decide_number_input unless $@
#--------------------------------------------------------------------------
# * Determine if this is an Exchange Shop
#--------------------------------------------------------------------------
def barter?
return $game_switches[EXCMD_BTRSHOP_SID]
end
#--------------------------------------------------------------------------
# * Start processing (Redefined)
#--------------------------------------------------------------------------
def start
_excbshop_start
if barter?
@gold_window.currency = EXCMD_BTRSHOP_ITEM[1]
@number_window.currency = EXCMD_BTRSHOP_ITEM[1]
@gold_window.refresh
end
end
#--------------------------------------------------------------------------
# * Termination Processing (Definition added)
#--------------------------------------------------------------------------
def terminate
_excbshop_terminate
$game_switches[EXCMD_BTRSHOP_SID] = false
end
#--------------------------------------------------------------------------
# * Create Command Window (Definition added)
#--------------------------------------------------------------------------
def create_command_window
unless barter?
_excbshop_create_command_window
else
s1 = EXCMD_BTRSHOP_VOCAB[0]
s2 = EXCMD_BTRSHOP_VOCAB[1]
s3 = EXCMD_BTRSHOP_VOCAB[2]
@command_window = Window_Command.new(384, [s1, s2, s3], 3)
@command_window.y = 56
if $game_temp.shop_purchase_only
@command_window.draw_item(1, false)
end
end
end
#--------------------------------------------------------------------------
# * Update Command Selection (Definition added)
#--------------------------------------------------------------------------
def update_command_selection
_excbshop_update_command_selection
if Input.trigger?(Input::C) and barter?
unless $game_temp.shop_purchase_only
if @command_window.index == 1 # 売却する
@gold_window.currency = Vocab::gold
@number_window.currency = Vocab::gold
@gold_window.refresh
end
end
end
end
#--------------------------------------------------------------------------
# * Update Buy Item Selection (Definition added)
#--------------------------------------------------------------------------
def update_buy_selection
unless barter?
_excbshop_update_buy_selection
else
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
barter_number = $game_party.barter_item_number
barter_rate = $game_party.barter_rate(@item)
number = $game_party.item_number(@item)
if @item == nil or barter_rate > barter_number or number == 99
Sound.play_buzzer
else
Sound.play_decision
max = barter_number / barter_rate
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, barter_rate)
@number_window.active = true
@number_window.visible = true
end
end
end
end
#--------------------------------------------------------------------------
# * Update Sell Item Selection (Definition added)
#--------------------------------------------------------------------------
def update_sell_selection
_excbshop_update_sell_selection
if Input.trigger?(Input::B) and barter?
@gold_window.currency = EXCMD_BTRSHOP_ITEM[1]
@number_window.currency = EXCMD_BTRSHOP_ITEM[1]
@gold_window.refresh
end
end
#--------------------------------------------------------------------------
# * Confirm Number Input (Definition added)
#--------------------------------------------------------------------------
def decide_number_input
unless barter?
_excbshop_decide_number_input
else
Sound.play_shop
@number_window.active = false
@number_window.visible = false
barter_rate = $game_party.barter_rate(@item)
number = @number_window.number
case @command_window.index
when 0 # Buy (Exchange)
$game_party.lose_item($game_party.barter_item, number * barter_rate)
$game_party.gain_item(@item, number)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@buy_window.active = true
@buy_window.visible = true
when 1 # Sell
$game_party.gain_gold(number * (@item.price / 2))
$game_party.lose_item(@item, number)
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
end
end
end


Les explico a los ignorantes del ingles que se hace:

En el renglon 12, donde dice XCMD_BTRSHOP_SID = X NUMERO, en donde dice X NUMERO poner el numero del interruptor que activa la tienda especial. Sin este interruptor, la tienda va a ser normal, con "plata normal".

En el renglon 16: EXCMD_BTRSHOP_VOCAB = ["X", "Y", "Z"], los valores X,Y y Z son compra, venta y salir, respectivamente, pone lo que creas coherente para cada acto.

Aca se pone un poco mas heavy la cosa: en el renglon 24, donde:
EXCMD_BTRSHOP_ITEM = [999, "Monedas especiales", 50], los valores corresponden a:
999: es el ID del item que se usa como moneda. En mi caso y para no mezclarlo, lo mande al 999.
Monedas especiales: es el nombre de los creditos que se usan, en mi caso, como el item 999 se llama asi, le puse de la misma manera, para no prestarse a la confusion.
Y por ultimo, presten atencion aca: 50 es el numero de cambio. What!? si, eso, funciona asi:
precio original (ej.: espada ancha= 500) % numero de cambio (en este caso, 50). Entonces, la espada costara 10 monedas especiales, puesto que 500/50= 10. Se entiende? El que no, mp y se lo explico mas graficamente xD.

En el renglon 29, donde:
EXCMD_BTRSHOP_SIGNATURE = "*BARTER_RATE"
Esto es (creo): "Barter_Rate" = notebox (que supongo es comentario) que se tiene que poner en ciertos items para que tengan un numero de cambio especial.

En el renglon 35, donde:
EXCMD_BTRSHOP_VID = 11
El 11 es el ID de la variable del shop.

Y esto? al designar los ID's, se puede hacer algo como esto:
BARTER_RATE[20], donde 20 es el numero de cambio del objeto.
BARTER_RATE[1:20|2:15|3:25], siendo que tal objeto en el shop 1 cueste 20, en el 2 15 y en el 3, 25.
*BARTER_RATE[20][2:10|3:15], el objeto tiene un numero de cambio de 20 en general, y las ecepciones son en el shop 2, donde sale 10, y en el 3, donde sale 15.
Entonces, los numeros son: [X=numero de shop o tienda|Y= numero de cambio].

El evento que se tiene que hacer para designar tiendas especiales es:
1). hacer los numeros de cambio individuales por cada item si se requiere.
2). Control Switches: [EXCMD_BTRSHOP_SID] = ON
Control Variables: [EXCMD_BTRSHOP_VID] = ID de tienda especial
Tienda: ...

AHORA, el que alla entendido, expliqueme como hago objetos especiales xD. Fuera de joda, el que tenga la posibilidad expliquelo mejor, por que es un cago de hambre esto sino. Igual, todo este quilombo sirve solo si queres objetos con distinto numero de cambio (que vendrian a ser como acciones de empresas), sino es como medio al pedo.
Ah, otra cosa, si alguien conoce o hizo o lo que sea un script para mas de 99 items del mismo tipo, le agradeceria bastante que me lo pase, puesto que implicaria mas de 99 "monedas especiales".
Ahora si me voy, saludos n.n.

PD: el que quiera putearme por mi explicacion que mas que explicacion es un interruptor para la confusion, hagalo, esta en su derecho xD.

Shirono
Principiante
Principiante

0/3

Créditos 445


Volver arriba Ir abajo

RPG Maker VX Re: [RPGVX] Tiendas especiales

Mensaje por 4ngel el Lun Oct 04, 2010 11:20 pm

Bueno, ante todo, se agradece el aporte. Baila

Pero (siempre existe un pero XD), veo mas sencillo hacer esto mediante engines, ya que tener que hacer todo ese lio para camabiar X objetos por otros... nose, lo veo demasiado xD

y bueno... algo que cualquiera podria hacer, traductor online :

Spoiler:

# El identificador del interruptor para permitir que las casa de cambio.
# Cuando se establece en ON, [Tienda de la tramitación] reemplazará a la tienda de periódicos con la tienda de cambio
# (&quot;Compra sólo&quot; también está disponible aquí). Este interruptor se enciende
# apaga automáticamente después de que el jugador está acabado de hacer compras. EXCMD_BTRSHOP_SID = 999

# Cambio de mando nombres tienda:.
# De izquierda a derecha [Comprar] [Venta] [Terminado] EXCMD_BTRSHOP_VOCAB = [&quot;Comprar&quot;, &quot;Vender&quot;, &quot;El Terminado&quot;]
# El intercambio &quot;elemento&quot; utilizado por la tienda de cambio
#. Especifique la unidad que represente la tienda &quot;créditos&quot; aquí.
# El formato es [Item ID, término de &quot;créditos&quot;, tipo de cambio] del artículo
# precio = precio ÷ original tipo de cambio, redondeado a 1.
# (Ejemplo) Si el tipo de cambio es de 100 , y 1650 g costos de los componentes normalmente, # tendrán que intercambiar 17 &quot;créditos&quot; (100G cada uno) para obtener el punto. EXCMD_BTRSHOP_ITEM = [999, &quot;Monedas especiales&quot;, 50]

* Notebox ensarta el identificador para especificar la tasa de cambio de un producto.
* Los artículos sin esta designación usarán la tasa de cambio de falta encima.
* (Para más información, mirar debajo)
EXCMD_BTRSHOP_SIGNATURE = "*BARTER_RATE"

* El ID de la variable que almacenará el número de identificación de tienda.
* Cuando un ID es asignado a esta variable, [el Tratamiento de Tienda] se adaptará el
* juego de tasa de cambio por artículo, por tienda. Estos camino, es posible para lo mismo
* artículo para tener tarifas separadas en cada tienda. (Para más información, mirar debajo)
EXCMD_BTRSHOP_VID = 11

* * Ajuste de la tasa de cambio de artículos:
* El formato es " EXCMD_BTRSHOP_SIGNATURE [la tasa de cambio] [la tienda ID: tasa de cambio] "
* "|" interpreta como un separador para cada tienda ID - el apareamiento de tasa de cambio.
* (El ejemplo 1) *BARTER_RATE [20] => la tasa de cambio del artículo es 20.
* (El ejemplo 2) *BARTER_RATE [1:20|2:15|3:25] => la tasa de cambio del artículo es
* 20 en tienda 1, 15 en tienda 2, y 25 en tienda 3
* (El ejemplo 3) *BARTER_RATE [20] [2:10|3:15] => la tasa de cambio del artículo es
* 10 en tienda 2, 15 en tienda 3, y 20 en otra parte.
*
* La prioridad es puesta así: tienda ID tarifa> tarifa de artículo> tarifa de tienda de falta

* * procedimiento de Acontecimiento para crear la tienda de cambio:
* 1) Juego la tasa de cambio para artículos individuales, si fuera necesario.
* 2) Para crear una tienda de cambio, controle las operaciones siguientes:
* * Interruptores de Control: [EXCMD_BTRSHOP_SID] = SOBRE
* * Variables de Control: [EXCMD_BTRSHOP_VID] = cambian la tienda ID (de ser usado)
* * [la Tienda que Procesa ...] (seleccione artículos)



Enfin, fail translate, pero mejor que nada...

Un Saludo.

4ngel
Principiante
Principiante

0/3

Créditos 328


Volver arriba Ir abajo

RPG Maker VX Re: [RPGVX] Tiendas especiales

Mensaje por Dangaioh el Lun Oct 04, 2010 11:56 pm

no puedo estar mas de acuerdo con angel,con un "simple condiones" lo tines
aun así se agradece y mucho el aporte y que compartas
muchas gracias sigue así compi

_________________




Dangaioh
Moderador
Moderador



Créditos 4569


Volver arriba Ir abajo

RPG Maker VX Re: [RPGVX] Tiendas especiales

Mensaje por orochii el Mar Oct 05, 2010 1:41 am

Seh, engines, blablabla, total si se puede hacer :P.
Pero igual, a mi me parece un script bastante interesante. Talvez se haga "medio complicado" empezarlo a usar pero al final se hace más efectivo que una tienda por engines.
Igual, las dos cosas son posibles, así que cualquiera de las dos opciones me parece igual :DDD (comentario estúpidamente estúpido xD).

Bueno, yo no sé, iré a comer sandwiches, excelente aporte y felicitaciones al scripter por el script,
Orochii Zouveleki

orochii
Aventurero
Aventurero

0/3

Créditos 2766


http://orochii.xtreemhost.cc/

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


 :: RPG Maker :: Scripts

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