Supply and Demand [RPGXP]

Started by Ctrl_Alt_Defeat, January 19, 2015, 08:06:56 am

Previous topic - Next topic

Ctrl_Alt_Defeat

 After doing some digging I wasn't able to find a supply and demand script but some good concepts behind it with simple tricks to simulate it.

I'm not really looking for a dynamic pricing system (it could work too but I figure that'd be harder to do/find) but more of a price for an item that differs for where you're at. If you're in the middle of a huge desert, water would cost more compared to being in a moderate town next to a huge river :P

I'm still going to keep digging in case I missed scripts but basically what I was told could work is a script that sets item sell and buy prices before the player enters shop o.o

ANYWAYS if you guys know of something that'll do the trick, let me know!
"It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."

Soulshaker3

That would be easy to do, since I'm not really into RMXP I'm going to write how I would do it, syntax isn't correct

In the script call:

@items  = [id, buy, sell, id, buy sell, ...]
@script = Change_Prices.new(@items)

Open shop then another scriptcall:

@script.ChangeBack()


On the script itself

@itemsBefore = [];

def initialize(items)
    for i in 0...items.size i+=3
       @itemsBefore.push(i); // id
       @itemsBefore.push(i+1); //buy price before
       @itemsBefore.push(i+2); //sell price before
       set_item_buy(i,i+1) //new buy price
       set_item_sell(i,i+2) //new sell price
    end
end

def ChangeBack()
    for i in 0... @itemsBefore.size i+=3
       set_item_buy(i,i+1) //normal buy price
       set_item_sell(i,i+2) //normal sell price
    end
end
Hellow?

KK20


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ctrl_Alt_Defeat

Thanks for the suggestions!

I remember looking up your script KK2 but some one told me it isn't exactly what I was looking for and over looked it but after looking again that works perfectly lol  :^_^':

I've put the event you suggested to use soulshaker and with a little editing I was able to make that work!

Thanks to both of you!
"It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."