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

[GUI] AI System v2.2.4

GUI AI System

AI system made by GUI. No need to use JASS anymore!!

-The AI does list-

+This AI will look for targets and attacks them.
+AI retreats if they know they are going to lose the battle.
+AI defends base.
+AI hero retreats when they are dying.
+AI hero picks items. And uses them.
+AI heroes learns skills.


-The AI does not list-

-Buy items from shop. (The AOS version of this system has a item buy system try it.)
-Use skills. (I recomend to use the blizzard's order string.)

If you don't have heroes, it's easy. Copy and paste and change the arrays of the vairable to 12. If you have heroes, you have to set the skill build. If you don't know how to set the skill build, ask me.

1. The initial size of variables except for "FightingForceStrength" must be 12. For "FightingForceStrength" it must be set to 2.
2. In "AI Is attacked" trigger, you can change when the AI retreats. The higher the value is the AI will feel strong (It means if the value is low, the AI will act like cowards). Also you can set the item pick range there.
3. To set skill build for custom heroes see the "AI Initialization" trigger.


wc3scrnshot021412144624.jpg

AI heroes retreat.
wc3scrnshot021412144547.jpg

wc3scrnshot021412144557.jpg

AI uses spells and picks skills.
wc3scrnshot021512130332.jpg

AI defends their base.
wc3scrnshot021512123757.jpg

AI flees battle that they know they are going to lose.


  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- Remove this line below when you import this --------
          • Player - For (Picked player), turn Shared vision On toward Player 1 (Red)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to Computer
            • Then - Actions
              • Set AITargetUnit[(Player number of (Picked player))] = No unit
              • Player Group - Add (Picked player) to AIPlayers
            • Else - Actions
      • Hashtable - Create a hashtable
      • Set AbilityHash = (Last created hashtable)
      • -------- Get the raw code of the Hero and the Ability. The first key is the raw code of the Hero and the second key is the level to learn it. --------
      • Custom script: set udg_TempInteger2 = 'Hpal'
      • Custom script: set udg_TempInteger = 'AHhb'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHds'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHad'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHre'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Hamg'
      • Custom script: set udg_TempInteger = 'AHbz'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHwe'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHab'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHmt'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Hmkg'
      • Custom script: set udg_TempInteger = 'AHtb'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHtc'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHbh'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHav'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Hblm'
      • Custom script: set udg_TempInteger = 'AHfs'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHbn'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHdr'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AHpx'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Obla'
      • Custom script: set udg_TempInteger = 'AOwk'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOmi'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOcr'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOww'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Ofar'
      • Custom script: set udg_TempInteger = 'AOcl'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOfs'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOsf'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOeq'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Otch'
      • Custom script: set udg_TempInteger = 'AOsh'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOws'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOae'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOre'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Oshd'
      • Custom script: set udg_TempInteger = 'AOhw'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOhx'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOsw'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AOvd'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Udea'
      • Custom script: set udg_TempInteger = 'AUdc'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUdp'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUau'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUan'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Ulic'
      • Custom script: set udg_TempInteger = 'AUfn'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUfa'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUdr'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUdd'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Udre'
      • Custom script: set udg_TempInteger = 'AUcs'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUsl'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUav'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUin'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Ucrl'
      • Custom script: set udg_TempInteger = 'AUim'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUcb'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUts'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AUls'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Ekee'
      • Custom script: set udg_TempInteger = 'AEer'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEfn'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEah'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEtq'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Emoo'
      • Custom script: set udg_TempInteger = 'AEst'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEfa'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEar'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEsf'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Edem'
      • Custom script: set udg_TempInteger = 'AEmb'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEim'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEev'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEme'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
      • Custom script: set udg_TempInteger2 = 'Ewar'
      • Custom script: set udg_TempInteger = 'AEfk'
      • Hashtable - Save TempInteger as TempInteger2 of 1 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 4 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 8 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEbl'
      • Hashtable - Save TempInteger as TempInteger2 of 2 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 5 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 9 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEsh'
      • Hashtable - Save TempInteger as TempInteger2 of 3 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 7 in AbilityHash
      • Hashtable - Save TempInteger as TempInteger2 of 10 in AbilityHash
      • Custom script: set udg_TempInteger = 'AEsv'
      • Hashtable - Save TempInteger as TempInteger2 of 6 in AbilityHash
  • AI Every 2 sec
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Matching unit) is alive) Equal to True))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in AIPlayers and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Picked unit)) Equal to (Picked player)
                  • ((Picked unit) is A peon-type unit) Equal to False
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is in AIInjuredHeroes[(Player number of (Picked player))]) Equal to False
                  • ((Picked unit) is in AIUnits[(Player number of (Picked player))]) Equal to False
                  • ((Picked unit) is in CastingAIUnits) Equal to False
                • Then - Actions
                  • Unit Group - Add (Picked unit) to AIUnits[(Player number of (Picked player))]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to AIHeroes[(Player number of (Picked player))]
                    • Else - Actions
                • Else - Actions
      • Player Group - Pick every player in AIPlayers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AITargetUnit[(Player number of (Picked player))] Equal to No unit
            • Then - Actions
              • Set AITargetUnit[(Player number of (Picked player))] = (Random unit from TempGroup)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of AITargetUnit[(Player number of (Picked player))]) is an ally of (Picked player)) Equal to True
                • Then - Actions
                  • Set AITargetUnit[(Player number of (Picked player))] = No unit
                • Else - Actions
              • Set TempPoint = (Position of AITargetUnit[(Player number of (Picked player))])
              • Unit Group - Order AIUnits[(Player number of (Picked player))] to Attack-Move To TempPoint
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
              • Set TempPoint = (Position of AITargetUnit[(Player number of (Picked player))])
              • Unit Group - Order AIUnits[(Player number of (Picked player))] to Attack-Move To TempPoint
              • Custom script: call RemoveLocation(udg_TempPoint)
          • Unit Group - Pick every unit in AIHeroes[(Player number of (Picked player))] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Percentage life of (Picked unit)) Less than 35.00
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from AIUnits[(Player number of (Picked player))]
                  • Unit Group - Add (Picked unit) to AIInjuredHeroes[(Player number of (Picked player))]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of items carried by (Picked unit)) Less than 6
                • Then - Actions
                  • Item - Pick every item in (Playable map area) and do (Actions)
                    • Loop - Actions
                      • Set TempPoint = (Position of (Picked item))
                      • Set TempPoint2 = (Position of (Picked unit))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between TempPoint and TempPoint2) Less than 500.00
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Item-type of (Picked item)) Equal to Tome of Power
                              • (Hero level of (Picked unit)) Equal to 10
                            • Then - Actions
                            • Else - Actions
                              • Unit - Order (Picked unit) to Right-Click (Picked item)
                        • Else - Actions
                      • Custom script: call RemoveLocation(udg_TempPoint)
                      • Custom script: call RemoveLocation(udg_TempPoint2)
                • Else - Actions
          • Unit Group - Pick every unit in AIInjuredHeroes[(Player number of (Picked player))] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Percentage life of (Picked unit)) Less than 100.00
                • Then - Actions
                  • Set TempPoint = ((Picked player) start location)
                  • Unit - Order (Picked unit) to Move To TempPoint
                  • Custom script: call RemoveLocation(udg_TempPoint)
                • Else - Actions
                  • Unit Group - Add (Picked unit) to AIUnits[(Player number of (Picked player))]
                  • Unit Group - Remove (Picked unit) from AIInjuredHeroes[(Player number of (Picked player))]
      • Custom script: call DestroyGroup(udg_TempGroup)
  • AI Remove Dead Unit
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Unit Group - Remove (Triggering unit) from CastingAIUnits
      • Player Group - Pick every player in AIPlayers and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Triggering unit) from AIUnits[(Player number of (Picked player))]
          • Unit Group - Remove (Triggering unit) from AIInjuredHeroes[(Player number of (Picked player))]
          • Unit Group - Remove (Triggering unit) from AIHeroes[(Player number of (Picked player))]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to AITargetUnit[(Player number of (Picked player))]
            • Then - Actions
              • Set AITargetUnit[(Player number of (Picked player))] = No unit
            • Else - Actions
  • AI Is attacked
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set AITargetUnit[(Player number of (Owner of (Attacked unit)))] = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) controller) Equal to Computer
          • AIIsDefendingBase[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Set TempPoint = (Position of (Attacking unit))
          • Set TempGroup = (Units within 1200.00 of TempPoint matching (((Owner of (Matching unit)) is an ally of (Owner of (Attacking unit))) Equal to True))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set FightingForceStrength[1] = (FightingForceStrength[1] + (Life of (Picked unit)))
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Set TempPoint = (Position of (Attacked unit))
          • Set TempGroup = (Units within 1200.00 of TempPoint matching (((Owner of (Matching unit)) is an ally of (Owner of (Attacked unit))) Equal to True))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set FightingForceStrength[2] = (FightingForceStrength[2] + (Life of (Picked unit)))
          • Custom script: call DestroyGroup(udg_TempGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (FightingForceStrength[1] - FightingForceStrength[2]) Greater than or equal to 3500.00
            • Then - Actions
              • Set TempPoint2 = ((Owner of (Attacked unit)) start location)
              • Unit Group - Order AIUnits[(Player number of (Owner of (Triggering unit)))] to Move To TempPoint2
              • Custom script: call RemoveLocation(udg_TempPoint2)
            • Else - Actions
          • Set AITargetUnit[(Player number of (Owner of (Triggering unit)))] = No unit
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Set FightingForceStrength[1] = 0
          • Set FightingForceStrength[2] = 0
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) controller) Equal to Computer
          • ((Triggering unit) is A structure) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in AIUnits[(Player number of (Owner of (Triggering unit)))] and do (Actions)
            • Loop - Actions
              • Set AIIsDefendingBase[(Player number of (Owner of (Triggering unit)))] = True
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • ((Picked unit) is A Hero) Equal to True
                      • ((Picked unit) is in CastingAIUnits) Equal to False
                      • AIIsDefendingBase[(Player number of (Owner of (Triggering unit)))] Equal to False
                • Then - Actions
                  • Hero - Order (Picked unit) to use (Item carried by (Picked unit) in slot 1) on (Attacked unit)
                  • Unit - Order (Picked unit) to Hold Position
                • Else - Actions
          • Wait 10.00 seconds
          • Set AIIsDefendingBase[(Player number of (Owner of (Triggering unit)))] = False
        • Else - Actions
  • AI Hero Learn Skill
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Custom script: call SelectHeroSkill( GetTriggerUnit(), LoadInteger(udg_AbilityHash, GetUnitTypeId(GetTriggerUnit()), GetUnitLevel(GetTriggerUnit())))
  • AI Hero Learn Skill 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Custom script: call SelectHeroSkill( GetTriggerUnit(), LoadInteger(udg_AbilityHash, GetUnitLevel(GetTriggerUnit()), GetUnitTypeId(GetTriggerUnit())))
  • AI Hero Cast
    • Events
      • Unit - A unit Starts the effect of an ability
      • Unit - A unit Begins casting an ability
      • Unit - A unit Begins channeling an ability
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Unit Group - Remove (Triggering unit) from AIUnits[(Player number of (Owner of (Triggering unit)))]
      • Unit Group - Add (Triggering unit) to CastingAIUnits
  • AI Hero Cast Stop
    • Events
      • Unit - A unit Stops casting an ability
      • Unit - A unit Finishes casting an ability
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Unit Group - Add (Triggering unit) to AIUnits[(Player number of (Owner of (Triggering unit)))]
      • Unit Group - Remove (Triggering unit) from CastingAIUnits

