• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[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:
  • 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

https://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
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.
Back
Top