Exide
I am amazingly focused right now!
- Reaction score
- 448
Hi.
I believe I've done something similar to this a long time ago, in WC3. However I can't really remember how I did it, so here I am.
I have got a global string variable; "InventoryItem" with an array of 99.
I made this trigger as a test:
This creates an inventory.
Now I want to count how many of each items I have, so that the list will look like this:
Item 1: Potion - amount: 2
Item 2: Ether - amount: 2
Item 3: Phoenix Down - amount: 3
and so on..
To do this I somehow need to create a loop that compares each InventoryItem with every other InventoryItem.
Help appriciated.
(I will update this thread when/if I make progress on how to do this myself.)
I believe I've done something similar to this a long time ago, in WC3. However I can't really remember how I did it, so here I am.
I have got a global string variable; "InventoryItem" with an array of 99.
I made this trigger as a test:
Trigger:
- createInventory
- Events
- Game - Map initialization
- Local Variables
- Conditions
- Actions
- Variable - Set InventoryItem[1] = "potion"
- Variable - Set InventoryItem[2] = "ether"
- Variable - Set InventoryItem[3] = "phoenix down"
- Variable - Set InventoryItem[4] = "testtest"
- Variable - Set InventoryItem[12] = "potion"
- Variable - Set InventoryItem[25] = "ether"
- Variable - Set InventoryItem[85] = "phoenix down"
- Variable - Set InventoryItem[99] = "phoenix down"
- Events
This creates an inventory.
Now I want to count how many of each items I have, so that the list will look like this:
Item 1: Potion - amount: 2
Item 2: Ether - amount: 2
Item 3: Phoenix Down - amount: 3
and so on..
To do this I somehow need to create a loop that compares each InventoryItem with every other InventoryItem.
Help appriciated.
(I will update this thread when/if I make progress on how to do this myself.)