• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

AI Prorities

Status
Not open for further replies.
Level 14
Joined
Oct 16, 2010
Messages
739
Hi,

I'm creating an AI for one of my maps and I'm getting myself confused. It is an autobattler of sorts and the general idea is that there are 5 armor types, as far as the AI is concerned there are no damage types but they have versus armor types. So each time has DefMedium and VSMedium for example, this has allowed me to generalise multiple damage types (such as piercing and siege) against a single armor type (like unarmored). So the AI has conditions that they will build a piercing or siege unit versus an unarmored one, as this checks their VSUnarmored against the enemies DefUnarmored variables.

So far I have them building against armor types, so they will compare their VS against the enemies DEF and pick the lowest option, so their weakest damage type (or enemies strongest armor type)

What I want to do is add an additional layer that allows them to play a bit more defensive too. So they will build what the enemy doesn't counter very well. So if the enemy has lots of magic users the AI might build a unit with medium armor, as this isn't countered very well. So I want a similar concept but flipped I guess? I think I am confusing myself but I keep staring at it and can't work it out!

I have attached what I'm using at the moment but I'm not sure it's correct as the AI just builds more their strongest armor type instead? Which the enemy will just continue to counter?

  • Team 1 Priority
    • Events
    • Conditions
    • Actions
      • -------- Enemy has lots of this armor type --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
          • (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsLight - Team2ArmorLight)
          • (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
          • (Team1VsAir - Team2ArmorAir) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
        • Then - Actions
          • Set VariableSet AI_PriorityVS = Air
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsAir - Team2ArmorAir)
              • (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsLight - Team2ArmorLight)
              • (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
              • (Team1VsHeavy - Team2ArmorHeavy) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
            • Then - Actions
              • Set VariableSet AI_PriorityVS = Heavy
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsAir - Team2ArmorAir)
                  • (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
                  • (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
                  • (Team1VsLight - Team2ArmorLight) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
                • Then - Actions
                  • Set VariableSet AI_PriorityVS = Light
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsAir - Team2ArmorAir)
                      • (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
                      • (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsLight - Team2ArmorLight)
                      • (Team1VsMedium - Team2ArmorMedium) Less than or equal to (Team1VsUnarmored - Team2ArmorUnarmored)
                    • Then - Actions
                      • Set VariableSet AI_PriorityVS = Medium
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsAir - Team2ArmorAir)
                          • (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsHeavy - Team2ArmorHeavy)
                          • (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsLight - Team2ArmorLight)
                          • (Team1VsUnarmored - Team2ArmorUnarmored) Less than or equal to (Team1VsMedium - Team2ArmorMedium)
                        • Then - Actions
                          • Set VariableSet AI_PriorityVS = Unarmored
                        • Else - Actions
      • -------- Enemy does not have much of this attack type --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
          • (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsLight - Team1ArmorLight)
          • (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
          • (Team2VsAir - Team1ArmorAir) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
        • Then - Actions
          • Set VariableSet AI_PriorityDef = Air
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsAir - Team1ArmorAir)
              • (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsLight - Team1ArmorLight)
              • (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
              • (Team2VsHeavy - Team1ArmorHeavy) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
            • Then - Actions
              • Set VariableSet AI_PriorityDef = Heavy
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsAir - Team1ArmorAir)
                  • (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
                  • (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
                  • (Team2VsLight - Team1ArmorLight) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
                • Then - Actions
                  • Set VariableSet AI_PriorityDef = Light
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsAir - Team1ArmorAir)
                      • (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
                      • (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsLight - Team1ArmorLight)
                      • (Team2VsMedium - Team1ArmorMedium) Less than or equal to (Team2VsUnarmored - Team1ArmorUnarmored)
                    • Then - Actions
                      • Set VariableSet AI_PriorityDef = Medium
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsAir - Team1ArmorAir)
                          • (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsHeavy - Team1ArmorHeavy)
                          • (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsLight - Team1ArmorLight)
                          • (Team2VsUnarmored - Team1ArmorUnarmored) Less than or equal to (Team2VsMedium - Team1ArmorMedium)
                        • Then - Actions
                          • Set VariableSet AI_PriorityDef = Unarmored
                        • Else - Actions
      • Game - Display to (All players) the text: (atk + AI_PriorityVS)
      • Game - Display to (All players) the text: (def + AI_PriorityDef)
 
Status
Not open for further replies.
Top