• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

AI help for my map

Status
Not open for further replies.
In this map map I made I am really embarrassed to make an AI, considering that the heroes can be bought. If anyone have the time to try making some AI that chooses a random hero for each computer and them send them to battle I'll be very grateful. If anyone is interested can PM me and we'll cooperate. The map is this.
 
Last edited:
Level 13
Joined
Dec 21, 2010
Messages
541
First.. Create a Unit-type Variable Array then set each hero for each array
Create a Boolean Variable Array for each hero.
Create an integer on how many heroes you have.
Then Loop it.

  • Init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set Hero[1] = Paladin
      • Set Hero[2] = Archmage
      • Set Hero[3] = Jaina
      • Set Hero[4] = Mountain King
      • ------------------------------
      • Set Hero_Max = 4
  • RandomPick
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • For each (Hero_Loop) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(Hero_Loop)) controller) Equal to Computer
            • Then - Actions
              • Hero_Random = (Random integer number between 1 and Hero_Max)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Hero_Check[Hero_Random] Equal to False
                • Then - Actions
                  • Set Hero_Point = ((Player(Hero_Loop)) start location )
                  • Set Hero_Check = True
                  • Unit - Create 1 Hero[Hero_Random] for ((Player(Hero_Loop)) at Hero_Point facing Default building facing degrees
                  • Custom script: call RemoveLocation (udg_Hero_Point)
                • Else - Actions
                  • Hero_Random = (Random integer number between 1 and Hero_Max)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hero_Check[Hero_Random] Equal to False
                    • Then - Actions
                      • Set Hero_Point = ((Player(Hero_Loop)) start location )
                      • Set Hero_Check = True
                      • Unit - Create 1 Hero[Hero_Random] for ((Player(Hero_Loop)) at Hero_Point facing Default building facing degrees
                      • Custom script: call RemoveLocation (udg_Hero_Point)
                    • Else - Actions
              • Else - Actions
            • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top