Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
I am looking for a script that somewhat turns a Shop into an Auction House, here's how it would function

10 Specific items will be selected by chance from the script(ItemList) and sold at a % Rate of original price, each time you enter/exit this shop the 10 items will vary as will tier prices.

For example inside the script it would look something like this:

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

Auction House items go here

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

When AuctionHouseOpen Then pick items

P25(item1)$100-500%

P8(weapon2)$250-600%

#and so on

end

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

I know that example is the farthest thing from real script but allow me to further explain:

P: Probability- the chance the item has to be placed in the shop: Weapon 2 Has 8/33 Chance of being placed in the shop-- Probability/Total Probability

(itemX)- self explanatory, the item weapon or armor that can be added to the auction house

$- The integer of the purchase value of the current item: lets say weapon 2 has a base price of 100G and the script randomised 275% the item would sell for 275G

it would be great to have this script unaffect other shops/pricing such as a switch on/off

also this script might be helpful with the creation of this auction house script:

http://galvs-scripts.com/galvs-pawn-shop/

~Thanks
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,935
Reaction score
15,990
First Language
English
Primarily Uses
RMMV
If you could normally buy it for 100G, why would you want to buy it at auction for 275G?  Auctions are usually places people go to get a good deal.
 

Zetu

Level 99 Stabomancer
Veteran
Joined
Apr 28, 2012
Messages
247
Reaction score
99
First Language
English
Primarily Uses
N/A
I'm still working on it, since there are some functional changes I have to make, but is your request something like...?

# Put AUCTION in a comment prior to Shop Processing Event# <auction chance (\d+)> for chance of item being auctioned# <auction range (\d+) (\d+)> for percentage difference in each itemclass Game_Interpreter alias :zev_reqkillok_command_302 :command_302 def command_302 x = @index $game_temp.auction = false while (x -= 1) >= 0 and (@list[x].code == 108 or @list[x].code == 108) if @list[x].parameters[0] =~ /AUCTION/i $game_temp.auction = true break end end zev_reqkillok_command_302 end endclass Game_Temp attr_accessor :auctionendclass Window_ShopBuy < Window_Selectable def make_item_list @data = [] @price = {} @shop_goods.each do |goods| case goods[0] when 0; item = $data_items[goods[1]] when 1; item = $data_weapons[goods[1]] when 2; item = $data_armors[goods[1]] end if item and check_pi_for_avalibility(item) @data.push(item) @price[item] = goods[2] == 0 ? get_item_price(item) : goods[3] end end end def check_pi_for_avalibility(item) return true unless $game_temp.auction if item.note =~ /<auction chance (\d+)>/i return rand * 100.0 <= $1.to_f else return true end end def get_item_price(item) if $game_temp.auction if item.note =~ /<auction range (\d+) (\d+)>/i r1 = $1.to_f r2 = $2.to_f dif = (r1 - r2).abs return ((rand(dif + 1) + [r1, r2].min) * item.price / 100).to_i else return item.price end else return item.price end end end
I'll finish it once you confirm that this is what you need.
 
Last edited by a moderator:

Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
@Shaz Rare items that arnt typically found in shops, but from monster drops are normally found at acution houses for an exaggerated price

@Zetu I cant seem to get your script to work, I am a little confused on how to get it to function

Currently I have the script pasted under matireals

I have set up an event with AUCTION as a comment then a general shop processing with one item in it as the event.

I have three Items with the note tags

<auction chance (\d+)>
<auction range (\d+) (\d+)>

as specified, however I did not change the \d as i am not sure if i should.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
@killok The notetag <auction chance (\d+)> should be something like <auction chance 5> for example. And the one for range should be something like

<auction range 5 10>.

(\d+) checks for a number in a Regexp. :)
 

Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
@Sarlecc Thank you!

I got It working! 

The auction range system is perfect and chance system is perfect

However there is one problem I have come across

The shop can be exited and re entered quickly to easily get the desired price/Item

For Example with the current system lets say

Health Potion: <auction chance 100> <auction range 10 1000>

Ultimate Sword: <auction chance 1> <auction range 100 150>

I can repeatedly press X and Space in shop to reload the prices and occurrence of the items in the shop this is a problem because it becomes less a matter of chance and more a matter of how fast I can button mash to get the right item or price of item

