• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Shop problems - Adding and removing items through triggers

Not open for further replies.


Warcraft Moderator
Level 66
Aug 10, 2018
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:

  • 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
This causes problems. Yes, the item is added back to the shop, however, after purchasing my 2nd or 3rd item something strange begins to happen. The item to the right of my purchased item disappears. Then from that point on it continues to do so with every single purchase I make. I think it has something to do with the fact that when I add the sold item back to the shop it's replacing the position of the item that WAS to the right of it. Seeing as how the button positions automatically update and move when you remove an item, I imagine this is the problem.

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.

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:
Not open for further replies.