Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: LiTTleDRAgo on March 17, 2013, 09:25:43 am

Title: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on March 17, 2013, 09:25:43 am
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




Screenshots

Version 1: ShowHide
(http://1.bp.blogspot.com/-FlBm-gO5gtI/UUfsY5zbE1I/AAAAAAAAAKg/J3RG5WnOsms/s320/limited_shop.JPG)

Version 2: ShowHide
(http://4.bp.blogspot.com/-DVmqsQkTwLk/UYpqb3zKSEI/AAAAAAAAAM8/9PCz8nFYFYI/s320/limited+shop+v2.JPG)



Script

Ver 1 (http://littledrago.blogspot.com/2013/03/rgss-drg-limited-shop.html)
Ver 2 (http://littledrago.blogspot.com/2013/05/rgss-drg-limited-shop-v2.html)


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




Author's Notes

Enjoy ~
Title: Re: [XP] Drago Limited Shop
Post by: finalholylight on March 17, 2013, 10:19:14 pm
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.
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on March 18, 2013, 02:08:41 am
script updated

-fix bug when data is not saved in save games
-sort item by item id
-added limit number in the window
Title: Re: [XP] Drago Limited Shop
Post by: finalholylight on March 18, 2013, 05:31:27 am
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.
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on March 24, 2013, 10:33:25 am
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
Title: Re: [XP] Drago Limited Shop
Post by: Kiwa on March 31, 2013, 07:11:05 am
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
Title: Re: [XP] Drago Limited Shop
Post by: 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
Title: Re: [XP] Drago Limited Shop
Post by: finalholylight on March 31, 2013, 12:29:27 pm
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.
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on March 31, 2013, 02:25:32 pm
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?
Title: Re: [XP] Drago Limited Shop
Post by: 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?).
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on April 01, 2013, 09:36:38 am
fixed
Title: Re: [XP] Drago Limited Shop
Post by: Kiwa on April 01, 2013, 09:43:45 am
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!
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on May 08, 2013, 11:22:19 am
added ver 2

(http://4.bp.blogspot.com/-DVmqsQkTwLk/UYpqb3zKSEI/AAAAAAAAAM8/9PCz8nFYFYI/s320/limited+shop+v2.JPG)
Title: Re: [XP] Drago Limited Shop
Post by: syldocaine on July 11, 2014, 02:47:14 pm
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?
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on July 11, 2014, 06:39:04 pm
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 (http://forum.chaos-project.com/index.php/topic,13476.0.html) or Longer Script Call (http://forum.chaos-project.com/index.php/topic,13324.0.html),

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:}
Title: Re: [XP] Drago Limited Shop
Post by: syldocaine on July 11, 2014, 07:18:32 pm
Well,this will help alot. Thx!

Yes,im using Drago Core Engine and Longer Script Calls,so i can use the stacks.
Title: Re: [XP] Drago Limited Shop
Post by: LiTTleDRAgo on July 12, 2014, 12:42:40 am
you don't have to use both, if you use Drago Core Engine, you can discard Longer Script Calls