HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simulating AI interacting with shops

05-03-2008, 05:30 PM#1
kennyjie
I've had a look around and besides theres not alot of AI stuff anyway. Well I have created a AI buy system where buying is simulated e.g Using UnitAddItem to add a created item to the units inventory.

For some reason when i use UnitAddItem, it lags, i've tried UnitAddItemById, and UnitAddItemByIdSwapped. All lag .. maybe because i have say 9 AI's buying items at the same time. But anyway that is one of my problems

What i want to know is, can we use Jass to simulate interaction with a shop? I've looked through the API's but there isnt much. There api for unit pawning or selling item, which ive tried but didnt work ( i assume because its for actual players interacting with the shop) So i was wondering if any1 has done AI and Shop interaction?
05-03-2008, 05:38 PM#2
moyack
You don't need to simulate buy orders!!!! :)

use these functions:

Collapse JASS:
IssueNeutralImmediateOrder
IssueNeutralImmediateOrderById
IssueNeutralPointOrder
IssueNeutralPointOrderById
IssueNeutralTargetOrder
IssueNeutralTargetOrderById
05-03-2008, 06:02 PM#3
kennyjie
hmm interesting... I just thought those natives were there for the sake of being there :D ... well now i know they are of some use.

i've done a bit of searching and found this thread which provides details of some of those natives

http://www.wc3campaigns.net/showthread.php?p=908301

Now i assume it says neutral orders for a reason such as buying an item from the goblin merchant (neutral shop) etc.. but what if we were to buy items from a player shop e.g. a shop owned by a player like the vault, or wonders? we just use the normal unit orders?

So to buy an item from the goblin merchant for example ... is it as simple as

IssueNeutralTargetOrderById(*Buying Unit*, *ItemTypeId*, *Goblin Merchant(unit)*) ?

or would ItemTypeId need to be a buy order? Would be great if there was instructions and examples for these natives

thx :DD