• 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.

How to make an AI buy items?

Status
Not open for further replies.
Level 6
Joined
Feb 16, 2014
Messages
193
I'm making a shooter map and i want the AI to buy a weapon everytime it has enough money to buy it so how to do that?:vw_wtf:
 
Level 15
Joined
Feb 15, 2006
Messages
851
You can't. You have to manually reduce gold, then add items once they come in range of the shop.

In fact, you actually can, there's some special functions in jass to do this.

http://jass.sourceforge.net/doc/api/common_j-source.shtml#1636

JASS:
native IssueNeutralImmediateOrder       takes player forWhichPlayer, unit neutralStructure, string unitToBuild returns boolean
native IssueNeutralImmediateOrderById   takes player forWhichPlayer,unit neutralStructure, integer unitId returns boolean
native IssueNeutralPointOrder           takes player forWhichPlayer,unit neutralStructure, string unitToBuild, real x, real y returns boolean
native IssueNeutralPointOrderById       takes player forWhichPlayer,unit neutralStructure, integer unitId, real x, real y returns boolean
native IssueNeutralTargetOrder          takes player forWhichPlayer,unit neutralStructure, string unitToBuild, widget target returns boolean
native IssueNeutralTargetOrderById      takes player forWhichPlayer,unit neutralStructure, integer unitId, widget target returns boolean

I don't remember which suits the need of buying items (I think it's "IssueNeutralImmediateOrder" or "IssueNeutralImmediateOrderById").

I hope it helps :)
 
Level 6
Joined
Feb 16, 2014
Messages
193
Lol i dont think i can do that in JASS because im not very good with it. Anyway my map's almost finished i only need to make the AI now. :D
 
Status
Not open for further replies.
Top