v1.0.1 Forgot to use the CastingAIUnits Group.
v1.1.1 Added Item Pick system
v1.2.1 AI now flee battles that they know that they are going to lose. AI defends their base.
v1.2.4 AI base defending bug is fixed.
Fixed a leak. (Thank Bribe)
v1.2.5 Cleaned some systems
v2 Fixed a lot of things. Now it is easier to import. (Thank Maker)
v2.1 Found out why the AI were acting like cowards.
v2.1.1 Finished the hero skill build.
v2.2.2 Fixed the hero skill learn system. (Thank Maker for the help)
v2.2.3 Fixed AI defend base system and skill learn system. (Thank Maker)
v2.2.4 Made it clear how to import.


Please give credits when used.

This CAN be used for AOS maps. Find my post on page 5 and download the map and try it. The AOS AI System Supports item buy.

WAIT!!! If you want a AOS AI System that includes hero chasing and better performance click HERE


Keywords:
AI, Computer, Hero, Arena, Target, Destroy, Retreat, Skill, Spell, AOS
Contents

GUI AI System (Map)

Reviews
Approved The system works, but it could be a lot more efficient and could provide more intelligent heroes. Required changes Add importing instructions into the map file including how to customize the skill build for heroes You also must...

Moderator

M

Moderator

Reviewed by Maker, AI System v2.2.4, 5th May 2012

