• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Any way to make an item group?

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
I want to do Neutral Building - Remove Item, but it doesn't let me specify groups of items to remove. I want to take out everything it has for sale and add a whole new list of stuff, but is there any way to make an item group that I can pick all items and remove picked item from? As far as I can tell, you can only specify items in regions.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
I want to do Neutral Building - Remove Item, but it doesn't let me specify groups of items to remove. I want to take out everything it has for sale and add a whole new list of stuff, but is there any way to make an item group that I can pick all items and remove picked item from? As far as I can tell, you can only specify items in regions.
Try adding the new stuff items to an Item array variable and do a loop with the following action inside
  • Neutral Building - Add ItemSetA[Index A] to Shop with 1 in stock and a max stock of 2
Of course change the number 1,2 with the number you want.

<< ADDED >>

Oh btw, don't forget to remove the old stuff by the action
  • Neutral Building - Remove ItemSetA[Index A] from Shop
 
The only way to do this is by setting every item you are going to use for your map in a variable.
  • Events
    • Map Initialization
  • Conditions
  • Action
    • Set Items[1] = Boots of Speed
    • Set Items[2] = ...
    • Set Items[3] = ..
Then
  • Trigger1
  • Events
    • Player - Player 1 (Red) types a message containing -newitems as an exact match
    • ... (for the rest players, do the same)
  • Conditions
  • Actions
    • For each (IntegerA) from 1 to 11, do (Actions) [11 are the items a Marketplace can have at the same time]
      • Loop - Actions
        • Neutral Building - Remove Items[IntegerA] (from all marketplaces)
Edit: Gasp, Starquizer pawned me for 150 gold!! (Pharaoh_ has fallen)
 
Level 6
Joined
Aug 12, 2007
Messages
201
Thanks guys, but I'm not totally sure I understand. I have A LOT of items, so setting an array manually for every single one like Pharaoh_ said is going to be tedious. Click, set item 1 to 1, enter, click, set item 2 to 2, etc etc. all the way to a thousand. Can you two explain your system in a little more detail, I don't understand.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Thanks guys, but I'm not totally sure I understand. I have A LOT of items, so setting an array manually for every single one like Pharaoh_ said is going to be tedious. Click, set item 1 to 1, enter, click, set item 2 to 2, etc etc. all the way to a thousand. Can you two explain your system in a little more detail, I don't understand.
The item array variable is the best but if it is tedious try creating many regions equal to the number of item sets you have and use the item picking action.
  • Item - Pick every item in (Playable map area) and do (Actions)
    • Loop - Actions
      • Neutral Building - Add (Item-type of (Picked item)) to (Triggering unit) with 0 in stock and a max stock of 1
I haven't tried it though.

<< ADDED >>

Change Playable map area with the region that contains the set you want then hide the items in this region so you become able to remove them later; the purpose of the item in the region is to get their type only.
 
Level 6
Joined
Aug 12, 2007
Messages
201
The item array variable is the best but if it is tedious try creating many regions equal to the number of item sets you have and use the item picking action.
  • Item - Pick every item in (Playable map area) and do (Actions)
    • Loop - Actions
      • Neutral Building - Add (Item-type of (Picked item)) to (Triggering unit) with 0 in stock and a max stock of 1
I haven't tried it though.

<< ADDED >>

Change Playable map area with the region that contains the set you want then hide the items in this region so you become able to remove them later; the purpose of the item in the region is to get their type only.

I had thought of that sorta, I have a region ItemFarm which houses all of my items in a hidden state. My problem with it is that I couldn't do much with them, like I could reveal them, pick them all, and remove picked items from the marketplace. But that was that, and it forces me to hide all these items in my map somewhere, I am afraid players my find out/break/exploit it. I was hoping to store all the item types somewhere, like an item array that was previously mentioned, only I can't do like 'Pick all items and add them incrementally to the array' type thing. If I am making sense.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
I had thought of that sorta, I have a region ItemFarm which houses all of my items in a hidden state. My problem with it is that I couldn't do much with them, like I could reveal them, pick them all, and remove picked items from the marketplace. But that was that, and it forces me to hide all these items in my map somewhere, I am afraid players my find out/break/exploit it. I was hoping to store all the item types somewhere, like an item array that was previously mentioned, only I can't do like 'Pick all items and add them incrementally to the array' type thing. If I am making sense.

Put the region with the items it contains away that can't be reached and when you need to swap the items show them and after the swap is done hide them again.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Put the region with the items it contains away that can't be reached and when you need to swap the items show them and after the swap is done hide them again.

Alright, Ill try that now and get back to you in a second. On a side note, on the Neutral Building - Marketplace Remove Item trigger, it says it affects any building with the Sell Item ability, but does it really do ANY building or just actual neutral ones like Goblin Merchants?

EDIT: Problem already. After I hide all the items, I have no way of getting them back. There is no unhide all items in region trigger, and you can't pick all items in region and unhide since it ignores hidden items when it does the pick all function.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Alright, Ill try that now and get back to you in a second. On a side note, on the Neutral Building - Marketplace Remove Item trigger, it says it affects any building with the Sell Item ability, but does it really do ANY building or just actual neutral ones like Goblin Merchants?
No any building with the sell items ability, Neutral Building is just a category the action under.
 
Level 6
Joined
Aug 12, 2007
Messages
201
No any building with the sell items ability, Neutral Building is just a category the action under.

That's good, but I discovered a second problem I edited in there, I can't re-pick the items in the region because it ignores them in the pick since they are hidden, and there's no unhide everything in region function
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
That's good, but I discovered a second problem I edited in there, I can't re-pick the items in the region because it ignores them in the pick since they are hidden, and there's no unhide everything in region function
Unhide all items in Entire map then they will appear again. That action I think was used in some of blizzard campaign cinematics.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Unhide all items in Entire map then they will appear again. That action I think was used in some of blizzard campaign cinematics.

Gotcha, Ill take a poke around for that and get back to you.

EDIT: Well apparently it says Pick Every Item in Region works on Hidden Items, which is confusing because that means something else is wrong with my trigger.

  • MarketRandomItems Copy
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in ItemFarm <gen> and do (Actions)
        • Loop - Actions
          • Neutral Building - Remove (Item-type of (Picked item)) from all marketplaces
The items are hidden at the start of the game initialization, and there is more to the trigger I removed for now that adds items back in, but the items don't remove from the shops for some reason. I also couldn't find any unhide all items ):
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Unhide the items before removing/adding them to the shop.

I'll give you 2 triggers on how to show/hide item in region.

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing show as A substring
    • Conditions
    • Actions
      • Item - Pick every item in Region 000 <gen> and do (Actions)
        • Loop - Actions
          • Item - Show (Picked item)
  • Untitled Trigger 001 Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as A substring
    • Conditions
    • Actions
      • Item - Pick every item in Region 000 <gen> and do (Actions)
        • Loop - Actions
          • Item - Hide (Picked item)
To try this open a map, create a region, create some item on this region, test the map and type hide to see how items get removed and show to unhide them again. Now, you will use the same actions (Events are just for you to test the map yourself) to show the items then pick the items that have been unhide then add them to the shop after that hide them again to make sure no one picks them.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Unhide the items before removing/adding them to the shop.

I'll give you 2 triggers on how to show/hide item in region.

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing show as A substring
    • Conditions
    • Actions
      • Item - Pick every item in Region 000 <gen> and do (Actions)
        • Loop - Actions
          • Item - Show (Picked item)
  • Untitled Trigger 001 Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as A substring
    • Conditions
    • Actions
      • Item - Pick every item in Region 000 <gen> and do (Actions)
        • Loop - Actions
          • Item - Hide (Picked item)
To try this open a map, create a region, create some item on this region, test the map and type hide to see how items get removed and show to unhide them again. Now, you will use the same actions (Events are just for you to test the map yourself) to show the items then pick the items that have been unhide then add them to the shop after that hide them again to make sure no one picks them.

I don't understand though, if pick all items picks them regardless if the items are hidden or not, why do I have to unhide them and then do pick all items AGAIN on them and then remove them from the market places? My trigger a moment ago to remove the items from the shop should have worked if it is picking the items regardless of hidden status.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Ok, give me some time to solve this. May be tomorrow its late now and my mind is becoming too confused.

But one last thing to say, if pick items in region worked with the items hidden then so be it add the new set of items. You told me you had another problem I don't understand what it is; explain it to me again.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Ok, give me some time to solve this. May be tomorrow its late now and my mind is becoming too confused.

But one last thing to say, if pick items in region worked with the items hidden then so be it add the new set of items. You told me you had another problem I don't understand what it is; explain it to me again.

Once I remove all the items, I wanted to add items back to the market place randomly, but I think I have figured out a way to do it without setting an item group. I made all the items I didn't want to show up set to level 0, and then made it so it adds random items from levels 1-8 to the shop. Adding them to an empty shop works, removing them doesn't.
 
Level 12
Joined
Dec 10, 2008
Messages
850
Star was onto the right trail. Make an item array variable and put down one of every item in a corner of your map. Then make a variable called Index, then make a trigger that picks a random item on the map, sets its index, remove the item, then increase Index by 1. Loop it to the max number of item you have. Then for your shop, make a trigger the loops up to the max you want. First, remove the item by using the removing command Star gave you. Then, set Index to a random number bettween 0 and the maximum items you indexed. Then add the item by using the item variable with Index in the [ ] part.

If it doesnt work, just say and I'll try it a differnt way.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Single Random Item Upgrade

Another better way to add random items.