Health potions will be easy to get at thier cheapest price, as opposed to how they are supposed to be random.

Ultimate Swords are common to get as opposed to them being rare to find via auction.

I reccomend tying the chances and ranges to a Switch,

While on, the next auction shop opened will update the contained items, and prices of those items.

while off, the same chosen items will be shown at the same prices untill the switch turns on again.

In addition to this if it is possible to make an item have an auction amount, then disabling it from purchase untill the auction house updates (Switch Turns On) to give it a more MMO auction house style feel.

EX:

Health Potion: <auction chance 100> <auction range 10 1000>[SIZE=14.4444446563721px]<auction limit  1 5>[/SIZE]

[SIZE=14.4444446563721px]Ultimate Sword: [/SIZE]<auction chance 1> <auction range 100 150><auction limit  1 1>

This means the user will be able to buy up to 5 Health potions at random price for the duration of the OFF SWITCH, then the user may not buy any more (it is removed/disabled from the auction shop)

once the switch is turned back on the auction house is Re-Randomised allowing the user to buy the following throughout the duration

1-3 Health Potions 

[SIZE=14.4444446563721px]1 Ultimate Sword[/SIZE]

[SIZE=14.4444446563721px]Further Example:[/SIZE]

Switch 150 ON

AH Opened

Switch 150 OFF

Auction House 1

x2 Health Potions 14G

AH Closed

[120 Seconds passes] (Ideally I would like this to work off a timer but Im not sure if thats possible so I may be able to event it another way through map change)

SWITCH 150 ON

AH Opened

Switch 150 OFF

Auction House 2

x5 Health Potions

x1 Ultimate Sword

and so on...
 
Last edited by a moderator:

Zetu

Level 99 Stabomancer
Veteran
Joined
Apr 28, 2012
Messages
247
Reaction score
99
First Language
English
Primarily Uses
N/A
The shop can be exited and re entered quickly to easily get the desired price/Item
That was the main reason I said it was incomplete. With the addition of the changes you have posted above, I should have it by tomorrow. I'll post to let you know.
 

Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
Looking forward to it :) )
 

Zetu

Level 99 Stabomancer
Veteran
Joined
Apr 28, 2012
Messages
247
Reaction score
99
First Language
English
Primarily Uses
N/A
Alright, I've made a working copy. I used quite a few dependencies from my base module, so DL it here...
http://pastebin.com/raw.php?i=6xk3FaLm
Then, here's your script.
 