Approved
The system works, but it could be a lot more efficient and could provide more intelligent heroes.

Reviewed by Maker, AI System v2.1.2, 8th Apr 2012

Required changes
  • Add importing instructions into the map file including how to customize the skill build for heroes
    You also must mention that the initial size of the arrays must be 12
Suggested changes
  • Instead of picking all items in the map, pick items inside a custom region. Center the region on the hero
  • The system causes FPS drop in the test map, but not as much as before.
    The every 2 seconds trigger is quite heavy still
  • Rename Initialization to AI Initilaization
  • Remove the vision and shared units actions from the initialization trigger
    Use different init trigger for that, one that doesn't belong to the system
  • Save picke unit into a variable in AI Every 2 sec to avoid repeated function calls
  • Remove unneeded variables
  • AI taget unit might be null when you order units to attack move to a position of that unit
    The units won't move anywhere, you could skip giving the order altogether
  • Use a variable for injured state value, set it at map initilaization
    You could also use variables for other values like item pick range
  • AI hero cast doesn't need Starts the effect of an ability event
Reviewed by Maker, [GUI] AI System v1.2.5, 2nd Apr 2012

Required changes
  • Don't set map spesific actions in your system's triggers
  • AI hero ability learn initialization is not done correctly
    Don't use BJ functions
    Save things for unit type id's
    It also leaks unit groups
  • The system causes FPS drop every 3 seconds in the test map
  • Don't pick all units in the map for every player every 3 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • (Owner of (Picked unit)) Equal to (Player((Integer A)))
            • ((Triggering unit) is A structure) Equal to False
            • ...
      • Then - Actions
      • Else - Actions
    ->
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Picked unit)) Equal to (Player((Integer A)))
        • ((Triggering unit) is A structure) Equal to False
        • ...
      • Then - Actions
      • Else - Actions
  • Learn to use player number to avoid integer loops.
    AI Remove Dead Unit trigger for example is very unefficient
  • AI Change Target trigger signals to me that the system is not MUI
  • In AI Attack you should check that the random unit is not null
  • AI Hero Learn Skill test trigger is very unefficient. I recommend using a hashtable and saving stuff with unit type id
  • I think AI Hero Cast trigger should have Begins casting an ability event
  • AI AI Pick Item trigger could use a group that has heroes only so you don't have to
    filter through tons on non hero units
