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

[Trigger] Can you help me about making a simple AI

Status
Not open for further replies.
I have 12 heroes in 2 teams. If a hero is controlled by computer then order him to move-attack( to the center of a region(which will be in the other team's zone).

  • Events
  • Time - elapsed game time is 15.00 seconds.
  • Conditions
  • (Player X controller) Equal to computer
  • Actions
  • ?
else: and also it won't be bad <if hero X auto-attack unit>, to cast(after x secs) <spell X>
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Picked unit)) controller) Equal to Computer
        • Then - Actions
          • Attack order
        • Else - Actions

http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
The simplest AI is a very basic decision tree with decision priorities and some basic state information.

Give each hero a Boolean defining if they are in attack mode or defence mode. If in attack mode them order them to attack move to an enemy base. If in defence mode order them to retreat one of your bases. If in defence mode and near an enemy base, order them to move back to one of your bases. If in attack mode and health less than 30% order them to defence mode. If in defence mode and health is near 100% and no enemies near base then order them to attack mode. If in defensive mode and at base then buy base items.

These statements can be used to make a very simple attack, retreat and defend AI. It will show some form of self preservation, some form of willingness to attack an some form of idea that it is defending something. It should be able to give some poor players a run for their money but can easily be fooled with assassinations (nuke attacks) and has no concept of team work.
 
Status
Not open for further replies.
Top