Item is an array Item-Type variable of size 16 to store many item type as possible
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Item - Pick every item in Item Field <gen> and do (Actions)
        • Loop - Actions
          • Set i = (i + 1)
          • Set Item[i] = (Item-type of (Picked item))
          • Item - Remove (Picked item)
  • Upgrade Shop
    • Events
      • Player - Player 1 (Red) types a chat message containing upgrade as A substring
    • Conditions
    • Actions
      • Neutral Building - Remove Item[Rndm] from Marketplace 0011 <gen>
      • Set Rndm = (Random integer number between 1 and i)
      • Neutral Building - Add Item[Rndm] to Marketplace 0011 <gen> with 1 in stock and a max stock of 1
By adding the item type to a variable you now don't have to worry about the items in the region; just remove them as you no longer need them; you have stored their type into a variable and thats all that matters.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Are you sure that you can't create another unit in Object Editor and set its Items Sold field to a different one, and then you just replace the old market with the new one and with all its new items?
You could but its not effective as adding items to variables plus; you are restricted to the items that this building sells and can't have random items.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Maybe you could make in Object Editor-->Items an item named Random Level 1 Item, and Random Level 2 Item, and so on. And, like, when the player buys Random Level 1 Item, he gains a random item of level 1..?
What do you mean by 'make an item named Random Level 1 Item' I never found anything like that in the Object Editor. Explain more precisely, please.
 
Level 11
Joined
Jun 21, 2007
Messages
505
Alright, in the Object Editor you create a new item, that does absolutely nothing (a dummy item) and add it to the shop's "Items Sold" list.
When a hero buys that item, the item he bought is removed from his inventory and the hero gains a random item of level 1.
For the player to know item of what level he's going to buy, name the item "Random Level 1 Item"
Then you add in Object Editor "Random Level 2 Item" and so on. When hero buys "Random Level 2 Item" that item is removed from the game, and the hero acquires an absolutely random item of level 2 VIA TRIGGERS.
Will that go ok?

And here's another idea:
You make a shop with empty "Items Sold" list. In some moment via triggers you add 11 random to be sold in this shop. When you want to add different random items for sale in the shop, you simply replace the existing shop with a new one, that has initially empty "Items Sold" field, as set in Object Editor. Then you simply add random items again to a new, clear, empty shop.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Alright, in the Object Editor you create a new item, that does absolutely nothing (a dummy item) and add it to the shop's "Items Sold" list.
When a hero buys that item, the item he bought is removed from his inventory and the hero gains a random item of level 1.
For the player to know item of what level he's going to buy, name the item "Random Level 1 Item"
Then you add in Object Editor "Random Level 2 Item" and so on. When hero buys "Random Level 2 Item" that item is removed from the game, and the hero acquires an absolutely random item of level 2 VIA TRIGGERS.
Will that go ok?

And here's another idea:
You make a shop with empty "Items Sold" list. In some moment via triggers you add 11 random to be sold in this shop. When you want to add different random items for sale in the shop, you simply replace the existing shop with a new one, that has initially empty "Items Sold" field, as set in Object Editor. Then you simply add random items again to a new, clear, empty shop.
What about the price ? That random item is only one item with fixed price that means that all Random item of L1 has the same cost; I think that is not logical and even if you try to create a variable to correct the price of the item bought still that Rndm Item of L1 still has fixed price text description.
 
Level 11
Joined
Jun 21, 2007
Messages
505
Then use another idea:
You make a shop with empty "Items Sold" list. In some moment via triggers you add 11 random items to be sold in this shop. When you want to add different random items for sale in the shop, you simply replace the existing shop with a new one, that has initially empty "Items Sold" field, as set in Object Editor. Then you simply add random items again to a new, clear, empty shop.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Then use another idea:
You make a shop with empty "Items Sold" list. In some moment via triggers you add 11 random items to be sold in this shop. When you want to add different random items for sale in the shop, you simply replace the existing shop with a new one, that has initially empty "Items Sold" field, as set in Object Editor. Then you simply add random items again to a new, clear, empty shop.

If you are convinced by your way then so be it. For me I am not convinced because its not logical to create many shops that carry a special set of items for just that I want a new set every period; its much more easier to add a random set of items to the shop using variables. However if you still see you way is best then use it (and no offense meant)
 
Level 11
Joined
Jun 21, 2007
Messages
505
The way I propose is not for me, for madmuffin.
Personally, I think that idea of random items in a shop is bad, and the final answer to the question "Any way to make an item group?" is "No way".
Unless you place that item into a region (which is impossible to be seen by players), and when you need all items in that region (or their item-types), you pick all items that are in it.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Final word to madmuffin.

If you want to add Items to a shop, create regions that everyone of them represent an item set. There are two ways to add them to the shop; first: pick every item in a region and add picked item to an Item-Type-Array variable then remove that item since it is stored in a variable, then use that variable to add/remove it to/from the shop. Second way is to leave the items and don't store them in a variable but hide them so no one pick them (you still can pick them while they are hidden) and add/ remove them the same way as the in first case. Also, I have been thinking that a hero can drop an item on a specific region which will result in adding/removing that type of the dropped item, don't worry about that simply add a condition to check if the picked item is hidden or not; that way will ensure that the picked item are those that you hide them.
 
Status
Not open for further replies.
Top