• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Item Stock (shop)

Status
Not open for further replies.
Level 12
Joined
Jun 1, 2009
Messages
576
Hi guys, this is what i want to make:

my shop sells 1 item type (stocks increase every few second)....i made action that this item type got replaced with another item type....

now problem: I want that when i replace old item type that shop sells with new one.....New item have same number of stocks like old one....

But i dont see any action that can check how many stock of item type shop have...
 
There isn't really a "simple" way to do it. You have to keep track of the stock count manually. You make an integer variable "count" that is set to the initial stock when the item is first added to the building. Then you start a trigger where every X seconds (X should be the stock replenish interval), you increase the count for that item by 1. If the count variable is equal to the maximum stock count for that item, then do not increase count by 1. Then, every time the item is sold, you decrease the count by 1.
 
Status
Not open for further replies.
Top