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

[Hero Arena] AI Buying Item

Status
Not open for further replies.
Level 2
Joined
Apr 13, 2011
Messages
13
Hello guys.
I am doing a simple Hero Arena map, and I don't want to use jass, just plain simple triggering. I'm not even triggering the spells, only some minor events that I'm putting inside the map.
But there is something bothering me. I put some itens on the Goblind Merchant, but the AI heroes don't buy any of it. I know that if I change some itens from the Races's mellee shop they will buy, and I'm wodering if you could post a list of these itens that the mellee AI buy by themselves.

PS: BTW, I'm using the AI Editor to make these Heroes, it's lame I know, but is just don't want to use Jass in this map :ogre_haosis:
 
Level 28
Joined
Oct 28, 2011
Messages
4,759
Well here is a simple way to do that.

Store items in "Item-type" variable array and the gold cost in "Integer" variable array then:

Put this in your initialization trigger

  • Set Item[1] = Boots of Speed
  • Set ItemCost[1] = 500
  • Set Item[2] = Mask of Death
  • Set ItemCost[2] = 900

then

  • Events
    • Unit - A unit comes within 800.00 of YOUR_SHOP <gen>
  • Conditions
    • ((Owner of (Triggering unit)) controller) Equal to Computer
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • For each (Integer A) from 1 to 2, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Owner of (Triggering unit)) Current gold) Greater than or equal to ItemCost[(Integer A)]
          • Then - Actions
            • Hero - Create Item[(Integer A)] and give it to (Triggering unit)
            • Player - Add (0 - ItemCost[(Integer A)]) to (Owner of (Triggering unit)) Current gold
          • Else - Actions

Don't forget to change "2" from "1 to 2" depending on how many items you have.
 
Status
Not open for further replies.
Top