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

AI? Help?

Status
Not open for further replies.
Level 6
Joined
Jun 23, 2005
Messages
195
I´v been wondering if you can create ai with the ai tutorial in we or you need to use triggers? for custom map..

I want to make heroes cast certain spells and maybe flee when needed and some buildings to produce units when enemies gets close. I know how to do these with triggers, but it wouldnt be perfect, and maybe kinda lame...so any way to do it with ai? or maybe some good advice with making ai?
 
Level 15
Joined
Feb 15, 2006
Messages
851
If you want full control controlling the abilities on heroes, and how every hero should behave according to any situation, then it's better to do an AI based on triggers.

AI scripting is to control AI players, not specific units, because you do an script of the style "order to AI to build a house, the a barrack" the AI automatically select some peons in the group of units owned by the AI palyer and complies the orders.

Anyways, you can take advantage of the hardcoded AI, you can create a dummy AI only to activate the control of the abilities on AI computers. To do it, create a code in this way:
JASS:
function main takes nothing returns nothing
    call InitAI()
endfunction

Save this code as an *.ai file, inject it to the map and create a trigger that assign to AI players this AI file. With this, the units controlled by this AI can be manipulated safety with triggers and react against the enemies with the abilities enabled.
 
Level 8
Joined
May 13, 2007
Messages
392
Here is an idea for how to make heroes flee back to the base when in danger :

Event - Every 1 second
Condition - Life of (a unit) is less than or equal to 250 (e.g)
Actions - Order (that unit) to move to (the base (a region or a unit)

About the building to create units

Events - Unit comes within (range) of (ur building)
Conditions - Triggering unit is owned by (a player)
Actions - Order (ur building) to build/train a (unit)
 
Status
Not open for further replies.
Top