[XP] Drago Limited Shop

Started by LiTTleDRAgo, March 17, 2013, 09:25:43 am

Previous topic - Next topic

LiTTleDRAgo

March 17, 2013, 09:25:43 am Last Edit: May 08, 2013, 11:21:32 am by LiTTleDRAgo
Limited Shop
Authors: LiTTleDRAgo
Version: 1.00
Type: Custom Shop System
Key Term: Custom Shop System



Introduction

In this shop, you can only buy items at limited amount before it is sold out
If you want to buy the same item, you must visit another store


Features


  • The Introduction says it all




Screenshots

Version 1: ShowHide

Version 2: ShowHide



Script

Ver 1
Ver 2


Instructions

Use script command

Script :
$limited_shop = {
 <times> => [................],
 <times> => [................],
 <times> => [................],
 <times> => [................],
 "G"        => ammount (Integer)
}

<times> =
0 means that item(s) can be bought as many as possible
1 means that item(s) can only be bought once in that shop
2 means 2 times, etc

......... = Array of Items/weapons/armors (ex = ['i1','i2','w8','a30'])
you can also use string instead of array (ex = "i1,i2,w2,a3" )

"G" = Shop's gold, if omitted, shop's gold will set as 0
you can't sell anything when shop's gold is 0
(this feature can be disabled if you set  SHOP_HAS_GOLD to false




Compatibility

Will have problem with other Custom Shop System


Credits and Thanks


  • LiTTleDRAgo

  • finalholylight for requesting

  • Falcon for his tax script




Author's Notes

Enjoy ~

finalholylight

Something wrong with sorting items, items are sorted by their limit, 0 to 1 to 2 ... , can you make it like the regular sorting, and, would you mind creating a number next to the item's name that display current quantity of that item.

LiTTleDRAgo

script updated

-fix bug when data is not saved in save games
-sort item by item id
-added limit number in the window

finalholylight

March 18, 2013, 05:31:27 am #3 Last Edit: March 22, 2013, 11:51:18 pm by finalholylight
Yay, thanks a lot :)
Ah, how can I reset a shop, I want to set an event that check timer for a shop, after a specified time, that shop will come back as the first time.
A minor bug about sell item, Ex: I have 4 potions, and when I sell them, I only choose max to 3 potions to sell.

LiTTleDRAgo

March 24, 2013, 10:33:25 am #4 Last Edit: April 01, 2013, 10:30:13 am by LiTTleDRAgo
Quote from: finalholylight on March 18, 2013, 05:31:27 am
Spoiler: ShowHide
Yay, thanks a lot :)
Ah, how can I reset a shop, I want to set an event that check timer for a shop, after a specified time, that shop will come back as the first time.


instruction in the script

Quote from: finalholylight on March 18, 2013, 05:31:27 amA minor bug about sell item, Ex: I have 4 potions, and when I sell them, I only choose max to 3 potions to sell.


fixed

Kiwa

Wow. amazing you wrote this near the time i was looking for something just like this.
I guess other people have the same wavelength i do.

any way.. i really like this script thanks for making it!
i was looking around in it for the shop to have 0 of an item.
let me explain.

I'm laying out plans for an online game.
My intention is for the city to have a trader.
this char will buy and sell items.

say i find some nifty shiny rock... i find its taking up my limited item space ( given to me by your lovely item system)
i feel its worthless.
so i visit Mr. Trader
the items assigned in Mr.Traders event

limited_shop = {
4 => ['i1','i2','i3','i4']  # hey nice! 4 of each of these items!
}

Mr trader is willing to buy my item for a set price of say 20gold
then it APPEARS on his market for others to buy for say...30gold

so what im asking is:
Is there a way i can set his item shop to accept items that i have layed in an array without having to quantify it?
in shot.... start at 0 stock but accepting to buy.
when i tested ..he wouldn't stock the items that weren't listed in the array.

Thank you :D

LiTTleDRAgo

basically, you have shop

{
4 => ['i1','i2','i3','i4'], 
}

then you sell w1 for 3 times, the shop changed to

{
3 => ['w1'],
4 => ['i1','i2','i3','i4'],
}