18th Feb 2012
Bribe: Please seperate map-specific things into another section, for example you mingled the game message with your actual code, which is not a great idea.

I recommend instead of using "pick units matching conditions", to pick the units overall and then use an if/then/else (multiple actions) block to filter them out. For example, you could change the group actions in "AI Set Units" to this:

  • Set TempGroup = (Units owned by (Player((Integer A))))
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A structure) Equal to false
          • ((Picked unit) is dead) Equal to false
          • ((Picked unit) is in AIInjuredHeroes[(Integer A)]) Equal to false
          • ((Picked unit) is in AIUnits[(Integer A)]) Equal to false
          • ((Picked unit) is in CastingAIUnits) Equal to false
        • Then - Actions
          • Unit Group - Add (Picked unit) to AIUnits[(Integer A)]
        • Else - Actions
This makes it easier to configure and results in better code compression and CPU performance.
 
  • AI Hero Learn Skill
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Hero - Learn skill for (Triggering unit): Human Archmage - Mass Teleport
      • Hero - Learn skill for (Triggering unit): Human Archmage - Blizzard
      • Hero - Learn skill for (Triggering unit): Human Archmage - Summon Water Elemental
      • Hero - Learn skill for (Triggering unit): Human Archmage - Brilliance Aura
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Avatar
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Storm Bolt
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Thunder Clap
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Bash
      • Hero - Learn skill for (Triggering unit): Human Paladin - Resurrection
      • Hero - Learn skill for (Triggering unit): Human Paladin - Holy Light
      • Hero - Learn skill for (Triggering unit): Human Paladin - Divine Shield
      • Hero - Learn skill for (Triggering unit): Human Paladin - Devotion Aura
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Phoenix
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Flame Strike
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Banish
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Siphon Mana
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Bladestorm
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Wind Walk
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Mirror Image
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Critical Strike
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Earthquake
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Chain Lightning
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Far Sight
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Feral Spirit
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Big Bad Voodoo
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Healing Wave
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Hex
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Serpent Ward
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - Reincarnation
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - Shockwave
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - War Stomp
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - Endurance Aura
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Locust Swarm
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Impale
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Spiked Carapace
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Carrion Beetles
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Animate Dead
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Death Coil
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Death Pact
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Unholy Aura
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Inferno
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Carrion Swarm
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Sleep
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Vampiric Aura
      • Hero - Learn skill for (Triggering unit): Undead Lich - Death And Decay
      • Hero - Learn skill for (Triggering unit): Undead Lich - Frost Nova
      • Hero - Learn skill for (Triggering unit): Undead Lich - Frost Armor
      • Hero - Learn skill for (Triggering unit): Undead Lich - Dark Ritual
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Metamorphosis
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Mana Burn
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Immolation
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Evasion
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Tranquility
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Entangling Roots
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Force Of Nature
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Thorns Aura
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Starfall
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Scout
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Searing Arrows
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Trueshot Aura
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Vengeance
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Fan Of Knives
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Blink
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Shadow Strike
I see what you did there.
Seriously, this is a really bad idea :/
You should store the abilities in a hashtable for a unit in order with one of the keys being the level:

