My AI is dumb as a fence

sentrywiz

New Member
Reaction score
25
Ok I've edited this thread so that people with great AI knowledge can help me build up my own decent AI. I will put all triggers I used in the making of the AI, state my pros, cons and what can and needs to be done. First of all let me say that:

-I've looked at how people did their AI from the AI contest (especially GUI users though I have to say, Jesus4Lyf's AI was incredible but I didn't understand shit... maybe because I haven't reached that level of GUI... idk)
-Tried to replicate it and failed... yea don't copy what you don't really understand lol
-I start from scratch and made semi-functional one


Here are the triggers in GUI:


Not sure people will understand the names but just to avoid confusions, Hero Name is Doktor which is another way of spelling Doctor. Yea no shit, you prolly know that.
These are the spell names:


-Steroidi (Inner Fire)
-Super Zvezda (Starfall)
-Koktelce (Rejuvenation
-Zegin (Unholy Aura)


Trigger:
  • Learn Skills
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Leveling Hero) Equal to Doktor 0002 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of Doktor 0002 <gen>) Equal to 1
          • (Level of Koktelce for Doktor 0002 <gen>) Equal to 0
        • Then - Actions
          • Hero - Learn skill for Doktor 0002 <gen>: Koktelce
          • Game - Display to (All players) for 1.00 seconds the text: naucis koktelce
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of Doktor 0002 <gen>) Equal to 2
              • (Level of Super Zvezda for Doktor 0002 <gen>) Equal to 0
            • Then - Actions
              • Hero - Learn skill for Doktor 0002 <gen>: Super Zvezda
              • Game - Display to (All players) for 1.00 seconds the text: jas peam super zvez...
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Hero level of Doktor 0002 <gen>) Equal to 3
                  • (Level of Steroidi for Doktor 0002 <gen>) Equal to 0
                • Then - Actions
                  • Hero - Learn skill for Doktor 0002 <gen>: Steroidi
                  • Game - Display to (All players) for 1.00 seconds the text: jas sum bilder
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Hero level of Doktor 0002 <gen>) Equal to 4
                      • (Level of Zegin for Doktor 0002 <gen>) Equal to 0
                    • Then - Actions
                      • Hero - Learn skill for Doktor 0002 <gen>: Zegin
                      • Game - Display to (All players) for 1.00 seconds the text: imam svoj zegin
                    • Else - Actions



It's obvious what this does. Game text is pretty much in every actions, just for testing and to see how my AI "thinks"


Trigger:
  • Enough Learning
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Leveling Hero) Equal to Doktor 0002 <gen>
    • Actions
      • Wait 4.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 4
        • Then - Actions
          • Trigger - Turn off Learn Skills <gen>
          • Game - Display to (All players) for 1.00 seconds the text: ne mi se uci veke
        • Else - Actions



Heroes maximum level is 4 and this disables the first trigger after he reaches level 4. I put the wait there to avoid AI not learning his "ulti" spell at last level and get learning trigger disabled by this one.


Trigger:
  • Move Doktor
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Playable Map Area <gen> matching (((Matching unit) belongs to an enemy of (Owner of Doktor 0002 <gen>)) Equal to True))) Greater than or equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in (Units in Playable Map Area <gen> matching ((((Matching unit) is in (Units within 50000.00 of (Position of Doktor 0002 <gen>))) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of Doktor 0002 <gen>)) Equal to True) and (((Matching unit) is and do (Actions)
            • Loop - Actions
              • Unit - Order Doktor 0002 <gen> to Attack-Move To (Position of (Picked unit))
              • Game - Display to (All players) for 1.00 seconds the text: napagam
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units in Playable Map Area <gen> matching (((Matching unit) belongs to an enemy of (Owner of Doktor 0002 <gen>)) Equal to True))) Equal to 0
            • Then - Actions
              • Unit - Order Doktor 0002 <gen> to Attack-Move To (Random point in Playable Map Area <gen>)
              • Game - Display to (All players) for 1.00 seconds the text: idam random
            • Else - Actions



The move trigger. First checks if there are enemy units spawned and if greater than or equal to 1 then IF target is within his range, an enemy, visible it will attack-move to its location. Otherwise he will wander around like an idiot... I have a major trouble with this trigger, cuz the second trigger happens only when you start the game. After the bot finds and kills an enemy, he stares at his corpse like a necrophiliac... then he won't move random at all again. He will wait until another enemy spawns near him and wait for him to attack... cuz hes obviously busy, staring at dead people's bodies.


Trigger:
  • Doktor Attacks
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of Doktor 0002 <gen>) Greater than or equal to 150.00
          • (Mana of Doktor 0002 <gen>) Greater than or equal to 60.00
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Attacked unit) Equal to Doktor 0002 <gen>
            • Then - Actions
              • Unit - Order Doktor 0002 <gen> to Attack-Move To (Position of (Attacking unit))
              • Game - Display to (All players) for 1.00 seconds the text: napagam
            • Else - Actions
        • Else - Actions



The attack trigger. Doktor will wait to be attacked if hes just blindly doing nothing... like wanking on dead corpses.


