Script Bots for Overwatch (Tutorial Series)

Hi, check out this before you continue: COOP VS AI (CUSTOM BOTS/LEGENDARY AI)

I want to give you some tips for working on Custom Bots, maybe for player that plan AI for FFA.

  1. Check Current Map

rule(“MAP CHECK”)
{
event
{
Ongoing - Global;
}

actions
{
Set Global Variable(M, Index Of Array Value(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(
Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Append To Array(Empty Array, 42), 37), 134),
54), 1211), 82), -218.000), -71.000), 168), 144), 1624), 18), 344), 124), -2.000), 78), 88), -106.000), -435.000), 25), 1156),
56), 7226), 300), 66), -167.000), -649.000), -343.000), 17), 13), 102), 69), 90), 30), -3810.000), 101), -13.000), -130.000),
1831), 3066), 186), 173), -163.000), -1083.000), -3.000), 41), 892), 353), -879.000), 21), -226.000), 34), 610), Add(
Round To Integer(X Component Of(Nearest Walkable Position(Vector(100, 100, 100))), Up), Multiply(Round To Integer(
X Component Of(Objective Position(0)), Up), 20))));
}
}

Comment: This rule Set the global variable M to a number based on your current Map. So check the current variable M on your map to know the rule condition for map specific rules. On Control maps you need the Objective Index too. 1st Map = 0, 2nd Map = 1, 3rd Map = 2

  1. Create Dummy Bot Team

rule(“SPAWN TEAM 2” )
{
event
{
Ongoing - Global;
}

conditions
{
Is Assembling Heroes == True;
}

actions
{
Destroy All Dummy Bots;
Wait(30.250, Ignore Condition);
Create Dummy Bot(Hero(Genji), Team 2, -1.000, Vector(9999, 9999, 9999), Vector(0, 0, 0));
Wait(Random Integer(0.500, 1), Ignore Condition);
Create Dummy Bot(Hero(McCree), Team 2, -1.000, Vector(9999, 9999, 9999), Vector(0, 0, 0));
Wait(Random Integer(0.500, 1), Ignore Condition);
Create Dummy Bot(Hero(Orisa), Team 2, -1.000, Vector(9999, 9999, 9999), Vector(0, 0, 0));
Wait(Random Integer(0.500, 1), Ignore Condition);
Create Dummy Bot(Hero(Wrecking Ball), Team 2, -1.000, Vector(9999, 9999, 9999), Vector(0, 0, 0));
Wait(Random Integer(0.500, 1), Ignore Condition);
Create Dummy Bot(Hero(Zenyatta), Team 2, -1.000, Vector(9999, 9999, 9999), Vector(0, 0, 0));
Wait(Random Integer(0.500, 1), Ignore Condition);
Create Dummy Bot(Hero(Ana), Team 2, -1.000, Vector(9999, 9999, 9999), Vector(0, 0, 0));
}
}

Comment: This rule destroys all Dummy Bots first (for Ranked rules with more than 1 round, or if switching sides), then it creates after a waiting time 6 bots for team 2. The delays between the rules are only for the player simulation. So bots pick in the Hero Selection Screen but not at the same time.

  1. Path (not for public guide atm)

  2. Facing Direction

rule(“FACING DIRECTION ENEMY”)
{
event
{
Ongoing - Each Player;
All;
All;
}

conditions
{
Is Dummy Bot(Event Player) == True;
Hero Of(Event Player) != Hero(Mercy);
Player Variable(Event Player, F) == 0;
}

actions
{
Start Facing(Event Player, Direction Towards(Eye Position(Event Player), Eye Position(Closest Player To(Event Player,
Opposite Team Of(Team Of(Event Player))))), Random Real(100, 500), To World, Direction and Turn Rate);
}
}

Comment: This rule let the bots look at the closest enemy player. Mercy Bot has a special facing behavior so she will not look at enemies. The F variable is a helper variable that gives you full control for the rule. You can enable or disable it whenever you want (like for healing bots that must look at allies)

MORE SOON!

NICE TO KNOW

  1. Loop Conditions can kill your performance very easy
  2. Bots that try going in 2 directions at the same time can crash the server
  3. Junkrats ult use the facing of Junkrat so if he change the direction his Rip-tire do it aswell.
2 Likes