As requested by Gnarizard:
the Dynamic Shop System (http://rmrk.net/index.php/topic,32876.0.html)
- shops stock items in limited quantities
- within defined timeperiods those quantities will rise or fall randomly
- special bonus items can be stocked randomly over time, when entering the shop or with a script-command
- now, epic items can be stocked. only one of those items will stock, when entering the shop for the first time, but if once bought it won't be stocked again.
- usable with the normal shop-command in events
- all adjustments, that have to be done are in the constants in the first lines
before using the shop-comand, you should set the in the script defined global variable to a shop-specific value, so that the script knows which shop is entered.
E.g. 1 for the shop in the first village, 2 for the smith in the first village, 3 for the shop in the second village,...
This script also uses my Header (http://rmrk.net/index.php/topic,39523.0.html), so make sure, you use it ;-)
[spoiler]
################################################################################
# #
# Tidloc's Dynamic Shop System v. 1.3 #
# by the request of Gnarizard #
# (http://rmrk.net/index.php/topic,32876.0.html) #
#------------------------------------------------------------------------------#
# This shop enables the following features: #
# -> Stocks items in Quantities #
# -> randomly gaining or loosing stock as time passes #
# -> Occasionally stocking a bonus (substantially more rare) item for sale #
# -> Items you sell become their stock #
#------------------------------------------------------------------------------#
# simply use the normal shop command of the Events to use this custom shop #
# for the calculation of bonus items use the last constants or call the #
# script Scene_Shop.bonus #
#------------------------------------------------------------------------------#
# Describing the defined constants: #
# DSHOP_SHOPVAR ... the global variable-id in which the shop number #
# is saved befor entering a shop #
# DSHOP_MAXGAIN ... Maximum gain every timestep [item,weap,armor] #
# DSHOP_TIMESTEP .. Minutes that have to pass to gain/loose stock #
# in ths shops #
# DSHOP_MINSTART .. Minimum start quantity of a single item #
# DSHOP_MAXSTART .. Maximum start quantity of a single item #
# DSHOP_WINDOW .... if a special windowskin shall be used enter here #
# it's name #
# DSHOP_ZERO ...... this boolean constant define wheter items with #
# no cost shall be displayed. #
# DSHOP_PROP ...... how high is the propability of getting a high #
# value item (out of 10'000) #
# DSHOP_CALCTIME .. bonus item calculation everytime the itemgain is #
# calculatated #
# DSHOP_CALCCALL .. bonus item calculation everytime the specific #
# shop is called #
# DSHOP_SPECIALS .. set in a set of 3 variables: [a,b,c} #
# a ... 1=item, 2=weapon, 3=armor #
# b ... ingame item-id #
# c ... an array of in which shops it shall be #
# available #
# DSHOP_EPIC ...... same as SPECIALS above, just that only one shop #
# may be entered in c. #
################################################################################
# As requested by Mr_Wiggles this script now differs normal items, weapons and #
# armors. #
# Simply with the MAXGAIN, MINSTART and MAXSTART use the following syntax: #
# ... = [item, weapon, armor] #
################################################################################
# You may us this script in any of your games, #
# but please credit me for this hell of work ^^ #
################################################################################
module Tidloc
D_Shop = true
DSHOP_SHOPVAR = 5
DSHOP_MAXGAIN = [5,2,2]
DSHOP_TIMESTEP = 1
DSHOP_MINSTART = [5,1,1]
DSHOP_MAXSTART = [35,4,4]
DSHOP_WINDOW = nil
DSHOP_ZERO = true
DSHOP_PROP = 1000
DSHOP_CALCTIME = false
DSHOP_CALCCALL = true
DSHOP_SPECIALS = [ [ 0,17,[1]],
[ 1, 4,[1,2]] ]
DSHOP_EPIC = [ [ 0, 31, 1] ]
if Language == "ger"
DSHOP_VOCAB = ["Kaufen","Verkaufen","Sonderangebote","Fertig"]
elsif Language == "eng"
DSHOP_VOCAB = ["Regular Items","Sell Items","Special Offers","Leave"]
end
end
# for storing the quantities of a shop
class Game_System
attr_accessor :tidloc_dshop
attr_accessor :tidloc_dshop_count
alias tidloc_dshop_init initialize
def initialize
tidloc_dshop_init
self.tidloc_dshop = []
self.tidloc_dshop_count = 0
end
def tidloc_dshop_add_shop(id)
if !tidloc_dshop_exist?(id)
self.tidloc_dshop.push Tidloc_D_Shop.new(id)
self.tidloc_dshop_count += 1
return true
end
return false
end
def tidloc_dshop_exist?(id)
for i in 0...self.tidloc_dshop_count
return i if self.tidloc_dshop[i]._id == id
end
return false
end
def tidloc_dshop_start_item(shop,item)
shopnum = tidloc_dshop_exist?(shop)
if !tidloc_dshop_item?(shop,item)
if !Tidloc::DSHOP_ZERO
if itme[0]==0
return false if $data_items[item[1]].price == 0
elsif item[0]==1
return false if $data_weapons[item[1]].price == 0
elsif item[0]==2
return false if $data_armors[item[1]].price == 0
end
end
delta=Tidloc::DSHOP_MAXSTART[item[0]]-Tidloc::DSHOP_MINSTART[item[0]]
self.tidloc_dshop[shopnum].items.push item
#------------- first time stocking:
self.tidloc_dshop[shopnum].stock.push (Tidloc::DSHOP_MINSTART[item[0]]+rand(delta/2)+rand(delta/2))
self.tidloc_dshop[shopnum].empty.push false
self.tidloc_dshop[shopnum].bonus.push false
self.tidloc_dshop[shopnum].sold.push false
self.tidloc_dshop[shopnum].count += 1
end
end
def tidloc_dshop_add_item(shop,item,amount)
shopnum = tidloc_dshop_exist?(shop)
id = tidloc_dshop_item?(shop,item)
if id == nil
self.tidloc_dshop[shopnum].items.push item
self.tidloc_dshop[shopnum].stock.push amount
self.tidloc_dshop[shopnum].empty.push false
self.tidloc_dshop[shopnum].bonus.push false
self.tidloc_dshop[shopnum].sold.push true
self.tidloc_dshop[shopnum].count += 1
else
self.tidloc_dshop[shopnum].stock[id] += amount
self.tidloc_dshop[shopnum].empty[id] = false if self.tidloc_dshop[shopnum].stock[id] > 0
end
end
def tidloc_dshop_add_bonus(shop,item)
shopnum = tidloc_dshop_exist?(shop)
id = tidloc_dshop_item?(shop,item)
if id == nil
#it = self.tidloc_dshop[shopnum].newitem(item)
self.tidloc_dshop[shopnum].items.push item
self.tidloc_dshop[shopnum].stock.push 1
self.tidloc_dshop[shopnum].empty.push false
self.tidloc_dshop[shopnum].bonus.push true
self.tidloc_dshop[shopnum].epic.push false
self.tidloc_dshop[shopnum].sold.push false
self.tidloc_dshop[shopnum].count += 1
else
self.tidloc_dshop[shopnum].stock[id] += 1
self.tidloc_dshop[shopnum].empty[id] = false if self.tidloc_dshop[shopnum].stock[id] > 0
end
end
def tidloc_dshop_add_epic(shop, item)
shopnum = tidloc_dshop_exist?(shop)
id = tidloc_dshop_item?(shop,item)
if id == nil
self.tidloc_dshop[shopnum].items.push item
self.tidloc_dshop[shopnum].stock.push 1
self.tidloc_dshop[shopnum].empty.push false
self.tidloc_dshop[shopnum].bonus.push true
self.tidloc_dshop[shopnum].epic.push true
self.tidloc_dshop[shopnum].sold.push false
self.tidloc_dshop[shopnum].count += 1
end
end
def tidloc_dshop_item?(shop,item)
shopnum = tidloc_dshop_exist?(shop)
for i in 0...self.tidloc_dshop[shopnum].count
if self.tidloc_dshop[shopnum].items[i] == item
return i
end
end
return nil
end
end
# the structure of the stored Shopping-goods
class Tidloc_D_Shop
attr_accessor :_id
attr_accessor :items
attr_accessor :stock
attr_accessor :empty
attr_accessor :bonus
attr_accessor :epic
attr_accessor :sold
attr_accessor :count
def initialize(id)
self._id = id
self.items = []
self.stock = []
self.empty = []
self.bonus = []
self.epic = []
self.sold = []
self.count = 0
end
def stocking(item)
for i in 0...self.count
if ((self.items[i][0] == 0 && item.is_a?(RPG::Item)) || (self.items[i][0] == 1 && item.is_a?(RPG::Weapon)) || (self.items[i][0] == 2 && item.is_a?(RPG::Armor)) ) && self.items[i][1] == item.id
return self.stock[i]
end
end
return nil
end
def setstock(item,number)
for i in 0...self.count
if self.items[i]!=nil && ((self.items[i][0] == 0 && item.is_a?(RPG::Item)) || (self.items[i][0] == 1 && item.is_a?(RPG::Weapon)) || (self.items[i][0] == 2 && item.is_a?(RPG::Armor)) ) && self.items[i][1] == item.id
number = 0 if number < 0
self.stock[i] = number
if number == 0
self.empty[i] = true
#if self.bonus[i]
# delete(i)
#end
end
end
end
end
def delete(it)
sh = false
for i in it...self.count
self.items[i] = self.items[i+1]
self.stock[i] = self.stock[i+1]
self.empty[i] = self.empty[i+1]
self.bonus[i] = self.bonus[i+1]
self.sold[i] = self.sold[i+1]
end
self.items[self.count-1] = nil
self.stock[self.count-1] = nil
self.empty[self.count-1] = nil
self.bonus[self.count-1] = nil
self.sold[self.count-1] = nil
self.count -= 1
end
def newitem(item)
k = self.count
for i in 0...self.count
j = (self.count - i) - 1
if item[0] >= self.items[j][0]
if item[1] >= self.items[j][1]
k=j + 1 if k == self.count
end
end
end
for l in 0..(self.count-k)
m = (self.count - l)
self.items[m] = self.items[m-1]
self.stock[m] = self.stock[m-1]
self.empty[m] = self.empty[m-1]
self.bonus[m] = self.bonus[m-1]
self.sold[m] = self.sold[m-1]
end
self.count += 1
return k
end
def Tidloc_D_Shop.New_Item(shop, item)
$game_system.tidloc_dshop_start_item(shop,item)
end
def Tidloc_D_Shop.New_Epic(shop, item)
$game_system.tidloc_dshop_add_epic(shop,item)
end
end
class Window_ShopBuy < Window_Selectable
def initialize(shopnum,bonus=false)
super(0, 128, 368, 352)
@shop = $game_system.tidloc_dshop_exist?(shopnum)
@goods = $game_system.tidloc_dshop[@shop]
@bonus = bonus
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@goods.count
if @goods.items[i]!=nil && (!@bonus && !@goods.bonus[i] && !@goods.empty[i]) || (@bonus && @goods.bonus[i] && !@goods.empty[i])
case @goods.items[i][0]
when 0
item = $data_items[@goods.items[i][1]]
when 1
item = $data_weapons[@goods.items[i][1]]
when 2
item = $data_armors[@goods.items[i][1]]
end
if item != nil
@data.push(item)
end
end
end
@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
def draw_item(index)
item = @data[index]
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 item.price <= $game_party.gold and number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
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, 160, 32, item.name, 0)
self.contents.draw_text(x + 160, y, 88, 32, "x"+$game_system.tidloc_dshop[@shop].stocking(item).to_s, 2)
self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#---------------Scene_Shop
class Scene_Shop
def main
@shopnum = $game_variables.[](Tidloc::DSHOP_SHOPVAR)
if $game_system.tidloc_dshop_add_shop(@shopnum)
@shop = $game_system.tidloc_dshop_exist?(@shopnum)
for i in $game_temp.shop_goods
$game_system.tidloc_dshop_start_item(@shopnum,i)
end
for x in Tidloc::DSHOP_EPIC
y = x[2]
if y == $game_system.tidloc_dshop[@shop]._id
$game_system.tidloc_dshop_add_epic($game_system.tidloc_dshop[@shop]._id,[x[0],x[1]])
end
end
end
@shop = $game_system.tidloc_dshop_exist?(@shopnum)
if Tidloc::DSHOP_CALCCALL
if rand(10000) < Tidloc::DSHOP_PROP
temp = []
a=0
for x in Tidloc::DSHOP_SPECIALS
for y in x[2]
if y == $game_system.tidloc_dshop[@shop]._id
temp.push [x[0],x[1]]
end
end
end
if temp.size > 0
t = rand(temp.length)
$game_system.tidloc_dshop_add_bonus($game_system.tidloc_dshop[@shop]._id,temp[t])
end
end
end
@help_window = Window_Help.new
@gold_window = Window_Gold.new
@gold_window.y = 224
@dummy_window = Window_Base.new(160, 64, 480, 416)
commands = Tidloc::DSHOP_VOCAB
@command_window = Window_Command.new(160, commands)
@command_window.y = 64
@command_window.active = true
@buy_window = Window_ShopBuy.new(@shopnum)
@buy_window.z = 250
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@special_window = Window_ShopBuy.new(@shopnum,true)
@special_window.z = 250
@special_window.active = false
@special_window.visible = false
@special_window.help_window = @help_window
@status_window = Window_ShopStatus.new
@status_window.visible = false
@sell_window = Window_ShopSell.new
@sell_window.z = 250
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new
@number_window.z = 300
@number_window.active = false
@number_window.visible = false
if Tidloc::DSHOP_WINDOW != nil
@help_window.windowskin = Tidloc::DSHOP_WINDOW
@gold_window.windowskin = Tidloc::DSHOP_WINDOW
@dummy_window.windowskin = Tidloc::DSHOP_WINDOW
@command_window.windowskin = Tidloc::DSHOP_WINDOW
@buy_window.windowskin = Tidloc::DSHOP_WINDOW
@status_window.windowskin = Tidloc::DSHOP_WINDOW
@special_window.windowskin = Tidloc::DSHOP_WINDOW
@sell_window.windowskin = Tidloc::DSHOP_WINDOW
@number_window.windowskin = Tidloc::DSHOP_WINDOW
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@number_window.dispose
@sell_window.dispose
@special_window.dispose
@status_window.dispose
@buy_window.dispose
@command_window.dispose
@dummy_window.dispose
@help_window.dispose
@gold_window.dispose
end
def update
@number_window.update
@sell_window.update
@special_window.update
@status_window.update
@buy_window.update
@dummy_window.update
@command_window.update
@gold_window.update
@help_window.update
if @command_window.active
update_command
elsif @buy_window.active
update_buy
elsif @special_window.active
update_special
elsif @sell_window.active
update_sell
elsif @number_window.active
update_number
end
end
def update_command
case @command_window.index
when 0
@help_window.set_text("Buying of the regular stock of the shop")
when 1
@help_window.set_text("Selling items you own")
when 2
@help_window.set_text("Buying rare offers of this shop")
when 3
@help_window.set_text("Leaving shop")
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@buy_window.active = true
@buy_window.visible = true
@status_window.visible = true
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = true
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@special_window.active = true
@special_window.visible = true
@status_window.visible = true
when 3
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
end
def update_buy
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
if @item == nil || @item.price > $game_party.gold
@item = nil
$game_system.se_play($data_system.buzzer_se)
return
end
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 number == 99
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number, $game_system.tidloc_dshop[@shop].stocking(@item)].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
def update_special
@status_window.item = @special_window.item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@special_window.active = false
@special_window.visible = false
@status_window.visible = false
@status_window.item = nil
return
end
if Input.trigger?(Input::C)
@item = @special_window.item
if @item == nil || @item.price > $game_party.gold
@item = nil
$game_system.se_play($data_system.buzzer_se)
return
end
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 number == 99
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number, $game_system.tidloc_dshop[@shop].stocking(@item)].min
@special_window.active = false
@special_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
@special = true
end
end
def update_sell
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @sell_window.item
@status_window.item = @item
if @item == nil or @item.price == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
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
max = number
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
def update_number
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@number_window.active = false
@number_window.visible = false
case @command_window.index
when 0
@buy_window.active = true
@buy_window.visible = true
when 1
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
when 2
@special_window.active = true
@special_window.visible = true
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.shop_se)
@number_window.active = false
@number_window.visible = false
case @command_window.index
when 0
$game_party.lose_gold(@number_window.number * @item.price)
$game_system.tidloc_dshop[@shop].setstock(@item,($game_system.tidloc_dshop[@shop].stocking(@item)-@number_window.number))
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
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@sell_window.refresh
@buy_window.active = true
@buy_window.visible = true
when 1
$game_party.gain_gold(@number_window.number * (@item.price / 2))
it = []
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
it[0]=0
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
it[0]=1
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
it[0]=2
end
it[1]=@item.id
$game_system.tidloc_dshop_add_item(@shopnum,it,@number_window.number)
@gold_window.refresh
@sell_window.refresh
@buy_window.refresh
@status_window.refresh
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
when 2
$game_party.lose_gold(@number_window.number * @item.price)
$game_system.tidloc_dshop[@shop].setstock(@item,($game_system.tidloc_dshop[@shop].stocking(@item)-@number_window.number))
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
@gold_window.refresh
@special_window.refresh
@status_window.refresh
@sell_window.refresh
@special_window.active = true
@special_window.visible = true
end
return
end
end
def Scene_Shop.bonus
for i in 0...$game_system.tidloc_dshop_count
if rand(10000) < Tidloc::DSHOP_PROP
temp = []
a=0
for x in Tidloc::DSHOP_SPECIALS
for y in x[2]
if y == $game_system.tidloc_dshop[i]._id
temp.push [x[0],x[1]]
end
end
end
if temp.size > 0
t = rand(temp.length)
$game_system.tidloc_dshop_add_bonus($game_system.tidloc_dshop[i]._id,temp[t])
end
end
end
end
end
class Scene_Load < Scene_File
alias tidloc_dshop_save_data read_save_data
def read_save_data(file)
tidloc_dshop_save_data(file)
$game_system.tidloc_dshop = [] if $game_system.tidloc_dshop.nil?
$game_system.tidloc_dshop_count = 0 if $game_system.tidloc_dshop_count.nil?
end
end[/spoiler]
To add items or epics to an existing shop use the following syntax within a script command:
Tidloc_D_Shop.New_Item( a ,[ b , c ])
Tidloc_D_Shop.New_Epic( a ,[ b , c ])
where:
a = *shopnumber*
b = *0=item,1=weapon,2=armor*
c = *ingame-id of item*
Paste this Script above main and it will replace the original RMXP shop.
Everything how to adjust the shop is described in the first lines of the script.
If any ideas, comments or troubles with the script, post here and I will see, what I can do ^^
BR
Tidloc
edit: Found some Mistakes ;)edit 141210: added epic items
edit 151210: added the possibility to don't enlist zero-cost items in regular shop and moved the vocabulary to the constants in the first lines. Further, I added this script to my header.
This looks very neat. Good job!
This looks amazing! :o
Thank you VERY very much for this! ;D
If I ever get my game out to the public I'll be sure to credit you. ;)
You're welcome!
I'm coming from the C-part of programming, so this wasn't too much of an effort. ;)
But I'm glad to have helped you and maybe some other people will find this script helpful too ;D
Best regards!
like the script see you got my PM, herd that you updated it, but this doesn't seem to be any diffrent the the old one i have of yours..
As requested by Mr_Wiggles I altered this script a little, so it differs items, weapons and armors in starting stock and gain-quantity ;)
Hope you like it ^^
cool
Hi Tidloc,
First off, this is an awesome script and is going in my game!
However... I'm not quite sure how to use the specials feature. How do you tell the specific shop to stock a special?
I've set up all the specials, but I don't know what code to put before the shop call in an event.
I did read through the instructions, so it's probably me just being dim.
Thanks in advance.
Yeah, no problem!
You see my example right after the header:
TIDLOC_DSHOP_SPECIALS = [ [ 0,17,[1]],
[ 1, 4,[1,2]] ]
everything has to be within [ and ].
Within those you have to enter your special items.
each item in the form of [a,b,c] seperated by comas. ([a1,b1,c1],[a2,b2,c2],[a3,b3,c3],...)
line by line in my example:
item (0) with the number 17 shall be special in shop 1.
weapon (1) with number 4 shall be available in shops 1 and 2.
before the shop-call just set the global variable with the ID of TIDLOC_DSHOP_SHOPVAR to the specific number of the shop. (With the common event-command)
hope it helped. If not PM me ;)
Hey tidloc, I'm not sure if you're on here anymore, but I'm experienceing an error and a glitch in your script. I was wondering if you could help me if you were'nt busy?
Quote from: Sasquatch927 on April 27, 2010, 07:34:14 PM
Hey tidloc, I'm not sure if you're on here anymore, but I'm experienceing an error and a glitch in your script. I was wondering if you could help me if you were'nt busy?
There is other people that can help you (I can't) so post what the problem is and they might be able to help
Oh, thats what I did at first lol. I've already recieved a message from him asking what was wrong with the script, and I've sent him one back already explaining the errors and stuff. If it gets fixed, I'm sure he will update the script here in this thread so others don't experience the same problems I did. Thanks for the suggestion though! =D
So, Version 1.1 is out with all reported errors solved ^^
Quote from: tidloc on April 28, 2010, 12:16:43 PM
So, Version 1.1 is out with all reported errors solved ^^
Awesome, I just inserted the script and everything works out flawlessly. Nice job ^^
He, I know I'm somewhat reviving a topic here but I have some questions about this script, so here they are;
When I setup a bonus item (the default one; number 17 which is seed of live) it doesn't appear in the shop even though the probability is set to 20 000.
Also, is it possible to make one item have a lower maximum quantity then another ? For example; a fisherman should never catch more squid than fish.
My last question is: How long does it take for items to re-appear in a shop, I know you can set the time in minutes in the script, but when i wait one minute the items are not refreshed in the store.
I hope you understand my questions and that i get a quick response. ;)
Thanks, for the interest in my script.
Just in case:
1. when setting the timer to one minute, you have to stay on the map, not in the shop or in menu or anywhere else for one minute.
2. Further have called the shop to be shop #1 where you want to stock the bonus item?
3. Different maximum quantities within items are not available in this version. But in your example you may check this with a script-command befor you call the shop and andjust the quantity as you wish.
4. If an item is out of stock there is also a probaility it may never again come available. Because every timestep it's chosen randomly if it will be stocked again.
hope, this helps.
best regards :)
Wow, thanks for the quick reply, much faster than I expected :P
I made a screen shot of my event so you can see how I set it up.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg693.imageshack.us%2Fimg693%2F3794%2Fscriptscreenie.png&hash=2fa908c7414ba56506b8a20e56d6d6eb1dea13f9)
I did wait on the map on the map one minute and then rechecked, but it din't change the quantity's, however i waited a couple more minutes after that and then it did change the quantity of some items, but only a little bit. :(
Wouldn't it be better if the refresh timer went on also if your in different maps, other wise you go all around the world and you come back to the same town again only to find the same wares in the shop.
And would you mind explaining to me how I can check what quantity is in the store and how to adjust that ? that would really be helpful :)
the event-timer goes on in all maps, just not in other scenes... :(
ok, first: if you want to change these globals, do it within the script, not in a script-command in an event!
second, please rtfm...!
You see the global TIDLOC_DSHOP_SHOPVAR ?
This is the global variable where ou have to set the shop-number.
right befor the 'shop processing'-command delete the script command and enter a 'control variables'-command. There you set the global variable with the ID of TIDLOC_DSHOP_SHOPVAR (in your case 1, so: "0001:") to the shop-number. You should use 1 for this shop and the bonus item will appear.
to gain the quantity of an item use the following commands: (please, only do this, if you at least have some knowledge of programming/scripting)
i = $game_system.tidloc_dshop_exist?(*id*)
stock = $game_system.tidloc_dshop.stocking([*a*,*b*])
to change a quantity:
i = $game_system.tidloc_dshop_exist?(*id*)
$game_system.tidloc_dshop.setstock([*a*,*b*],*c*)
*id* is the shop-number, in your case 1!
*a* means item, weapon or armor and *b* is the item-ID and *c* is the new quantity.
You may use stock for comparison with another or so on...
hope, this answered everything now...
Oh I see, I mis understood the variable thing, i thought you meant i had to set the variable in the script since scripts also use variables.
Also, thanks for explaining how to check.change a quantity, it helped a lot :)
thanks for your patience and support :D
If I have any other questions I'll be sure to post them here.
Ok, sorry to bother you again but I made myself a nice little problem :)
I have this in my event;
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg828.imageshack.us%2Fimg828%2F3794%2Fscriptscreenie.png&hash=b6389a8593df16474f70db5db059b3ed48941e42)
but when I interact with the event, I cant move anymore or do anything else...
Dark aura is item number 36 in the database.
ok, first you have to put all script command within one script-call.
then because you don't compare stock to anything, you may leave out the second command.
If it still doesn't work PM me.
If it's easier fou you - i saw you're from the netherlands - I speak german.