Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
Hello, I'm having issues with my shop system. I want to re-stock an item whenever you purchase it from a shop. I figured something like this was sure to work:
One solution I found was to remove all of the items from the shop, and then add all of them back. However, this has the unwanted side effect of refreshing the Stock Interval of every single item.
EDIT:
Found the solution!
Add these two custom scripts to your map initialization. I'm not sure if these cause problems with anything, so just a word of warning. Although, I tested it in singleplayer and everything seemed fine. All it appears to do is prevent items from being permanently removed from your shops. This could cause issues I imagine, depending on what you're trying to accomplish. You can probably find a workaround or turn these on and off to get what you need.
-
Purchase an Item
-
Events
-
Unit - A unit Sells an item (from shop)
-
-
Conditions
-
Actions
-
Neutral Building - Add (Item-type of (Sold Item)) to (Selling unit) with 1 in stock and a max stock of 1
-
-
One solution I found was to remove all of the items from the shop, and then add all of them back. However, this has the unwanted side effect of refreshing the Stock Interval of every single item.
EDIT:
Found the solution!
Add these two custom scripts to your map initialization. I'm not sure if these cause problems with anything, so just a word of warning. Although, I tested it in singleplayer and everything seemed fine. All it appears to do is prevent items from being permanently removed from your shops. This could cause issues I imagine, depending on what you're trying to accomplish. You can probably find a workaround or turn these on and off to get what you need.
-
Shop Setup
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Custom script: call PauseTimer(bj_stockUpdateTimer)
-
Custom script: call DisableTrigger(bj_stockItemPurchased)
-
-
Last edited: