Set Global Variable(stringSubtitle, Custom String("Created by: {0}. Version: {1}", Global.stringCreator, Global.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.stringDiscordLink, Null, Null));
Set Global Variable(stringProject, Custom String("Project: {0}", Global.stringProjectLink, Null, Null));
Set Global Variable(stringUltEscape, Custom String(": To gain a speed boost and wake up if asleep!", 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));
}
}
rule ("Simplified CN (Thanks to Zesty for translation)") {
event {
Subroutine;
simplifiedChineseStrings;
}
actions {
Set Global Variable(stringSubtitle, Custom String("由{0}制作。版本:{1}", Global.stringCreator, Global.stringVersion, Null));
Set Global Variable(stringLeft, Custom String(":捡起沉睡的玩家", Null, Null, Null));
Set Global Variable(stringRight, Custom String(":抛投抓住的玩家", Null, Null, Null));
Set Global Variable(stringObjective, Custom String("把睡着的玩家丢出小岛!", Null, Null, Null));
Set Global Variable(stringPick, Custom String("捡起", Null, Null, Null));
Set Global Variable(stringEscape, Custom String(":逃离她的魔爪!", Null, Null, Null));
Set Global Variable(stringDiscord, Custom String("加入Discord:{0}(全大写)", Global.stringDiscordLink, Null, Null));
Set Global Variable(stringProject, Custom String("项目:{0}(全小写)", Global.stringProjectLink, Null, Null));
Set Global Variable(stringUltEscape, Custom String(":获得加速,如果是沉睡状态则将睡醒!", Null, Null, Null));
Set Global Variable(stringTranslation, Custom String("由Zesty#51453翻译", Null, Null, Null));
Set Global Variable(stringGraspEscape, Custom String("逃脱了!", Null, Null, Null));
Set Global Variable(stringTitle, Custom String("梦中丢人", Null, Null, Null));
Set Global Variable(stringAnaBotSpawn, Custom String("{0} 启用了安娜机器人。目前数量:", Ability Icon String(Hero(Torbjörn), Button(Ability 2)), Null, Null));
Set Global Variable(stringGH, Custom String("{0} 由Grandeur Hammers认证", Ability Icon String(Hero(Torbjörn), Button(Ability 2)), Null, Null));
}
}
rule ("New Player Setup") {
event {
Ongoing - Each Player;
All;
All;
}
conditions {
Is Game In Progress == True;
}
actions {
Set Objective Description(Event Player, Global.stringObjective, Visible To);
Start Heal Over Time(Event Player, Event Player, 9999, 9999);
Set Player Variable(Event Player, playerCarried, Empty Array);
"Sometimes the array has a player that does not exist. This check will prevent a weird small message from being sent."
If(Compare(Value In Array(((Event Player).thrower).playerCarried, (Event Player).i), !=, Null));
Small Message((Event Player).thrower, Custom String("{0}{1}", Value In Array(((Event Player).thrower).playerCarried, (Event Player).i), Global.stringGraspEscape, Null));
End;
Detach Players(Value In Array(((Event Player).thrower).playerCarried, (Event Player).i));
Set Player Variable(Value In Array(((Event Player).thrower).playerCarried, (Event Player).i), thrower, Null);
Modify Player Variable((Event Player).thrower, playerCarried, Remove From Array By Index, (Event Player).i);
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));
}
}
rule ("Spawn AI") {
event {
Ongoing - Global;
}
conditions {
Global.spawnAI == True;
Number Of Players(All Teams) < Global.aiNumber;
}
actions {
Wait(1, Abort When False);
Create Dummy Bot(Hero(Ana), All Teams, -1, Nearest Walkable Position(Vector(Random Real(-20, 20), 0, Random Real(-20, 20))), Vector(0, 0, 0));
Set Player Variable(Last Created Entity, aimInaccuracy, Vector(Random Real(Multiply(-1, Global.aimInaccuracyExtremes), Global.aimInaccuracyExtremes), 0, Random Real(Multiply(-1, Global.aimInaccuracyExtremes), Global.aimInaccuracyExtremes)));
Destroy Dummy Bot(All Teams, Slot Of(Random Value In Array(Filtered Array(All Players(All Teams), Is Dummy Bot(Current Array Element)))));
Wait(1, Abort When False);
Loop If Condition Is True;
}
}
rule ("Reset Player Target on Spawn") {
event {
Ongoing - Each Player;
All;
All;
}
conditions {
Global.spawnAI == True;
Is Dummy Bot(Event Player) == True;
Is Alive(Event Player) == True;
Has Spawned(Event Player) == True;
}
actions {
Call Subroutine(targetRoam);
}
}
rule ("Target Roam Subroutine") {
event {
Subroutine;
targetRoam;
}
actions {
Set Player Variable(Event Player, targetedPlayer, First Of(Sorted Array(Filtered Array(All Living Players(All Teams), 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((Event Player).targetedPlayer, Multiply(Velocity Of((Event Player).targetedPlayer), Square Root(Divide(Raise To Power(Distance Between(Event Player, (Event Player).targetedPlayer), 2), Subtract(3600, Raise To Power(Speed Of((Event Player).targetedPlayer), 2)))))), (Event Player).aimInaccuracy)), 600, To World, Direction and Turn Rate);
Set Player Variable(Event Player, aimInaccuracy, Vector(Random Real(Multiply(-1, Global.aimInaccuracyExtremes), Global.aimInaccuracyExtremes), 0, Random Real(Multiply(-1, Global.aimInaccuracyExtremes), Global.aimInaccuracyExtremes)));
}
}
rule ("Roam") {
event {
Ongoing - Each Player;
All;
All;
}
conditions {
Global.spawnAI == True;
Is Dummy Bot(Event Player) == True;
(Event Player).isChasing == False;
Has Status(Event Player, Asleep) == False;
}
actions {
If(Compare(Global.willRoam, ==, True));
Start Throttle In Direction(Event Player, Vector(Random Real(-1, 1), 0, Random Real(-1, 1)), 1, To World, Replace existing throttle, Direction and Magnitude);
Has Status((Event Player).targetedPlayer, Asleep) == True;
(Event Player).playerCarried == Empty Array;
Global.willAttackPlayers == True;
}
actions {
Set Player Variable(Event Player, isChasing, True);
Start Throttle In Direction(Event Player, Direction Towards(Event Player, (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.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.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.spawnAI == True;
Is Dummy Bot(Event Player) == True;
}
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.spawnAI == True;
Is Dummy Bot(Event Player) == True;
Has Status(Event Player, Asleep) == True;
}
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, Vector(0, 0, 0)), 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.spawnAI == True;
Is Dummy Bot(Event Player) == True;
(Event Player).playerCarried == Empty Array;
}
actions {
Set Player Variable(Event Player, isChasing, False);
}
}
rule ("Stop Staring at Dead Target") {
event {
Ongoing - Each Player;
All;
All;
}
conditions {
Global.spawnAI == True;
Is Dummy Bot(Event Player) == True;
Y Component Of((Event Player).targetedPlayer) <= -1;
Create Effect(If-Then-Else(And(Has Status(Players In Slot(0, All Teams), Asleep), Compare((Players In Slot(0, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(0, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(0, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(1, All Teams), Asleep), Compare((Players In Slot(1, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(1, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(1, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(2, All Teams), Asleep), Compare((Players In Slot(2, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(2, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(2, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(3, All Teams), Asleep), Compare((Players In Slot(3, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(3, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(3, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(4, All Teams), Asleep), Compare((Players In Slot(4, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(4, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(4, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(5, All Teams), Asleep), Compare((Players In Slot(5, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(5, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(5, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(6, All Teams), Asleep), Compare((Players In Slot(6, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(6, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(6, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(7, All Teams), Asleep), Compare((Players In Slot(7, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(7, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(7, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(8, All Teams), Asleep), Compare((Players In Slot(8, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(8, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(8, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(9, All Teams), Asleep), Compare((Players In Slot(9, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(9, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(9, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(10, All Teams), Asleep), Compare((Players In Slot(10, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(10, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(10, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create Effect(If-Then-Else(And(Has Status(Players In Slot(11, All Teams), Asleep), Compare((Players In Slot(11, All Teams)).thrower, ==, Null)), All Players(All Teams), Empty Array), Ring, If-Then-Else(Compare(Players In Slot(11, All Teams), !=, Global.leader), Color(Red), Color(Yellow)), Position Of(Players In Slot(11, All Teams)), Global.pickupRadius, Visible To Position Radius and Color);
Create In-World Text(Filtered Array(All Players(All Teams), And(And(Compare(Global.leader, !=, Null), Compare(Current Array Element, !=, Global.leader)), Is Alive(Global.leader))), Custom String("#1", Null, Null, Null), Global.leader, 2.0, Clip Against Surfaces, Visible To and Position, Custom Color(255, 221, 0, 255), Default Visibility);
Create In-World Text(All Players(All Teams), Global.stringTitle, Vector(0, Add(20, Global.y), 113), 4, Clip Against Surfaces, Visible To String and Color, Custom Color(Global.titleColorR, Global.titleColorG, Global.titleColorB, 255), Default Visibility);
Create In-World Text(All Players(All Teams), Global.stringSubtitle, Vector(0, Add(15, Global.y), 113), 2, Clip Against Surfaces, Visible To and String, Color(White), Default Visibility);
}
}
rule ("Debug Mode Setup") {
event {
Subroutine;
debug;
}
actions {
Create HUD Text(Host Player, Server Load Average, 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);
Teleport(Event Player, Sorted Array(Randomized Array(Global.spawnPositionArray), Count Of(Players Within Radius(Current Array Element, 10, All Teams, Off))));
Wait(0.016, Ignore Condition);
Set Facing(Event Player, Direction Towards(Event Player, Vector(0, Add(Global.y, Subtract(Eye Position(Event Player), Position Of(Event Player))), 0)), To World);
Set Player Variable(Event Player, ready, True);
}
}
rule ("Chase Color") {
event {
Ongoing - Global;
}
actions {
Chase Global Variable At Rate(titleColorB, 255, 300, Destination and Rate);