Set Global Variable(willAttackPlayers, Workshop Setting Toggle(Custom String("Bots", Null, Null, Null), Custom String("Attack players (shoot sleep dart, chase, and yeet)", Null, Null, Null), True, 0));
Set Global Variable(willEscape, Workshop Setting Toggle(Custom String("Bots", Null, Null, Null), Custom String("Bots will attempt to escape", Null, Null, Null), True, 0));
Set Global Variable(willJump, Workshop Setting Toggle(Custom String("Bots", Null, Null, Null), Custom String("Bots will jump", Null, Null, Null), True, 0));
Set Global Variable(willRoam, Workshop Setting Toggle(Custom String("Bots", Null, Null, Null), Custom String("Bots will roam around the map", Null, Null, Null), True, 0));
Set Global Variable(willUlt, Workshop Setting Toggle(Custom String("Bots", Null, Null, Null), Custom String("Bots will use ultimate", Null, Null, Null), True, 0));
If(Compare(Global Variable(spawnAI), ==, True));
Create HUD Text(All Players(Team(All)), Null, Null, Custom String("{0} {1}", Global Variable(stringAnaBotSpawn), Count Of(Filtered Array(All Players(Team(All)), Is Dummy Bot(Current Array Element))), Null), Left, 1, Null, Null, Color(White), Visible To And String, Default Visibility);
End;
}
}
rule("HUD Creation Subroutine")
{
event
{
Subroutine;
hudCreation;
}
// Action count: 9
actions
{
Create HUD Text(All Players(Team(All)), Null, Null, Global Variable(stringProject), Right, -0.99, Null, Null, Color(Green), Visible To And String, Default Visibility);
Create HUD Text(All Players(Team(All)), Null, Null, Global Variable(stringCode), Right, -0.9, Null, Null, Custom Color(Global Variable(titleColorR), Global Variable(titleColorG), Global Variable(titleColorB), 255), Visible To String and Color, Default Visibility);
Create HUD Text(All Players(Team(All)), Null, Null, Custom String(" \n{0}", Global Variable(stringGH), Null, Null), Right, -0.89, Null, Null, Color(Yellow), Visible To And String, Default Visibility);
Create HUD Text(All Players(Team(All)), Null, Global Variable(stringTranslation), Null, Right, -2, Null, Color(White), Null, Visible To And String, Default Visibility);
Create HUD Text(All Players(Team(All)), Null, Null, Global Variable(stringGHLink), Right, -0.88, Null, Null, Color(Yellow), Visible To And String, Default Visibility);
Create HUD Text(Filtered Array(All Players(Team(All)), Compare(Ultimate Charge Percent(Current Array Element), ==, 100)), Null, Null, Custom String("{0}{1}", Input Binding String(Button(Ultimate)), Global Variable(stringUltEscape), Null), Top, 1.2, Null, Null, Custom Color(Global Variable(titleColorR), Global Variable(titleColorG), Global Variable(titleColorB), 255), Visible To String and Color, Visible Never);
Set Global Variable(stringSubtitle, Custom String("Created by: {0}. Version: {1}", Global Variable(stringCreator), Global Variable(stringVersion), Null));
Set Global Variable(stringLeft, Custom String(" to pick up sleeping player", Null, Null, Null));
Set Global Variable(stringRight, Custom String(" to yeet carried player", Null, Null, Null));
Set Global Variable(stringObjective, Custom String("Yeet sleeping players off the island!", Null, Null, Null));
Set Global Variable(stringPick, Custom String("Picked up", Null, Null, Null));
Set Global Variable(stringEscape, Custom String(" to escape her grasp!", Null, Null, Null));
Set Global Variable(stringDiscord, Custom String("Join the discord: {0} (All caps)", Global Variable(stringDiscordLink), Null, Null));
Set Global Variable(stringProject, Custom String("Project: {0}", Global Variable(stringProjectLink), Null, Null));
Set Global Variable(stringUltEscape, Custom String(" to wake up and get a speed boost!", Null, Null, Null));
Set Global Variable(stringTranslation, Custom String("", Null, Null, Null));
Set Global Variable(stringGraspEscape, Custom String("escaped!", Null, Null, Null));
Set Global Variable(stringTitle, Custom String("Sleep 'N Yeet", Null, Null, Null));
Set Global Variable(stringAnaBotSpawn, Custom String("{0} Bots Enabled. Current count:", Ability Icon String(Hero(Echo), Button(Ultimate)), Null, Null));
Set Global Variable(stringGH, Custom String("{0} Certified by Grandeur Hammers", Ability Icon String(Hero(Torbjörn), Button(Ability 2)), Null, Null));
Create In-World Text(Filtered Array(All Players(Team(All)), And(And(Compare(Global Variable(leader), !=, Null), Compare(Current Array Element, !=, Global Variable(leader))), Is Alive(Global Variable(leader)))), Custom String("#1", Null, Null, Null), Global Variable(leader), 2, Clip Against Surfaces, Visible To And Position, Custom Color(255, 221, 0, 255), Default Visibility);
Create In-World Text(All Players(Team(All)), Global Variable(stringTitle), Vector(0, Add(20, Global Variable(y)), 113), 4, Clip Against Surfaces, Visible To String and Color, Custom Color(Global Variable(titleColorR), Global Variable(titleColorG), Global Variable(titleColorB), 255), Default Visibility);
Create In-World Text(All Players(Team(All)), Global Variable(stringSubtitle), Vector(0, Add(15, Global Variable(y)), 113), 2, Clip Against Surfaces, Visible To And String, Color(White), Default Visibility);
}
}
rule("Debug Mode Setup")
{
event
{
Subroutine;
debug;
}
// Action count: 2
actions
{
Create HUD Text(Host Player, Server Load Average, Custom String("Server Load Average", Null, Null, Null), Null, Left, 0, Color(White), Color(White), Color(White), Visible To And String, Default Visibility);
Create HUD Text(Host Player, Position Of(Host Player), Custom String("Host Player Position", Null, Null, Null), Null, Left, 1, Color(White), Color(White), Color(White), Visible To And String, Default Visibility);
}
}
rule("Initial Setup")
{
event
{
Ongoing - Global;
}
// Action count: 26
actions
{
Set Global Variable(isDebug, Workshop Setting Toggle(Custom String("Debug", Null, Null, Null), Custom String("Enable Debug HUD", Null, Null, Null), False, 0));
Set Global Variable(spawnPositionArray, Array(Vector(15, Global Variable(y), 15), Vector(10, Global Variable(y), 15), Vector(5, Global Variable(y), 15), Vector(Empty Array, Global Variable(y), 15), Vector(-5, Global Variable(y), 15), Vector(-10, Global Variable(y), 15), Vector(-15, Global Variable(y), 15), Vector(15, Global Variable(y), 10), Vector(15, Global Variable(y), 5), Vector(15, Global Variable(y), Empty Array), Vector(15, Global Variable(y), -5), Vector(15, Global Variable(y), -10), Vector(15, Global Variable(y), -15), Vector(10, Global Variable(y), -15), Vector(5, Global Variable(y), -15), Vector(Empty Array, Global Variable(y), -15), Vector(-5, Global Variable(y), -15), Vector(-10, Global Variable(y), -15), Vector(-15, Global Variable(y), -15), Vector(-15, Global Variable(y), 10), Vector(-15, Global Variable(y), 5), Vector(-15, Global Variable(y), Empty Array), Vector(-15, Global Variable(y), -5), Vector(-15, Global Variable(y), -10)));
Set Facing(Event Player, Direction Towards(Event Player, Vector(Empty Array, Subtract(Add(Global Variable(y), Eye Position(Event Player)), Position Of(Event Player)), Empty Array)), To World);
Set Player Variable(Event Player, ready, True);
}
}
rule("Chase Color")
{
event
{
Ongoing - Global;
}
// Action count: 19
actions
{
Chase Global Variable At Rate(titleColorB, 255, 450, Destination And Rate);
"Sometimes the array has a player that does not exist and/or by the time the small message is sent, player value is lost. This check will prevent a weird small message from being sent."If(Compare(Value In Array(Player Variable(Player Variable(Event Player, thrower), playersCarried), Player Variable(Event Player, i)), !=, Null));
Small Message(Player Variable(Event Player, thrower), Custom String("{0} {1}", Value In Array(Player Variable(Player Variable(Event Player, thrower), playersCarried), Player Variable(Event Player, i)), Global Variable(stringGraspEscape), Null));
End;
Detach Players(Value In Array(Player Variable(Player Variable(Event Player, thrower), playersCarried), Player Variable(Event Player, i)));
Set Player Variable(Value In Array(Player Variable(Player Variable(Event Player, thrower), playersCarried), Player Variable(Event Player, i)), thrower, Null);
Modify Player Variable(Player Variable(Event Player, thrower), playersCarried, Remove From Array By Index, Player Variable(Event Player, i));
Set Player Variable(Last Created Entity, aimInaccuracy, Vector(Random Real(Multiply(-1, Global Variable(aimInaccuracyExtremes)), Global Variable(aimInaccuracyExtremes)), Empty Array, Random Real(Multiply(-1, Global Variable(aimInaccuracyExtremes)), Global Variable(aimInaccuracyExtremes))));
Loop If Condition Is True;
}
}
rule("Assembling Heroes AI Setup")
{
event
{
Ongoing - Global;
}
conditions
{
Is Assembling Heroes == True;
}
// Action count: 2
actions
{
Set Player Variable(All Players(Team(All)), targetedPlayer, Null);
Set Player Variable(All Players(Team(All)), isChasing, False);
}
}
rule("Delete AI")
{
event
{
Ongoing - Global;
}
conditions
{
Global Variable(spawnAI) == True;
Number Of Players(Team(All)) > Global Variable(aiNumber);
Destroy Dummy Bot(Team(All), Slot Of(Random Value In Array(Filtered Array(All Players(Team(All)), Is Dummy Bot(Current Array Element)))));
Wait(1, Abort When False);
Loop If Condition Is True;
}
}
rule("Target Roam Subroutine")
{
event
{
Subroutine;
targetRoam;
}
// Action count: 3
actions
{
Set Player Variable(Event Player, targetedPlayer, First Of(Sorted Array(Filtered Array(All Living Players(Team(All)), And(Not(Has Status(Current Array Element, Asleep)), Compare(Event Player, !=, Current Array Element))), Distance Between(Event Player, Current Array Element))));
Start Facing(Event Player, Direction Towards(Event Player, Add(Add(Player Variable(Event Player, targetedPlayer), Multiply(Velocity Of(Player Variable(Event Player, targetedPlayer)), Square Root(Divide(Raise To Power(Distance Between(Event Player, Player Variable(Event Player, targetedPlayer)), 2), Subtract(3600, Raise To Power(Speed Of(Player Variable(Event Player, targetedPlayer)), 2)))))), Player Variable(Event Player, aimInaccuracy))), 800, To World, Direction And Turn Rate);
Set Player Variable(Event Player, aimInaccuracy, Vector(Random Real(Multiply(-1, Global Variable(aimInaccuracyExtremes)), Global Variable(aimInaccuracyExtremes)), 0, Random Real(Multiply(-1, Global Variable(aimInaccuracyExtremes)), Global Variable(aimInaccuracyExtremes))));
}
}
rule("Reset Player Target on Spawn")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Global Variable(spawnAI) == True;
Is Dummy Bot(Event Player) == True;
Is Alive(Event Player) == True;
Has Spawned(Event Player) == True;
}
// Action count: 1
actions
{
Call Subroutine(targetRoam);
}
}
rule("Roam")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Global Variable(spawnAI) == True;
Is Dummy Bot(Event Player) == True;
Player Variable(Event Player, isChasing) == False;
Has Status(Event Player, Asleep) == False;
}
// Action count: 12
actions
{
If(Compare(Global Variable(willRoam), ==, True));
Start Throttle In Direction(Event Player, Vector(Random Real(-1, 1), Empty Array, Random Real(-1, 1)), 1, To World, Replace Existing Throttle, Direction And Magnitude);
Has Status(Player Variable(Event Player, targetedPlayer), Asleep) == True;
Player Variable(Event Player, playersCarried) == Empty Array;
Global Variable(willAttackPlayers) == True;
}
// Action count: 3
actions
{
Set Player Variable(Event Player, isChasing, True);
Start Throttle In Direction(Event Player, Direction Towards(Event Player, Player Variable(Event Player, targetedPlayer)), 1, To World, Replace Existing Throttle, Direction And Magnitude);
Start Throttle In Direction(Event Player, Direction Towards(Event Player, First Of(Sorted Array(Global Variable(positionArray), Distance Between(Event Player, Current Array Element)))), 1, To World, Replace Existing Throttle, Direction And Magnitude);
Set Player Variable(Event Player, targetedPlayer, First Of(Sorted Array(Global Variable(positionArray), Distance Between(Event Player, Current Array Element))));
Wait(3, Ignore Condition);
Loop If Condition Is True;
}
}
rule("Death Reset")
{
event
{
Player died;
All;
All;
}
conditions
{
Global Variable(spawnAI) == True;
Is Dummy Bot(Event Player) == True;
}
// Action count: 3
actions
{
Set Player Variable(Event Player, targetedPlayer, Null);
Set Player Variable(Event Player, isChasing, False);
Stop Forcing Throttle(Event Player);
}
}
rule("Sleep Reset")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Global Variable(spawnAI) == True;
Is Dummy Bot(Event Player) == True;
Has Status(Event Player, Asleep) == True;
}
// Action count: 4
actions
{
Stop Facing(Event Player);
Set Player Variable(Event Player, targetedPlayer, Null);
Set Player Variable(Event Player, isChasing, False);
Start Throttle In Direction(Event Player, Direction Towards(Event Player, Subtract(Left, Left)), 1, To World, Replace Existing Throttle, Direction And Magnitude);
Set Player Variable(Event Player, isChasing, True);
Wait(0.7, Ignore Condition);
Loop If Condition Is True;
Set Player Variable(Event Player, isChasing, False);
}
}
rule("Stop Chasing After Removing Carried Players")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Global Variable(spawnAI) == True;
Is Dummy Bot(Event Player) == True;
Player Variable(Event Player, playersCarried) == Empty Array;
}
// Action count: 1
actions
{
Set Player Variable(Event Player, isChasing, False);
}
}
rule("Stop Staring at Dead Target")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Global Variable(spawnAI) == True;
Is Dummy Bot(Event Player) == True;
Y Component Of(Player Variable(Event Player, targetedPlayer)) <= -1;