Globally Reduce Stock for an Item Being Sold

Derek0

New Member
Reaction score
1
It's rather hard to explain in the title, so here's a better explanation.

I have a custom building that sells items. I have 2 instances of that building on my map, one for each force.

I need a way to make it so when you buy an item from one of the shops, and the stock goes to 0 and it starts the replenish cooldown, the stock also goes to 0 in the other instance of that shop, also starting it's replenish cooldown.

So basically, I need it so if one side buys an item, neither them nor the other side can purchase that same item until the replenish cooldown is over.

Also, don't tell me to remove it and then add it back later, because that's not what I'm looking for.
 
D

Down

Guest
you can force a Nutral unit to buy all the items from the other shops maybe sounds hard to do, just a theroy, remove the item is the easyest way
and when the item is removed just add it back with 0 in stock and it will naturally replishing its self
 

Derek0

New Member
Reaction score
1
you can force a Nutral unit to buy all the items from the other shops maybe sounds hard to do, just a theroy
I was thinking about that but I didn't know where to find the order to purchase a certain item.
remove the item is the easyest way and when the item is removed just add it back with 0 in stock and it will naturally replishing its self
I also tried that but it didn't work, after reading up on it it seems that you can only remove items from shops that were places in the shop by triggers in the first place.
 

Sooda

Diversity enchants
Reaction score
318
With this trigger find out what is order string for buying/ selling items from shop with hero:
Code:
Get Order
    Events
        Unit - A unit Is issued an order targeting an object
        Unit - A unit Is issued an order targeting a point
        Unit - A unit Is issued an order with no target
    Conditions
    Actions
        Game - Display to (All players) the text: (String((Issued order)))
Then use same order string on dummy unit to buy items from shop.
 

Derek0

New Member
Reaction score
1
But is the order string different for each item? Otherwise, I couldn't tell which item he was buying, and I wouldn't know how to order a certain item.
 
D

Down

Guest
the add the item with triggers its easyer than adding them manually
 
Reaction score
333
First, give your shop the "Sell Items" ability (no, yes, this exact ability. Accept no substitutes).

Second, add the item stocks at map initialization instead of using the object editor.

Now, when you want to set the stock, use:

Code:
function SetStock takes unit u, integer s, integer id returns nothing
    call AddItemToStock(u, id, s, s)
    call AddItemToStock(u, id, s, s)
endfunction

Note: Yes, AddItemToStock is called twice for a reason. Calling it once doesn't work properly (usually adds another stock of the item entirely) and using RemoveItemFromStock is buggy.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top