Key1: Hero Id
Key2: Level
Value: Ability Id
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
  • AI Hero Learn Skill
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Hero - Learn skill for (Triggering unit): Human Archmage - Mass Teleport
      • Hero - Learn skill for (Triggering unit): Human Archmage - Blizzard
      • Hero - Learn skill for (Triggering unit): Human Archmage - Summon Water Elemental
      • Hero - Learn skill for (Triggering unit): Human Archmage - Brilliance Aura
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Avatar
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Storm Bolt
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Thunder Clap
      • Hero - Learn skill for (Triggering unit): Human Mountain King - Bash
      • Hero - Learn skill for (Triggering unit): Human Paladin - Resurrection
      • Hero - Learn skill for (Triggering unit): Human Paladin - Holy Light
      • Hero - Learn skill for (Triggering unit): Human Paladin - Divine Shield
      • Hero - Learn skill for (Triggering unit): Human Paladin - Devotion Aura
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Phoenix
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Flame Strike
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Banish
      • Hero - Learn skill for (Triggering unit): Human Blood Mage - Siphon Mana
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Bladestorm
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Wind Walk
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Mirror Image
      • Hero - Learn skill for (Triggering unit): Orc Blademaster - Critical Strike
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Earthquake
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Chain Lightning
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Far Sight
      • Hero - Learn skill for (Triggering unit): Orc Far Seer - Feral Spirit
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Big Bad Voodoo
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Healing Wave
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Hex
      • Hero - Learn skill for (Triggering unit): Orc Shadow Hunter - Serpent Ward
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - Reincarnation
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - Shockwave
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - War Stomp
      • Hero - Learn skill for (Triggering unit): Orc Tauren Chieftain - Endurance Aura
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Locust Swarm
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Impale
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Spiked Carapace
      • Hero - Learn skill for (Triggering unit): Undead Crypt Lord - Carrion Beetles
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Animate Dead
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Death Coil
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Death Pact
      • Hero - Learn skill for (Triggering unit): Undead Death Knight - Unholy Aura
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Inferno
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Carrion Swarm
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Sleep
      • Hero - Learn skill for (Triggering unit): Undead Dreadlord - Vampiric Aura
      • Hero - Learn skill for (Triggering unit): Undead Lich - Death And Decay
      • Hero - Learn skill for (Triggering unit): Undead Lich - Frost Nova
      • Hero - Learn skill for (Triggering unit): Undead Lich - Frost Armor
      • Hero - Learn skill for (Triggering unit): Undead Lich - Dark Ritual
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Metamorphosis
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Mana Burn
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Immolation
      • Hero - Learn skill for (Triggering unit): Night Elf Demon Hunter - Evasion
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Tranquility
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Entangling Roots
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Force Of Nature
      • Hero - Learn skill for (Triggering unit): Night Elf Keeper Of The Grove - Thorns Aura
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Starfall
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Scout
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Searing Arrows
      • Hero - Learn skill for (Triggering unit): Night Elf Priestess Of The Moon - Trueshot Aura
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Vengeance
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Fan Of Knives
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Blink
      • Hero - Learn skill for (Triggering unit): Night Elf Warden - Shadow Strike
I see what you did there.
Seriously, this is a really bad idea :/
You should store the abilities in a hashtable for a unit in order with one of the keys being the level:

Key1: Hero Id
Key2: Level
Value: Ability Id

I'll fix that. Thank you for the correction.

EDIT : When I try to save an ability to a hashtable WE crashed. What wrong???
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
Where is the trigger for AI to use their abilities?
Does the AI automatically use their abilities?
When I create a custom ability, will the AI learns that ability automatically?

You can make AI cast spells automaticlly by changing the order string in the object editor. You need to add your custom abilities to the trigger to make AI heroes learn them. (Read "how to import") You can ask more if you don't know what I mean.

Magtheridon96 said:
World Editor crashes for a lot of reasons :/
How about you save the ability using integers. (Abilities ARE integers)

Ok. I'll try that.

EDIT :
  • Set HeroSkills[1] = Mass Teleport
  • Set HeroSkills[2] = Blizzard
  • Set HeroSkills[3] = Summon Water Elemental
  • Set HeroSkills[4] = Brilliance Aura
I have to do this for all abilities????
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
Ahaha... I just wish you make every one can easily use your system.. And I suggest you to make trigger for AI to uses their ability..

They use their ablilities. And it's easy to use. For example, you make a ablility that heals your units. Then set the order string to someting like "Heal" things. Then computer players will use it automaticlly. And just add your custom spell to the "AI Hero Learn Skill" trigger.
clipboard01oubf.jpg

Change it to someting you want.
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
To convert an ability to an integer, in custom script, do this:

  • Custom script: set udg_MyInteger = udg_MyAbility

Oh. Thank you. I'll do that.

EDIT : I think it changes nothing even I did that.... Maybe it will be only 2 lines but it is still just doing the same thing. It will be different if I can use hash tables.\
  • Hashtable - Save (Ablility) as 1 of (key(Hero)) in (Last created hashtable)
 
Last edited:
Level 14
Joined
Jul 25, 2011
Messages
1,065
Looks like I have to make my AI to learn to flee big forces and defend bases. I think I can do that in GUI. :goblin_good_job:
If it is impossible in GUI it is impossible in JASS too.

EDIT : Updated. Now it's much better now. AI defends their base and flees strong forces.
 
