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

[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