[Solved] Trigger AI Buy Item From Shop

Status
Not open for further replies.
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.
 
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.
Back
Top