• 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] Trigger AI Buy Item From Shop

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2013
Messages
1,105
The best way to do this I can think of is...

At the start of the map you create a dummy that the shop can select (i.e. no locust).
Then whenever you want your AI to buy this item, you call a trigger that orders a neutral player /unused computer or whomever is free and can own the dummy and Order them by Id to buy the item. (Make sure they have enough gold or whatever is needed.)
Then you can just instantly remove the item from the dummy and create and give the item to the AI's hero.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Create a trigger: give it the events Unit is issued an order targeting an object/targeting a point/no target.
Edit: Buying an item will be a no target order.

Then in the actions.

JASS:
call BJDebugMsg("Order ID: " + I2S(GetIssuedOrderId()))

This will spit out a number then when you want to order your dummy to do that id you call:

JASS:
 call IssueImmediateOrderById(udg_yourUnit, #####)
 
Last edited:
Status
Not open for further replies.
Top