A downloadable plugin

Buy Now$5.00 USD or more

Features

  • Set up a shop with limited inventory of any combination of items, weapons and armours, with the option of using the database price or specifying your own
  • Add or remove stock to an existing limited shop
  • Change prices without affecting inventory
  • Set up auto restocking, either on a per-item basis or with a default frame delay*
  • Choose a random selection of items from the available pool, either once or every time you visit*
  • Use a variable to determine stock/restock quantities*

* Premium version feature only, not present in the free one

Premium version is available at no extra charge to Trilobytes patrons on any tier: https://www.patreon.com/trihan 

Screenshots

Current version
1.07

Changelog
Version 1.07:
- Fixed a bug where shops could no longer stock via constant quantity values and only worked with variables.

Version 1.06:
- Item quantity can no longer be set higher than restock max. If a higher
value is used, it will be changed to the max value.
- Fixed a bug where the stock equality check wasn't using correct keys.
- Quantities/Restock quantities for all plugin commands can now use a
variable instead of a constant value.

Version 1.05:
- Fixed an issue where loading an existing save after changing in-line stock data would retain the old inventory.

Version 1.04:
- Added additional failsafes that were missed in the previous fix.

Version 1.03:
- Added missing failsafes to create required objects if they don't already exist, which should prevent crashes when adding this plugin to a game with existing save files.

Version 1.02:
- Fixed a bug where creating a normal shop with no plugin commands would crash the game.
- Implemented "Randomise Once" and "Randomise Always" options for setting up a shop, to determine whether random X items should only happen once when first visiting to create a permanent inventory, or whether items should be chosen randomly every visit.
- Fixed descriptions in some outdated restock timer struct properties that didn't include the addition of -1 as a no restock option.

Version 1.01:
- Changed auto restock value to use 0 as default and -1 as no restock.
- Fixed help formatting to fit in available space.

Version 1.00:
- Finished plugin!

Purchase

Buy Now$5.00 USD or more

In order to download this plugin you must purchase it at or above the minimum price of $5 USD. You will get access to the following files:

TLB_LimitedShopStock.js 49 kB

Download demo

Download
TLB_LimitedShopStock_Free.js 29 kB

Comments

Log in with itch.io to leave a comment.

It cannot be implemented in saved games, set property [object array] of the undefined... I have to test from scratch, then it works. Can fix?

I'll look into it! Thanks for the report.

(1 edit)

Thanks, let me know.

Hi there! Liking this plugin, very user-friendly!

The 'sell' functionality appears to be broken in the current version - items you attempt to sell will end up back in your inventory after you leave the shop - and won't appear for sale in the shop you've sold to

(1 edit)

Oh, that definitely sounds like a bug! Leave that with me and I'll post an update as soon as it's fixed.

Was that the free version or the premium one?

Are you sure you're using the latest version? I've tested on both the free and paid plugins and if I sell an item, it's removed from my inventory and added to the shop's stock if it's one they sell.

Version 1.07 is now available and finally fixes the bug with stock! It turns out that there was a logic error that made it only use variables for stock quantities, so constant values no longer worked. This is now resolved.

I'm getting this error  when launching my project with this plugin enabled.

I tried turning off all my other plugins to see if it will work and it still throws up the same error.

Are you trying to run it on a mobile device with Android 4 or earlier?

Nope, I'm on windows 10.

Weird, that usually only happens on mobile. It's because of a browser that doesn't support null-coalescing assignment, which I use pretty liberally in my plugins unfortunately. It's client-end so there's no way for me to fix it besides not using those operators at all, which I'd rather not do since they're a really handy ES2020 feature.

Ah that's unfortunate, thank you for responding though!

If I get the time (and I'm not promising since my schedule is horrendously hectic at the best of times) I'll create a variant for you that doesn't use null-coalescing and put it up as a separate download. Did you buy the premium version or are you using the free one?

It looks like 1.06 has caused a bug where shops are always sold out; I'm currently looking into this and will update as soon as I resolve it.

Version 1.06 has been released! Quantities can now be set via variable and cannot result in a stock value greater than the max restock value. I also fixed a bug where comparison between the stock equality check wasn't working properly.

Hi, I bought this plugin, it's ALMOST perfect for my game, but I may be doing something wrong. So,

- I'd like to disable auto-restock and only do it via plugin command when a certain point of my game is reached 

- I set the default stock maximum to 5

But if I use a plugin command to add, say, 10 items, it will go above the stock maximum! Is there a way to control this?

Thank you

Hi Trihan, any plans to port this to MV?

Hey zelanius! I'd considered an MV version but I can't think of an elegant way to do the plugin commands that would still allow for the same versatility. If I come up with something I for sure will.

Thanks for the response, Trihan. I thought that might be the case, as I recall someone else (I think it was Ramza) who mentioned how MV was more difficult to build plugins for due to the way their script was structured. Hopefully, you will find a solution, as this would be a really nice way to limit item stocks and manage game difficulty (and force some crafting on top of that), instead of a tedious "Show Choice" menu with tied to various variables and switches which will certainly make me go @_@.

(+1)

Since it's you I'm sure I can figure something out.

Is there a way to specify item quantity adjustments using a variable?

Not yet, but someone else requested it and I'm planning to include that as a feature in the next version, which should be available soon.

I am having a compatability issue with the plugin. Source maps of old save files will not load when the plugin is enabled.  New game  files run with no problem.  I disabled Visustella Main Menu core but that did not help.

Sorry to hear that! I'll take a look.

Okay, so the source map thing is entirely unrelated to the problem; that happens in all RM projects and can be safely ignored.

The actual issue is with the restock timers tracker. Did you add the plugin to an existing project and try to load a save you'd already created prior to installing it?

I did add it to an existing project. Is there a way to disable the global restock timer? Otherwise I can try setting restock to -1 and see if that helps.

Setting it to 0 does disable it, but the problem is the code is still checking for it being there so whether enabled or not you'll still have this issue. It's because the object is created on game start, so obviously it doesn't exist in your save.

I'll update the plugin to create the object if it doesn't exist when it's needed. Should have a new version up soon, thanks for the report!

Is the update available? Sorry, I can't seem to see the versions

I am getting this when running the plugin in play test after following your instructions. 

SyntaxError

Unexpected token '='


Can you please help?

Of course! I'm so sorry to hear that and thanks so much for the purchase.

What have you done in terms of shop setup?

Just checking in for this since it's been 2 months. I can't help you without some more information. ^_^