Hello, I was wondering if it's possible to be able to have X item in a shop processing event then if someone buys the item it'll make it so they can't buy any more of that same item so long as they have their one.
Limited Item Amounts?
● ARCHIVED · READ-ONLY
-
-
This is definitely possible, but you either need one of the shop scripts(I'm pretty sure they have this option) or you need to create the shop yourself through eventing.Hello, I was wondering if it's possible to be able to have X item in a shop processing event then if someone buys the item it'll make it so they can't buy any more of that same item so long as they have their one.
-
You can easily do this WITHOUT a shop, unless that won't work for your story. Just have a character selling the item:
if ___ item exists in inventory
"You can't buy it!"
else
+1 item
-50 gold
end
(or whatever) -
Yea this is how I was doing it, I just figured since in this test game it has a LOT of items that change what happens in the game simply by having them so having to set this up for each and every one of them will take a very long time which is fine but it also means I'm more likely to make mistakes in the event scriptYou can easily do this WITHOUT a shop, unless that won't work for your story. Just have a character selling the item:
if ___ item exists in inventory
"You can't buy it!"
else
+1 item
-50 gold
end
(or whatever) -
Okay, then definitely check out some shop scripts. I know some can limit the shop inventory, but that's not what you're looking for. You may have to modify a script, or request one. It shouldn't be too hard, though.
-
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
Please take a look at some of the existing scripts. -
There are indeed existing scripts for it I believe. But here is a simple free one:
For eventual future updates or the demo see my signature.Spoiler#sb:item_limit [message]=begin#===============================================================================Napoleons Item LimitVersion 1.01By NapoleonAbout:- Allows you to set a custom limit for all items as well as for specific items (in shops).- Can optionally also set a limit for manually increasing the item limit through events or through script calls.- Supports item notetags.Instructions:- Place below "▼ Materials" but above "▼ Main Process". Requires:- RPG Maker VX AceTerms of Use:- This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/deed.en_US.- Attribution is not required. This overrules what's stated in the above license. Version History:1.01 (28 July 2014) - Added an optional item limiter for adding items through other means. - Now supports notetags1.00 (28 July 2014) - First Release=endmodule Nap; module Item_Limit#===============================================================================# Settings#=============================================================================== # This is the default allowed maximum quantity. # This value is used when an item is not listed in SPECIFIC_ITEM_LIMITS. # Does not exceed 99 unless LIMIT_GLOBALLY is set to true. MAX_ITEMS = 99 # Set specific maximum item quantities here (note-tags overrule these). SPECIFIC_ITEM_LIMITS = { # <item_id> => <max quantity>, 9 => 5, # max 5x "Life Up" } # Limits items gained through chests and events as well when set to true. LIMIT_GLOBALLY = true # REGEX notetag. Only change if you know what you are doing. NOTE_TAG_REGEX = /<item_limit:(\d*)>/i#===============================================================================# Do not edit below this line#=============================================================================== SPECIFIC_ITEM_LIMITS.default = MAX_ITEMS def self.max_items(item_id) return SPECIFIC_ITEM_LIMITS[item_id] endend; end # module Nap; module Item_Limit$imported ||= {}$imported[:nap_item_limit] = 1.01#===============================================================================# Window ShopBuy#===============================================================================class Window_ShopBuy < Window_Selectable #----------------------------------------------------------------------------- # enable? [ALIAS] #----------------------------------------------------------------------------- alias nap_shop_item_limit_enable? enable? def enable?(item) nap_shop_item_limit_enable?(item) && $game_party.item_number(item) < Nap::Item_Limit.max_items(item.id) endend#===============================================================================# Scene Shop#===============================================================================class Scene_Shop < Scene_MenuBase #----------------------------------------------------------------------------- # Max Buy [ALIAS] #----------------------------------------------------------------------------- alias nap_shop_item_limit_max_buy max_buy def max_buy max_with_limit = Nap::Item_Limit.max_items(@item.id) - $game_party.item_number(@item) return [nap_shop_item_limit_max_buy, max_with_limit].min endend#===============================================================================# Game Party#===============================================================================if Nap::Item_Limit::LIMIT_GLOBALLY class Game_Party < Game_Unit #--------------------------------------------------------------------------- # Max Item Number [OVERWRITE] #--------------------------------------------------------------------------- def max_item_number(item) return Nap::Item_Limit.max_items(item.id) end endend#===============================================================================# Data Manager#===============================================================================module DataManager class << self alias nap_shop_item_limit_load_database load_database end #----------------------------------------------------------------------------- # Load Database [ALIAS] #----------------------------------------------------------------------------- def self.load_database nap_shop_item_limit_load_database $data_items.each { |item| next if item.nil? Nap::Item_Limit::SPECIFIC_ITEM_LIMITS[item.id] = $1.to_i if item.note.delete(' ') =~ Nap::Item_Limit::NOTE_TAG_REGEX } endend#===============================================================================
Just set the specific item max_value to 1. -
I've posted this yesterday : script. No configuration module, but I don't really know if it's what you need.