Trigger:
  • Doktor Heals
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Koktelce for Doktor 0002 <gen>) Equal to 1
          • (Life of Doktor 0002 <gen>) Less than or equal to 100.00
          • (Mana of Doktor 0002 <gen>) Greater than or equal to 60.00
        • Then - Actions
          • Unit - Order Doktor 0002 <gen> to Night Elf Druid Of The Claw - Rejuvenation Doktor 0002 <gen>
          • Game - Display to (All players) for 1.00 seconds the text: koktelce njam njam
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Steroidi for Doktor 0002 <gen>) Equal to 1
              • (Doktor 0002 <gen> has buff Steroidi ) Equal to False
              • (Mana of Doktor 0002 <gen>) Greater than or equal to 90.00
            • Then - Actions
              • Unit - Order Doktor 0002 <gen> to Human Priest - Inner Fire Doktor 0002 <gen>
              • Game - Display to (All players) for 1.00 seconds the text: brc u vena
            • Else - Actions



His healing trigger. Hence he has two spells that enhance survivability (Steroidi - Inner Fire; Koktelce - Rejuvenation) he will first try to cast Rejuvenation when he has life/mana lower than that required. Now this works this way, if hes mana is 60 or greater he will use to cast Rejuvenation, because it heals for 200 and returns 50 mana. But if he has more mana he will first Inner Fire itself then if needed cast Rejuvenation.


Trigger:
  • Doktor Caster
    • Events
      • Time - Every 18.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Super Zvezda for Doktor 0002 <gen>) Equal to 1
          • (Life of Doktor 0002 <gen>) Greater than or equal to 100.00
          • (Mana of Doktor 0002 <gen>) Greater than or equal to 60.00
        • Then - Actions
          • Trigger - Turn off Doktor Attacks <gen>
          • Trigger - Turn off Doktor Heals <gen>
          • Trigger - Turn off Move Doktor <gen>
          • Countdown Timer - Start ZvezdaTimer as a One-shot timer that will expire in 5.00 seconds
          • Set ZvezdaTimer = (Last started timer)
          • Unit - Order Doktor 0002 <gen> to Night Elf Priestess Of The Moon - Starfall
          • Game - Display to (All players) for 1.00 seconds the text: SUPER SUPER ...SUPE...
        • Else - Actions



I didn't know other way than at every 18 seconds to tell the Doktor to cast Starfall. As you can see hence this spell is channeling, I turned off all triggers that cause the unit to just go move, attack or cast another spell and applied a timer to return the turned off triggers back to normal.


Trigger:
  • Doktor CasterBack
    • Events
      • Time - ZvezdaTimer expires
    • Conditions
    • Actions
      • Trigger - Turn on Doktor Attacks <gen>
      • Trigger - Turn on Move Doktor <gen>
      • Trigger - Turn on Doktor Heals <gen>




Trigger:
  • DoktorHealing2
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Life of Doktor 0002 <gen>) Less than or equal to (2.00 x (Real((Hero level of Doktor 0002 <gen>))))
      • (Mana of Doktor 0002 <gen>) Less than or equal to 50.00
    • Actions
      • Unit Group - Pick every unit in (Units of type Doktor) and do (Actions)
        • Loop - Actions
          • Unit - Order Doktor 0002 <gen> to Move To (Position of Fountain)
          • Game - Display to (All players) for 1.00 seconds the text: idam do fontana
          • Set DoktorHealing = True



Now this is the where the unit will retreat to fountain because it has: no mana to cast Rejuvenation, no mana to cast Inner Fire to help with the healing and has not enough health. I also put a boolean condition and applied it to the moving of the Doktor. As you can see, if DoktorHealing = true, the unit will not aquire targets via pick up every unit that is enemy, visible bla bla... and will just peacefully go to fountain and stay there until its healed...


Trigger:
  • DoktorHealing3
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
      • (Life of Doktor 0002 <gen>) Greater than or equal to (4.00 x (Real((Hero level of Doktor 0002 <gen>))))
      • (Mana of Doktor 0002 <gen>) Greater than or equal to (3.00 x (Real((Hero level of Doktor 0002 <gen>))))
    • Actions
      • Unit Group - Pick every unit in (Units of type Doktor) and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) for 1.00 seconds the text: se napuniv
          • Set DoktorHealing = False



This is the last trigger. Its pretty much self-explanatory but with the other trigger checking every second if Doktor has low mana and life this trigger checks each 10 seconds and sets the boolean condition to false so Doktor will be able to aquire targets via his move trigger.


So what are the pros and cons of this? This is my very first AI and for me, this works magical. However it might leak, and might be lot of better ways for these and maybe some triggers you can think of work. I think I've clearly explained what my triggers do.

I do know that these trigger apply for global variables, like the Doktor is already inside the game and each trigger just picks it up. I intend to make 5v5 small arena map with them, and I would need more sophisticated methods and triggers for picking them individually. I'm sure you can think of ways to do this, hence there might be 1 Doktor in each team and if these are the triggers they will go, I need to pick them individually.


Also, I lack two things. I want bots to buy recipe-items and not unfairly pick every target on the map and check if its enemy, visible and attack it. I want to make a sort of team work trigger, where multiple bots will decide to go middle or enemy base and work-fight with their triggers as a team. I have no freaking clue how to make this, any help is appreciated and I know that many people have tons of experience with AI.


Thank you for reading and bothering...
 

Bankde

Member
Reaction score
20
I'm not sure what do you really want. Please give me the trigger so I can check how do you order it. (the action)

If I were you, I would use this:
Trigger:
  • Creep Roaming
    • Events
      • Time - Every (Random real number between 1.00 and 10.00) seconds of game time
    • Conditions
    • Actions
      • Set Unit_Roaming = ((Position of (Your Unit)) offset by (Random number between (Your Range)) towards (Random Angle) degrees)
      • Unit - Order "Your Unit" to Patrol To (Unit_Roaming)
      • Custom Script - Call RemoveLocation (udg_Unit_Roaming)


If you don't want this, please show your complete trigger so I may help you.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top