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

[Trigger] Please help me with Neutral Building - Add item-type to marketplace

Status
Not open for further replies.
Level 6
Joined
Jan 1, 2008
Messages
69
I've read that Neutral Building - Add item is extremely buggy, but is there any way to do this correctly? Currently it works fine with small amount of items, (1-5) but if i add too many different items or more than 6 items of the same type, the whole system gets messed up even though variables are correct. I've also tried adding wait 1 second action between remove item-type and add item-type actions. This only prevented game from adding items with 0 quantity.

You must have been wondering what these triggers are trying to do. Well, it's basically empty shop at the beginning but once a player sells items to it, other players can buy them from the same shop ^^ Only things which are working correctly (only with wait action):
-more than 1 item in the shop and there should be only 1-2 of each item in the shop
-1 item-type, 1-5 quantity
-Adding first item or new items
-Removing item (its not always possible because trigger might add item-type with 0 quantity)

Please don't suggest me to replace other neutral building add item actions with this:
  • Neutral Building - Add whatever to Trade Center 0013 <gen> 1 in stock and a max stock of 1
I already know that it should work correctly. Only problem would be the fact that players can't see the amount of items in shop, but my variables are already keeping track of everything. I'll do that only if there is no other solution.

My Trade Center currently has these abilities: (buggy)
Select Hero
Sell Items
Sell Units
Invulnerable (Neutral)
Shop Sharing
Shop Purchase Item

I've tested it with these: (was buggy)
Select Hero
Sell Items
Invulnerable (Neutral)
Shop Purchase Item


  • Trade Center Buys
    • Events
      • Unit - A unit Pawns an item (to shop)
    • Conditions
      • (Buying unit) Equal to Trade Center 0013 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemTotalTrade Greater than or equal to 1
        • Then - Actions
          • Set FoundItem = False
          • For each (Integer IntegerC) from 0 to ItemTotalTrade, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Sold Item)) Equal to ItemTypeTrade[IntegerC]
                  • IntegerC Not equal to 0
                • Then - Actions
                  • Set FoundItem = True
                  • Set ItemAmountTrade[IntegerC] = (ItemAmountTrade[IntegerC] + (Charges remaining in (Sold Item)))
                  • Neutral Building - Remove (Item-type of (Sold Item)) from Trade Center 0013 <gen>
                  • Neutral Building - Add ItemTypeTrade[IntegerC] to Trade Center 0013 <gen> with ItemAmountTrade[IntegerC] in stock and a max stock of ItemAmountTrade[IntegerC]
                  • Game - Display to (All players) for 30.00 seconds the text: ((ShopValue + ((String(IntegerC)) + : )) + (String(ItemAmountTrade[IntegerC])))
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FoundItem Equal to False
              • ItemTotalTrade Less than 11
            • Then - Actions
              • Game - Display to (All players) for 30.00 seconds the text: VITTU
              • Set ItemTotalTrade = (ItemTotalTrade + 1)
              • Set ItemTypeTrade[ItemTotalTrade] = (Item-type of (Sold Item))
              • Set ItemAmountTrade[ItemTotalTrade] = (Charges remaining in (Sold Item))
              • Neutral Building - Add ItemTypeTrade[ItemTotalTrade] to Trade Center 0013 <gen> with ItemAmountTrade[ItemTotalTrade] in stock and a max stock of ItemAmountTrade[ItemTotalTrade]
            • Else - Actions
        • Else - Actions
          • Set ItemTotalTrade = 1
          • Set ItemTypeTrade[1] = (Item-type of (Sold Item))
          • Set ItemAmountTrade[1] = (Charges remaining in (Sold Item))
          • Neutral Building - Add ItemTypeTrade[1] to Trade Center 0013 <gen> with 1 in stock and a max stock of 1
      • For each (Integer A) from 0 to ItemTotalTrade, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Not equal to 0
            • Then - Actions
              • Game - Display to (All players) for 30.00 seconds the text: ((Final Value + ((String((Integer A))) + : )) + (String(ItemAmountTrade[(Integer A)])))
            • Else - Actions



  • Trade Center Sells
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Selling unit) Equal to Trade Center 0013 <gen>
    • Actions
      • For each (Integer IntegerD) from 0 to ItemTotalTrade, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to ItemTypeTrade[IntegerD]
              • IntegerD Not equal to 0
            • Then - Actions
              • Game - Display to (All players) the text: Found
              • Set ItemAmountTrade[IntegerD] = (ItemAmountTrade[IntegerD] - 1)
              • Neutral Building - Remove (Item-type of (Sold Item)) from Trade Center 0013 <gen>
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ItemAmountTrade[IntegerD] Greater than or equal to 1
                • Then - Actions
                  • Neutral Building - Add ItemTypeTrade[IntegerD] to Trade Center 0013 <gen> with ItemAmountTrade[IntegerD] in stock and a max stock of ItemAmountTrade[IntegerD]
                  • Game - Display to (All players) for 30.00 seconds the text: ((ShopValue + ((String(IntegerD)) + : )) + (String(ItemAmountTrade[IntegerD])))
                • Else - Actions
                  • Game - Display to (All players) the text: zero remaining
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IntegerD Less than ItemTotalTrade
                    • Then - Actions
                      • For each (Integer B) from (IntegerD - 1) to (ItemTotalTrade - 1), do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Integer B) Not equal to (IntegerD - 1)
                            • Then - Actions
                              • Set ItemAmountTrade[(Integer B)] = ItemAmountTrade[((Integer B) + 1)]
                              • Set ItemTypeTrade[(Integer B)] = ItemTypeTrade[((Integer B) + 1)]
                            • Else - Actions
                    • Else - Actions
                  • Set ItemTotalTrade = (ItemTotalTrade - 1)
                  • Skip remaining actions
            • Else - Actions
      • For each (Integer A) from 0 to ItemTotalTrade, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Not equal to 0
            • Then - Actions
              • Game - Display to (All players) for 30.00 seconds the text: ((Final Value + ((String((Integer A))) + : )) + (String(ItemAmountTrade[(Integer A)])))
            • Else - Actions
 
Last edited:
Level 4
Joined
Jan 2, 2008
Messages
103
You could try something like

Event: A unit pawns an item to a shop

Action: Create one (Item type of Event response-sold item) in (*)

*This would work, but the item would have nowhere to go, unless to can figure some way to get it into the shop

try it, but editors not with me atm so i dont know how well it'll work
 
Level 6
Joined
Jan 1, 2008
Messages
69
You could try something like

Event: A unit pawns an item to a shop

Action: Create one (Item type of Event response-sold item) in (*)

*This would work, but the item would have nowhere to go, unless to can figure some way to get it into the shop

try it, but editors not with me atm so i dont know how well it'll work

Thanks, but I'm not going to even try that, because it doesn't work with neutral marketplace...
 
Status
Not open for further replies.
Top