Last edited:
Review for AI Retreat only: too lazy for others :)
- IsAttacked is really abusive, it sometimes causes map to crash, I suggest to change it to a per second loop, and add the AI to a RetreatGroup...
- Store the attacked/attacking unit into a variable...
- If the Event is 'attacked', the Actions should be TriggeringPlayer/TriggeringUnit (thats for the attacked unit)...
- Why are you filtering both the attacked and attacking unit and its allies?, shoudlnt it be the attacked unit calls for help?...
- Tip: One location variable for the whole map is enough (except if you have offsets, 3 is maximum), since its removed once its done using...
- 1200.00 and 3500.00 and a-like should be configurables at initializetion...
- 'AITargetUnit' is really not needed coz you're changing it everytime in another trigger...
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
mckill2009 said:
Review for AI Retreat only: too lazy for others :)
- IsAttacked is really abusive, it sometimes causes map to crash, I suggest to change it to a per second loop, and add the AI to a RetreatGroup...
- Store the attacked/attacking unit into a variable...
- If the Event is 'attacked', the Actions should be TriggeringPlayer/TriggeringUnit (thats for the attacked unit)...
- Why are you filtering both the attacked and attacking unit and its allies?, shoudlnt it be the attacked unit calls for help?...
- Tip: One location variable for the whole map is enough (except if you have offsets, 3 is maximum), since its removed once its done using...
- 1200.00 and 3500.00 and a-like should be configurables at initializetion...
- 'AITargetUnit' is really not needed coz you're changing it everytime in another trigger...
Yes it's kind of laggy. But the unit calls for help if it's possible to win the battle. Check the other tiggers and you will know.

Error_trigger said:
This thing is nice, but sometime the AI doesn't use their abilities to kill enemy units, like lich, he doesn't use his frost nova , only frost armor o_O

Maybe he doesn't have mana? Or he doesn't have the skill yet... (He is under level 3?)
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
Error_trigger said:
i just remember, the lich is running out of mana but why does the AI hero always use the teleport thingy?

They use it to defend their base. But I need to fix it a bit it's buggy. I'll fix it when I'm home.

Adiktuz said:
at least add a description on what it does... AI system is still a bit huge of a genre...

Ok. I'll add some description.
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
What are the differents between this and mckill2009's engage system. And I think mckill2009's is so much better that yours. Engage system is so simple, useful for both melee map and AoS, and so easy to use. The different is just yours is GUI and mckill2009's is vJass..

Yes. I know that. I'm just making a GUI made AI system to help GUI users to make AI without using JASS. Also this AI system can be used for AOS. (But you need to do the buying things by your self. I don't know how to make a AI item buy system yet. I'll try to learn how to soon.)
 
Level 2
Joined
Mar 13, 2012
Messages
19
How can I edit the AI system to work in my battle maze map?

My map has one player hero, three enemy heroes, and four hostle creeps. I want the NPC heroes and creeps to move around and attack when they spot each other.
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
@MilesTro

Here is your map. To make my AI to work, I made this map 4 player. Also I made my system much simple because there were some triggers that weren't needed for your map.

PS: My AI system won't attack sleeping units. But if you want them to attack sleeping units, please tell me.
 

Attachments

  • Battle Maze.w3x
    841.4 KB · Views: 68
Level 2
Joined
Mar 13, 2012
Messages
19
I like how the three enemies attack, but I also want the creeps to be enemies too and attack the same way as the enemy AI players. And I don't want anyone sleeping, and no fog of war please.
 
Level 2
Joined
Mar 13, 2012
Messages
19
Thanks.

Some of the AI characters are still not working. The Night Elf is still remaining at one spot, and one Gnoll is still being playable.

I'll try working one of them.
 
From what I can tell, this'll mean Computer controlled units will attack random targets and not in groups, thus causing each individual unit to be /Very/ vulnerable to a single play who /does/ group up their units, and also for them to challenge much stronger units than themselves, which honestly, I don't think is that great - considering it decreases aplicability to other maps.

I'd suggest adding an option so that you can make AI units group together and attack /as a group/ rather than as individual units, as for preventing them from picking a losing fight - I honestly don't know what you'd do about that (I mean, you wouldn't get a footman to attack a knight, that'd be just silly)
 
Top