HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Make hero purchase item

04-08-2004, 12:31 PM#1
marshall
I'm making a trigger-based AI and can't figure out how to order a unit/hero to purchase an item from a shop. How do I do this?
04-08-2004, 01:42 PM#2
johnfn
I just quickly looked around; theres nothing that I saw (ok there probably is, but still). My best idea is that you use a trigger to subtract the gold from the AI's goldstock and give the hero near the shop the item he wants. There's probably a much better way, anyone have an idea?
04-08-2004, 01:54 PM#3
marshall
The only problem with that method is how do I subtract the item from the shop? (the shop in question only has items of stock 1, with a long recharge)
04-08-2004, 02:04 PM#4
johnfn
Thats what I was thinking too ://... If the computer is the only one to buy from the shop, then just make it not able to for however long the stock recharge is. I quite honestly do not know how to do it if there are humans buying from the shop as well. (goes to look around...) ARGH! there just is no way! Does anyone else know how to do this, because i have no idea.
04-08-2004, 10:07 PM#5
Vexorian
What I do in VexHA is to use this native :
Code:
native IssueNeutralImmediateOrderById   takes player forWhichPlayer,unit neutralStructure, integer unitId returns boolean

to call it use Custom Script: call IssueNeutralImmediateOrderById(udg_PlayerVar, udg_NeutralBuilding, udg_ItemType)

Have a player variable PlayerVar, a unit variable NeutralBuilding and an item type variable ItemType, set the variables to the player, neutral building and item type, and then call the custom script line.
04-08-2004, 11:27 PM#6
marshall
Okay I think I understand that. But how do I say which hero unit should go to purchase the item-type?
That code takes variables of 'player', 'neutral building' and 'item-type', but not 'unit'.
04-09-2004, 02:42 PM#7
Vexorian
The hero should be close to the neutral building, (it works like clicking on the item in the building )