Code:
# * Regex# Auction Chance: <auction chance (\d+)># Auction Price Range % <auction range (\d+) (\d+)># Auction Limit <auction limit (\d+) (\d+)># * Script Calls# $zetu_auction.activate_auction(id)# Use a Different id for each unique auction house, prior to shop processing# $zetu_auction.clear_auction(id)# Clears an auction, so that next time it is activated, a different randomization occurs# $zetu_auction.houses[id].set_timer(seconds, symbol)# Sets a timer that runs on the map, while Interpreter is not running.# Note, symbol can be a string ("active") or symbol (:active)# $zetu_auction.houses[id].time_left(symbol)# Returns a number of seconds left before timer is finished.# ex. "$game_variables[5] = $zetu_auction.houses[id].time_left(symbol)" will put seconds left in variable 5# $zetu_auction.houses[id].timed_out?(symbol)# Returns true/false, on if the timer has become 0# ex1. "$game_switches[5] = $zetu_auction.houses[id].timed_out?(symbol)" will put the condition in switch 5# ex2. On Conditional Branch, use Script: $zetu_auction.houses[id].timed_out?(symbol)module ZEV  module AuctionHouse       SwitchesToHoldAuctions = [21]       module Regex      AuctionChance = /<auction chance (\d+)>/i      AuctionRange  = /<auction range (\d+) (\d+)>/i      AuctionLimit  = /<auction limit (\d+) (\d+)>/i    end     end  if !Imported    msgbox 'One or More Scripts Require Zetu Engine V'    exit  end  puts 'LOAD: Zetu Engine V - Auction House'  Imported[:auction] = true  GameObjects[:auction] = ['$zetu_auction', 'ZEV::Game_Auctions']endclass ZEV::Game_Auctions  attr_reader :houses   def initialize    @houses = ZEV::Houses.new    @active = nil  end   def update    unless $game_map.interpreter.running?      @houses.values.each do |auction|        auction.timer.each do |symbol, time|          if time > 0            auction.timer[symbol] -= 1          end        end      end    end  end   def activate_auction(id)    @active = id  end   def clear_auction(id)    @houses[id].reset    @active = nil  end   def close_auction    @active = nil  end   def active_auction    @houses[@active]  end endclass ZEV::Houses   def initialize    @data = {}  end   def [](id)    @data[id] = ZEV::Game_Auction.new unless @data[id]    @data[id]  end   def values    @data.values  end endclass ZEV::Game_Auction  attr_accessor :data, :price, :qty  attr_reader :active, :timer  def initialize    reset    @timer = {}  end   def reset    @active = false    @data = []    @price = {}    @qty = {}  end   def active?    @active  end   def activate    @active = true  end   def set_timer(seconds, symbol)    @timer[symbol] = seconds * Graphics.frame_rate  end   def timed_out?(symbol)    (@timer[symbol] || 0) <= 0  end   def time_left(symbol)    (@timer[symbol] || 0) / Graphics.frame_rate  end endclass Window_ShopBuy < Window_Selectable  attr_reader :auction, :qty, :data   alias :zev_auction_make_item_list :make_item_list  def make_item_list    @auction = $zetu_auction.active_auction    if @auction      if @auction.active?        @data  = @auction.data        @price = @auction.price        @qty   = @auction.qty      else        @auction.activate        @data = []        @price = {}        @qty = {}        @shop_goods.each do |goods|          case goods[0]          when 0;  item = $data_items[goods[1]]          when 1;  item = $data_weapons[goods[1]]          when 2;  item = $data_armors[goods[1]]          end          if item and check_pi_for_auction_avalibility(item)            @data.push(item)            @price[item] = goods[2] == 0 ? get_item_auction_price(item) : goods[3]            q = get_item_auction_qty(item)            @qty[item] = q if q != -1          end        end        @auction.data  = @data        @auction.price = @price        @auction.qty   = @qty      end    else      zev_auction_make_item_list    end  end   def check_pi_for_auction_avalibility(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionChance      return rand * 100.0 < $1.to_f    else      return true    end  end   def get_item_auction_price(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionRange      r1  = $1.to_f      r2  = $2.to_f      dif = (r1 - r2).abs      return ((rand(dif + 1) + [r1, r2].min) * item.price / 100).to_i    else      return item.price    end  end   def get_item_auction_qty(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionLimit      r1  = $1.to_f      r2  = $2.to_f      dif = (r1 - r2).abs      return (rand(dif + 1) + [r1, r2].min).to_i    else      return -1    end  end endclass Scene_Shop < Scene_MenuBase   alias :zev_auction_max_buy :max_buy  def max_buy    if @buy_window.auction      max = $game_party.max_item_number(@item) - $game_party.item_number(@item)      buying_price == 0 ? max : [max, money / buying_price].min      return [max, @buy_window.qty[@item] || 99].min.to_i    else      return zev_auction_max_buy    end  end   alias :zev_auction_do_buy :do_buy  def do_buy(number)    zev_auction_do_buy(number)    auction = @buy_window.auction    if auction      if auction.qty[@item] and @buy_window.qty[@item]        auction.qty[@item] -= number        if auction.qty[@item] == 0          auction.data.delete(@item)        end      end    end  end   def return_scene    super    $zetu_auction.close_auction  end endclass Window_ShopStatus < Window_Base   def refresh    contents.clear    draw_possession(4, 0)    draw_equip_info(4, line_height * 2) if @item.is_a?(RPG::EquipItem)    auction = $zetu_auction.active_auction    if auction      draw_auction(4, line_height, auction)    end  end   def draw_auction(x, y, auction)    rect = Rect.new(x, y, contents.width - 4 - x, line_height)    change_color(system_color)    draw_text(rect, "Amount Left")    change_color(normal_color)    draw_text(rect, auction.qty[@item] || 99, 2)  end endclass Scene_Map < Scene_Base   alias :zev_auction_update :update  def update    zev_auction_update    $zetu_auction.update  end end
 
