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

[Solved] Item Group

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
Eh... a group of item-types, or actual items?
Your question is a bit too vague.

If it's regular items, you can do it like this:
  • Item - Pick every item in Items <gen> and do (Actions)
    • Loop - Actions
      • Hero - Give (Picked item) to Paladin 0005 <gen>
The region "Items" is somewhere hidden and it contains all items that should be given to the hero.


If you mean item-types, it would be possible to do this with a variable array:
store all item-types in the variable and then loop from 1 to (item amount) and give the item with that array to the hero.
You can create multiple item-type groups with a single variable by the way.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You can initialize all item-lists like this:
  • Actions
    • -------- === Item Lists === --------
    • -------- List 0 --------
    • Set ItemList[0] = Claws of Attack +15
    • Set ItemList[1] = Crown of Kings +5
    • Set ItemList[2] = Kelen's Dagger of Escape
    • Set ItemList[3] = Mask of Death
    • Set ItemList[4] = Orb of Frost
    • Set ItemList[5] = Ring of Protection +5
    • -------- List 1 --------
    • Set ItemList[6] = Boots of Speed
    • Set ItemList[7] = Periapt of Vitality
    • Set ItemList[8] = Belt of Giant Strength +6
    • -------- List 2 --------
    • Set ItemList[12] = Inferno Stone
    • Set ItemList[13] = Demonic Figurine
    • -------- List 3 --------
    • Set ItemList[18] = Tome of Agility
    • Set ItemList[19] = Tome of Intelligence
    • Set ItemList[20] = Tome of Strength
    • Set ItemList[21] = Tome of Experience
Each list an have up to 6 item-types.
The list arrays range from 0-5, 6-11, 12-17 and so on (always from a multiple of 6 to that number +5).

Giving the list is as easy as this:
  • Actions
    • -------- Which list to give? --------
    • Set TempInt1 = 0
    • -------- Give the list --------
    • For each (Integer A) from (TempInt1 x 6) to ((TempInt1 x 6) + 5), do (Actions)
      • Loop - Actions
        • Hero - Create ItemList[(Integer A)] and give it to Hero
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
in example of maker, the variables Item-Type and Integers are used only temporarily?
Indeed, they are.
i'm making one new system, then i need create several lists of Item-Type, for create this items when necessary.
Wait, what system are you creating?
Also, you just want a few item lists so you can easily give them to a hero, nothing more?
 
yes, several lists defined, so that i can create the items of lists when necessary

example:
---list 1---
Helmet, Sword, Shield

---list 2---
Book, Potion, Potion

---list 3---
bow, cape

when i create the list 1 for hero, then create one helmet, sword and shield. and can create it several times.

I know that is not part of the topic, more what I should use in numbers of hashtable? ( x of y Hashtable).
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
If the lists are not unit specific you can most likely do it like ap0c showed, that is a good method. However if the lists are unit specific, you can use a hashtable. You can create the lists there in a similar fashion.

List 1
Save type1 as 0 of unitHandle in hashtable
Save type2 as 1 of unitHandle in hashtable
Save type3 as 2 of unitHandle in hashtable
Save type4 as 3 of unitHandle in hashtable
Save type5 as 4 of unitHandle in hashtable

List 2
Save type6 as 5 of unitHandle in hashtable
Save type7 as 6 of unitHandle in hashtable

List 3
Save type8 as 10 of unitHandle in hashtable
Save type9 as 11 of unitHandle in hashtable
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
I do not understand much about hashtables, more because you used unitHandle?
Maker's system would be good if you have different heroes and each hero type has his own, personal, item-type list.
An archer could have a bow, cape and arrows in the first list, while a warrior could have a sword, chainmail and shield in the first list.
This is where the "unitHandle" comes into play: you save an item list for a specific unit-type.

Hashtables are a very good tool to differentiate between different item/unit types and do specific things with them.

I really think you should use the array-method in your case.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Forget about hashtables for now.

Look at my fourth post and re-create that system.
Test it, see if it works the way you want it to work.
If it doesn't work at all, then there's some bug.
If it doesn't have the full functionality you want, then we can talk about hashtables (and you'll have to explain it a bit more properly).

