• 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.

[General] Modify item sold/made stock

Status
Not open for further replies.
Hello,

My context :
I got a player-controlled building selling items like the melee race shop.
I want to manipulate the building item stock, add or reduce the stock amount.

I've seen some native such as AddItemToStock, but I couldn't make it work.

Question: Is this possible with player building or does this only work with neutral merchant?
 
Level 18
Joined
Dec 20, 2012
Messages
269
I am doing something similar in my altered melee map The Bandit's Crucible.


Your custom shop also needs the Sell Items ability in order for Neutral Building - Add/Remove Item-Type (From Marketplace) to work.

Under Techtree - Items Made of your shop should contains only items that you want the shop to always have like Scroll of Town Portal, Tome of Retraining, etc.

My custom item shop
Upon finishing building a Black Market, starts with an additional random set of items. The item pool refresh randomly from a range between 220-300 seconds with 60% chance for a new set of items.

  • Bandit Market Add Item Pool
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Black Market (Arcane Vault)
    • Actions
      • Set TempUnit = (Constructed structure)
      • Unit Group - Add TempUnit to TempBlackMarketItemPool
      • Unit Group - Pick every unit in TempBlackMarketItemPool and do (Actions)
        • Loop - Actions
          • Set TempUnit = No unit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set TempInt2 = (Random integer number between 1 and 100)
              • Neutral Building - Remove Scroll of Regeneration from (Picked unit)
              • Neutral Building - Remove Spider Silk Broach from (Picked unit)
              • Neutral Building - Remove Healing Salve from (Picked unit)
              • Neutral Building - Remove Wand of Illusion from (Picked unit)
              • Neutral Building - Remove Scroll of Mana from (Picked unit)
              • Neutral Building - Remove Sentry Wards from (Picked unit)
              • Neutral Building - Remove Vampiric Potion from (Picked unit)
              • Neutral Building - Remove Lesser Replenishment Potion from (Picked unit)
              • Neutral Building - Remove Wand of Mana Stealing from (Picked unit)
              • -------- Give a 20% chance for item variation 1. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 20
                • Then - Actions
                  • Neutral Building - Add Scroll of Regeneration to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Spider Silk Broach to (Picked unit) with 2 in stock and a max stock of 2
                • Else - Actions
              • -------- Give a 20% chance for item variation 2. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 40
                  • TempInt2 Greater than 20
                • Then - Actions
                  • Neutral Building - Add Healing Salve to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Wand of Illusion to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • -------- Give a 20% chance for item variation 3. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 60
                  • TempInt2 Greater than 40
                • Then - Actions
                  • Neutral Building - Add Scroll of Mana to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Sentry Wards to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • -------- Give a 20% chance for item variation 4. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 80
                  • TempInt2 Greater than 60
                • Then - Actions
                  • Neutral Building - Add Vampiric Potion to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Lesser Replenishment Potion to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • -------- Give a 20% chance for item variation 5. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 100
                  • TempInt2 Greater than 80
                • Then - Actions
                  • Neutral Building - Add Wand of Mana Stealing to (Picked unit) with 1 in stock and a max stock of 1
                  • Neutral Building - Add Lesser Replenishment Potion to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • Unit Group - Remove (Picked unit) from TempBlackMarketItemPool
            • Else - Actions
  • Bandit Market Item Pool
    • Events
      • Time - Every (Random real number between 220.00 and 300.00) seconds of game time
    • Conditions
    • Actions
      • Set TempBlackMarketItemPool = (Units of type Black Market (Arcane Vault))
      • Unit Group - Pick every unit in TempBlackMarketItemPool and do (Actions)
        • Loop - Actions
          • Set TempInt = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • TempInt Less than or equal to 60
            • Then - Actions
              • Set TempInt2 = (Random integer number between 1 and 100)
              • Neutral Building - Remove Scroll of Regeneration from (Picked unit)
              • Neutral Building - Remove Spider Silk Broach from (Picked unit)
              • Neutral Building - Remove Healing Salve from (Picked unit)
              • Neutral Building - Remove Wand of Illusion from (Picked unit)
              • Neutral Building - Remove Scroll of Mana from (Picked unit)
              • Neutral Building - Remove Sentry Wards from (Picked unit)
              • Neutral Building - Remove Vampiric Potion from (Picked unit)
              • Neutral Building - Remove Lesser Replenishment Potion from (Picked unit)
              • Neutral Building - Remove Wand of Mana Stealing from (Picked unit)
              • -------- Give a 20% chance for item variation 1. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 20
                • Then - Actions
                  • Neutral Building - Add Scroll of Regeneration to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Spider Silk Broach to (Picked unit) with 2 in stock and a max stock of 2
                • Else - Actions
              • -------- Give a 20% chance for item variation 2. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 40
                  • TempInt2 Greater than 20
                • Then - Actions
                  • Neutral Building - Add Healing Salve to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Wand of Illusion to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • -------- Give a 20% chance for item variation 3. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 60
                  • TempInt2 Greater than 40
                • Then - Actions
                  • Neutral Building - Add Scroll of Mana to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Sentry Wards to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • -------- Give a 20% chance for item variation 4. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 80
                  • TempInt2 Greater than 60
                • Then - Actions
                  • Neutral Building - Add Vampiric Potion to (Picked unit) with 2 in stock and a max stock of 2
                  • Neutral Building - Add Lesser Replenishment Potion to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • -------- Give a 20% chance for item variation 5. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt2 Less than or equal to 100
                  • TempInt2 Greater than 80
                • Then - Actions
                  • Neutral Building - Add Wand of Mana Stealing to (Picked unit) with 1 in stock and a max stock of 1
                  • Neutral Building - Add Lesser Replenishment Potion to (Picked unit) with 1 in stock and a max stock of 1
                • Else - Actions
              • Floating Text - Create floating text that reads New items have arri... above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Show (Last created floating text) for (All allies of (Owner of (Picked unit)))
              • Floating Text - Hide (Last created floating text) for (All enemies of (Owner of (Picked unit)))
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempBlackMarketItemPool)

Free free to check my map in world editor or Hive's preview triggers.
 
Level 21
Joined
Mar 16, 2008
Messages
958
There is a difference between "shops" vs "marketplaces." There is a thread somewhere on Hive about this but I can't find it.

The stock settings will affect shops,
but the triggers do not affect shops.
You can't add items to shops with triggers - only marketplaces.

If you want to manipulate the stock of an item sold in a shop then you need to edit that item's stock settings in Object Editor.

What Chaosium said applies to marketplaces.
What Flek said about abilities applies to both and the 2nd part appplies to shops only.

There might be a better way but this is my understanding.
 
Thank you for the answers, I managed to accomplish my idea.
I wanted to have some kind of shared stock for different items. See linked gif.
23-09-12-18-19-49.gif
d stock for
 
Status
Not open for further replies.
Top