Last edited by a moderator:

Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
I am getting game interpreter errors when using the conditional branch script, can you please further explain how to use the timer script functions?
 

Zetu

Level 99 Stabomancer
Veteran
Joined
Apr 28, 2012
Messages
247
Reaction score
99
First Language
English
Primarily Uses
N/A
I just realized a few bug that I had to fix. I edited and reuploaded it on the above post. If your still getting errors, give me a screenshot of your event.
 

Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
works phenomonally, is there any way to change the sell value of inventory items as well?
 
Last edited by a moderator:

Zetu

Level 99 Stabomancer
Veteran
Joined
Apr 28, 2012
Messages
247
Reaction score
99
First Language
English
Primarily Uses
N/A
Something like this?

Code:
# * Regex# Auction Chance: <auction chance (\d+)># Auction Buy Price Range %: <auction range (\d+) (\d+)># Auction Sell Price Range %: <auction sell (\d+) (\d+)># Auction Limit: <auction limit (\d+) (\d+)># * Script Calls# $zetu_auction.activate_auction(id)# Use a Different id for each unique auction house, prior to shop processing# $zetu_auction.clear_auction(id)# Clears an auction, so that next time it is activated, a different randomization occurs# $zetu_auction.houses[id].set_timer(seconds, symbol)# Sets a timer that runs on the map, while Interpreter is not running.# Note, symbol can be a string ("active") or symbol (:active)# $zetu_auction.houses[id].time_left(symbol)# Returns a number of seconds left before timer is finished.# ex. "$game_variables[5] = $zetu_auction.houses[id].time_left(symbol)" will put seconds left in variable 5# $zetu_auction.houses[id].timed_out?(symbol)# Returns true/false, on if the timer has become 0# ex1. "$game_switches[5] = $zetu_auction.houses[id].timed_out?(symbol)" will put the condition in switch 5# ex2. On Conditional Branch, use Script: $zetu_auction.houses[id].timed_out?(symbol)module ZEV  module AuctionHouse       SwitchesToHoldAuctions = [21]       module Regex      AuctionChance = /<auction chance (\d+)>/i      AuctionRange  = /<auction range (\d+) (\d+)>/i      AuctionSell   = /<auction sell (\d+) (\d+)>/i      AuctionLimit  = /<auction limit (\d+) (\d+)>/i    end     end  if !Imported    msgbox 'One or More Scripts Require Zetu Engine V'    exit  end  puts 'LOAD: Zetu Engine V - Auction House'  Imported[:auction] = true  GameObjects[:auction] = ['$zetu_auction', 'ZEV::Game_Auctions']endclass ZEV::Game_Auctions  attr_reader :houses   def initialize    @houses = ZEV::Houses.new    @active = nil  end   def update    unless $game_map.interpreter.running?      @houses.values.each do |auction|        auction.timer.each do |symbol, time|          if time > 0            auction.timer[symbol] -= 1          end        end      end    end  end   def activate_auction(id)    @active = id  end   def clear_auction(id)    @houses[id].reset    @active = nil  end   def close_auction    @active = nil  end   def active_auction    @houses[@active]  end endclass ZEV::Houses   def initialize    @data = {}  end   def [](id)    @data[id] = ZEV::Game_Auction.new unless @data[id]    @data[id]  end   def values    @data.values  end endclass ZEV::Game_Auction  attr_accessor :data, :price, :qty, :sell  attr_reader :active, :timer  def initialize    reset    @timer = {}  end   def reset    @active = false    @data   = []    @price  = {}    @qty    = {}    @sell   = {}  end   def active?    @active  end   def activate    @active = true  end   def set_timer(seconds, symbol)    @timer[symbol] = seconds * Graphics.frame_rate  end   def timed_out?(symbol)    (@timer[symbol] || 0) <= 0  end   def time_left(symbol)    (@timer[symbol] || 0) / Graphics.frame_rate  end endclass Window_ShopBuy < Window_Selectable  attr_reader :auction, :qty, :data   alias :zev_auction_make_item_list :make_item_list  def make_item_list    @auction = $zetu_auction.active_auction    if @auction      if @auction.active?        @data  = @auction.data        @price = @auction.price        @qty   = @auction.qty      else        @auction.activate        @data = []        @price = {}        @qty = {}        @shop_goods.each do |goods|          case goods[0]          when 0;  item = $data_items[goods[1]]          when 1;  item = $data_weapons[goods[1]]          when 2;  item = $data_armors[goods[1]]          end          if item and check_pi_for_auction_avalibility(item)            @data.push(item)            @price[item] = goods[2] == 0 ? get_item_auction_price(item) : goods[3]            q = get_item_auction_qty(item)            @qty[item] = q if q != -1          end        end        @auction.data  = @data        @auction.price = @price        @auction.qty   = @qty      end    else      zev_auction_make_item_list    end  end   def check_pi_for_auction_avalibility(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionChance      return rand * 100.0 < $1.to_f    else      return true    end  end   def get_item_auction_price(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionRange      r1  = $1.to_f      r2  = $2.to_f      dif = (r1 - r2).abs      return ((rand(dif + 1) + [r1, r2].min) * item.price / 100).to_i    else      return item.price    end  end   def get_item_auction_qty(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionLimit      r1  = $1.to_f      r2  = $2.to_f      dif = (r1 - r2).abs      return (rand(dif + 1) + [r1, r2].min).to_i    else      return -1    end  end endclass Scene_Shop < Scene_MenuBase   alias :zev_auction_max_buy :max_buy  def max_buy    if @buy_window.auction      max = $game_party.max_item_number(@item) - $game_party.item_number(@item)      buying_price == 0 ? max : [max, money / buying_price].min      return [max, @buy_window.qty[@item] || 99].min.to_i    else      return zev_auction_max_buy    end  end   alias :zev_auction_do_buy :do_buy  def do_buy(number)    zev_auction_do_buy(number)    auction = @buy_window.auction    if auction      if auction.qty[@item] and @buy_window.qty[@item]        auction.qty[@item] -= number        if auction.qty[@item] == 0          auction.data.delete(@item)        end      end    end  end   def return_scene    super    $zetu_auction.close_auction  end    alias :zev_auction_selling_price :selling_price  def selling_price    if (a = $zetu_auction.active_auction)      s = a.sell[@item] || get_auction_sell_price(@item)      puts s      return a.sell[@item] = s    else      return zev_auction_selling_price    end  end    def get_auction_sell_price(item)    if item.note =~ ZEV::AuctionHouse::Regex::AuctionSell      r1  = $1.to_f      r2  = $2.to_f      dif = (r1 - r2).abs      return ((rand(dif + 1) + [r1, r2].min) * item.price / 100).to_i    else      return item.price    end  end endclass Window_ShopStatus < Window_Base   def refresh    contents.clear    draw_possession(4, 0)    draw_equip_info(4, line_height * 2) if @item.is_a?(RPG::EquipItem)    auction = $zetu_auction.active_auction    if auction      draw_auction(4, line_height, auction)    end  end   def draw_auction(x, y, auction)    rect = Rect.new(x, y, contents.width - 4 - x, line_height)    change_color(system_color)    draw_text(rect, "Amount Left")    change_color(normal_color)    draw_text(rect, auction.qty[@item] || 99, 2)  end endclass Scene_Map < Scene_Base   alias :zev_auction_update :update  def update    zev_auction_update    $zetu_auction.update  end end 
 

Killok

Veteran
Veteran
Joined
Jul 30, 2014
Messages
52
Reaction score
1
First Language
English
Primarily Uses
Last edited by a moderator:

Latest Threads

Latest Profile Posts

DamageEvil_5.png added!
index.php

Rendering the intro for the 4 time today, everytime it finished I noticed something that I found off and had to fix it and render it all over again...
Would not be so bad if it was not for my PC having the speed of a slug.:kaoswt2:
Tried something. Little sneak peak of Unity AD.
M42S7Us.gif

It's the little things. Lengthened the time the bar fades in and out to be a bit more comfortable.

Forum statistics

Threads
125,739
Messages
1,173,123
Members
164,888
Latest member
EternalLord
Top