unless I'm wrongly interpreting your requests

finalholylight

March 31, 2013, 12:29:27 pm #7 Last Edit: March 31, 2013, 12:31:36 pm by finalholylight
I think his request is: shop that sell i1,i2, then it will only store i1,i2 in it's stock when player sell i1,i2, and he want when player sell w1 (out of list of that shop), w1 will be stored in that shop,too, then player can buy back that w1 if he want.

LiTTleDRAgo

script updated


  SHOP_HAS_GOLD = true
  # basically if false, you can sell anything as you please
  GET_SOLD_ITEM = 1
  # 0 : Item sold won't be added into buy list
  # 1 : Item sold will added into buy list
  #     (you sold x items outside the list and that item will appeared in the
  #      buy list with limit of x)
  # 2 : Item sold will added into buy list unlimitedly
  #     (you sold  at least 1 items outside the list and that item will appeared in the
  #      buy list without item limit and can be bought as many as possible)


is this what you mean?

KK20

Made two stores: (A) sells the item once, (B) has no limit of this item. I buy from (B) and sell it to (A). Draws two instances of this item in the buy window in (A). And when I go back to (B) to buy the same item, I can only buy 1 at a time.

'Exit' doesn't work when you select it ($limited_shop = nil is missing?).





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



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

Join the CP Discord Server!

LiTTleDRAgo


Kiwa

April 01, 2013, 09:43:45 am #11 Last Edit: April 01, 2013, 09:49:32 am by Kiwa
Quote from: LiTTleDRAgo on March 31, 2013, 11:23:41 am
basically, you have shop

{
4 => ['i1','i2','i3','i4'], 
}

then you sell w1 for 3 times, the shop changed to

{
3 => ['w1'],
4 => ['i1','i2','i3','i4'],
}

unless I'm wrongly interpreting your requests

That sounds about right drago. i'll update the script soon to try it out.
Thanks for looking into it for me :D


Quote from: KK20 on March 31, 2013, 11:53:37 pm
Made two stores: (A) sells the item once, (B) has no limit of this item. I buy from (B) and sell it to (A). Draws two instances of this item in the buy window in (A). And when I go back to (B) to buy the same item, I can only buy 1 at a time.

'Exit' doesn't work when you select it ($limited_shop = nil is missing?).


I also had this issue. lol.


once again. thanks a lot fellas :D

*************EDIT**************
Beautiful! BEAUTIFUL!!!
Thanks exactly it Drago.
Thanks for another wonderful script and fantastic help!

LiTTleDRAgo


syldocaine

For shops with a few items this script works really fine.

But if I wanna do a shop with alot of Items with the same limit (for example 30 Items,and all of them can be bought only once) the script input window of RMXP is messing up with it's space.

Is there any workaround?

LiTTleDRAgo

you can do it like this

$limited_shop = {
 1 => "i1,i2,i3,i4,i5,i6,i7,i8,i9,"+
"i10,i11,i12,i13,i14,i15,i16,i17,"+
"i18,i19,120,i21,i22,i23,i24,i25", # Automatically converted into array in the script
}


or you can also do it like this

@i1 = (1..25).to_a.map {|i|"i#{i}"} # This means ["i1","i2",....,"i25"]
@i2 = (1..25).to_a.map {|i|"w#{i}"} # This means ["w1","w2",....,"w25"]

$limited_shop = {
 1 => @i1,
 2 => @i2,
}


if somehow the script command isn't have enough space &
you're using Drago Core Engine or Longer Script Call,

you can stack the script calls :


@>Script:$limited_shop = {
@>Script: 1 => (1..10).to_a.map {|i|"w#{i}"},
@>Script: 10 => [3,6,10].map {|i|"i#{i}"},
@>Script: 20 => [2,5,7].map {|i|"i#{i}"},
@>Script: 50 => [1,4,9].map {|i|"i#{i}"},
@>Script:}

syldocaine

Well,this will help alot. Thx!

Yes,im using Drago Core Engine and Longer Script Calls,so i can use the stacks.

LiTTleDRAgo

you don't have to use both, if you use Drago Core Engine, you can discard Longer Script Calls