(Sorry Maker, I have a feeling this wouldn't go anywhere if we stuck with hashtables)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
because use variables Item-Type with array would hard to me, because i'm use arrays for other thing.
Huh? That doesn't matter at all: you can use arrays for anything you like, it doesn't make it any harder.
Explain yourself a bit more clearly.

You can make it so that the hashtable-method is very similar to the array-method, but hashtables are slower.
Seriously, use arrays for this.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Okay, I lost you. I have no idea what you're talking about anymore.

You need to create a list, correct?
A hero can have a maximum of 6 items, so each list can have up to 6 items in it, right?
If so, then you will always need up to 6 configuration actions for each list. Whether you use hashtables or arrays doesn't even matter in that case.

It IS the most practical way of doing this.
What did you think? That hashtables automatically configure everything for you? They don't.
 
we're a little lost even, sorry I do not know much about English, so sometimes it gets a little hard to explain or understand the answers.

I did something in hashtables, was wondering if this could work. Look:

  • Set ItemType = Orb of Frost
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 1 of 1 in Hastable
after for load
  • Set Integer = (Load 1 of 1 from Hastable)
  • Custom script: set udg_ItemType = udg_Integer
  • Item - Create ItemType at (Center of Region 000 <gen>)
in the system, i making one variable item-type with array (1,2,3,4,5) in this case i can use array (1,2,3,4,5) for all quests, because he is temporary, and after i make one Loop integer A for save it in Hashtable
(Save integer as Integer A of QUEST NUMBER in Hashtable).
and for load do the same unlike :ogre_haosis:

Work?
 
the arrays are unique, example:

---List 1--
ItemType [1] = Mask
ItemType [2] = Helmet
ItemType [3] = Shield

---List 2---
ItemType [7] = Cape
ItemType [8] = Boots

---List 3---
ItemType [13] = Potion

done in hashtable, the arrays will always (1,2,3,4,5,6), no need to change the arrays for 6 multiples, equal to example above.
I want people have the minimum of work for create its quests.
thereby people will switch only the values necessary as the o creep type must kill and level necessary for start the quest and etc.

more there is a problem with the hashtables?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I want people have the minimum of work for create its quests.


  • -------- List 1 --------
  • Set TempInt1 = 1
  • Set ItemList[((6 x TempInt1) + 1)] = Claws of Attack +15
  • Set ItemList[((6 x TempInt1) + 2)] = Crown of Kings +5
  • Set ItemList[((6 x TempInt1) + 3)] = Kelen's Dagger of Escape
  • Set ItemList[((6 x TempInt1) + 4)] = Mask of Death
  • Set ItemList[((6 x TempInt1) + 5)] = Orb of Frost
  • Set ItemList[((6 x TempInt1) + 6)] = Ring of Protection +5
  • -------- List 2 --------
  • Set TempInt1 = 2
  • Set ItemList[((6 x TempInt1) + 1)] = Boots of Speed
  • Set ItemList[((6 x TempInt1) + 2)] = Periapt of Vitality
  • Set ItemList[((6 x TempInt1) + 3)] = Belt of Giant Strength +6

  • -------- List 1 --------
  • Set TempInt1 = 1
  • Set ItemType = Claws of Attack +15
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 1 of TempInt1 in Hastable
  • Set ItemType = Crown of Kings +5
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 2 of TempInt1 in Hastable
  • Set ItemType = Kelen's Dagger of Escape
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 3 of TempInt1 in Hastable
  • Set ItemType = Mask of Death
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 4 of TempInt1 in Hastable
  • Set ItemType = Orb of Frost
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 5 of TempInt1 in Hastable
  • Set ItemType = Ring of Protection +5
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 6 of TempInt1 in Hastable
  • -------- List 2 --------
  • Set TempInt1 = 2
  • Set ItemType = Boots of Speed
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 1 of TempInt1 in Hastable
  • Set ItemType = Periapt of Vitality
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 2 of TempInt1 in Hastable
  • Set ItemType = Belt of Giant Strength +6
  • Custom script: set udg_Integer = udg_ItemType
  • Hashtable - Save Integer as 3 of TempInt1 in Hastable
Comparison:
Arrays: 2-7 values needs to be changed per list (1x "TempInt1" and 1-6x "ItemList[...]"), the rest can be copy//pasted.
Hashtables: 2-7 values need to be changed per list (1x "TempInt1", 1-6x "ItemType"), the rest can be copy/pasted.

Conclusion: the user has as much work with hashtables as he would with arrays, but arrays are faster and shorter.

more there is a problem with the hashtables?
Nope, hashtables are pretty sweet for heavier systems.
 
or could be done so:

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ItemType[1] = Orb of Frost
      • Set ItemType[2] = Mask of Death
      • Set ItemType[3] = Kelen's Dagger of Escape
      • Set ItemType[4] = Heart of Aszune
      • Set ItemType[5] = Ring of Protection +5
      • Set ItemType[6] = Crown of Kings +5
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Custom script: set udg_Integer = udg_ItemType [bj_forLoopAIndex]
          • Hashtable - Save Integer as (Integer A) of QuestNumber in Hastable
what do you think?
 
Status
Not open for further replies.
Top