• 🏆 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!

[AI] Item Pools

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hi guys. I am learning JASS and I would like to convert my GUI AI to JASS. The main thing I would like to do is convert the AI's item builds to JASS. Can someone help me or point me to a good tutorial? I have heard about item pools but don't know how to use them.

I would like to have 3 item builds to start off with - one for each agility, intelligence and strength heroes.

Thanks for any help. You will get +rep and credits in my map!
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
you could make a sort of item list. This stores an item type and a point value in order of magnitude of point value. The AI aquires the lowest (usually cheapest) point value item first. It then progresses sequentially down the list and discardes the lowest point value item. You can also optionally add a number field if you want the AI to have more than 1. You might wish to have many such item systems compete for piority and change piority depending on enemies for better item builds. An example of a competing item piority could be a potion (always make sure AI has a potion early on and make sure it does so before buying new items).
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
JASS:
set table = InitHashtable()
call SaveStr(table,'I000',0,"Some value stored here, use different native for different type.")
set somestr = LoadStr(table,'I000',0)

As you know, 'I000' is the default custom item ID. Anything that returns an item ID integer can be used on that field.
 
Status
Not open for further replies.
Top