### Zen Setup Rule Example Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_fivenightsatecopoint.txt The '[G] Zen Setup' rule initializes Zenyatta bot behavior. It waits for a condition, creates a dummy bot, sets its properties, and configures its position arrays for later use. ```Overwatch Scripting rule ("[G] Zen Setup") { event { Ongoing - Global; } conditions { Global.NightNumber >= 1; } actions { Wait(1, Ignore Condition); Create Dummy Bot(Hero(Zenyatta), Team 2, 4, Vector(2, 7.4, 22.4), Left); Set Global Variable(Zen, Players In Slot(4, Team 2)); Start Scaling Player(Global.Zen, 1.35, False); Set Global Variable(ZenPositions, Array(Vector(-1.92, 7, -54.26), Vector(-9.09, 7.23, -30.7), Vector(-10.11, 8.51, -1.69), Vector(28.2, 3, 1.2), Vector(18, 4.9, -9.52), Vector(23.9, 9, -5.63), Vector(-4.23, 7, 54.36))); Set Global Variable(ZenPositions2, Array(Null, Array(Vector(-8.69, 7, -49.87), Vector(16.82, 8.96, -48.44)), Array(Vector(-12.25, 7.24, -33.65), Vector(-2.2, 7.34, -31.7)), Array(Vector(-20.72, 7, 6.54), Vector(-19.22, 12, 8.7), Vector(-10.91, 7, 8.71)), Array(Vector(23.93, 3.15, -5.11), Vector(29.37, 3.15, 3.7)), Array(Vector(18, 5.96, -11.64)), Array(Vector(23.62, 9, 5.63), Vector(23.1, 6.86, -12.56)), Array(Vector(3.34, 8, 53.94), Vector(-13.06, 7, 44.26)))); Set Invisible(Global.Zen, All); Set Healing Received(Global.Zen, 0); Disable Movement Collision With Players(Global.Zen); Start Facing(Global.Zen, Direction Towards(Eye Position(Global.Zen), Eye Position(Global.Player_)), 1000, To World, Direction and Turn Rate); Disable Built-In Game Mode Respawning(Global.Zen); } } ``` -------------------------------- ### Initial Game Setup Rule Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_1v1buildyourhero.txt This rule executes globally at the start of the game to initialize HUD elements. It sets up custom HUD text for all players and teams, configuring its appearance and visibility. ```OverScript rule("1v1 Build your hero by Seita") { event { Ongoing - Global; } actions { Global.StartHud = -1; Global.StartHud2 = -1; Create HUD Text(All Players(All Teams), Null, Null, Custom String(" "), Top, 21, Color(White), Color(White), Color(White), Visible To and String, Default Visibility); } } ``` -------------------------------- ### Pre-Arena 1 Match Setup and Initial Actions Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_1v1arena.txt This rule defines the initial setup and actions before Arena 1 starts. It checks for players being spawned and ready in the Arena 1 queue, and if no match is active. The actions include setting global variables for match state, waiting, teleporting players to specific spawns, setting their facing direction, resetting spectator and dead helper states, healing them, and marking the first match as true. It also includes a conditional action for dummy bots. ```OverScript rule ("Arena 1: First Match") { event { Ongoing - Global; } conditions { Global.GameLoaded == True; Value In Array(Global.Arena1Q, 1) == True; Value In Array(Global.Arena1Q, 2) == True; Global.Arena1Match == False; Global.FirstMatch == False; } actions { Set Global Variable(Arena1Match, True); Wait(0.25, Ignore Condition); Teleport(Value In Array(Global.Arena1Q, 1), First Of(Global.MainOppositeSpawn)); Teleport(Value In Array(Global.Arena1Q, 2), Value In Array(Global.MainOppositeSpawn, 1)); Wait(0.05, Ignore Condition); Set Facing(Value In Array(Global.Arena1Q, 1), Local Vector Of(Global.MainFacing, Value In Array(Global.Arena1Q, 1), Rotation And Translation), To Player); Set Facing(Value In Array(Global.Arena1Q, 2), Local Vector Of(Global.MainFacing, Value In Array(Global.Arena1Q, 2), Rotation And Translation), To Player); Wait(0.05, Ignore Condition); Set Player Variable(Value In Array(Global.Arena1Q, 1), Spectating, 0); Set Player Variable(Value In Array(Global.Arena1Q, 2), Spectating, 0); Wait(0.3, Ignore Condition); Heal(Value In Array(Global.Arena1Q, 1), Null, 1000); Heal(Value In Array(Global.Arena1Q, 2), Null, 1000); Set Player Variable(Value In Array(Global.Arena1Q, 1), DeadHelper, False); Set Player Variable(Value In Array(Global.Arena1Q, 2), DeadHelper, False); Set Global Variable(FirstMatch, True); If(Is Dummy Bot(Players In Slot(11, All Teams))); Set Player Variable(Players In Slot(11, All Teams), BotTracerFirstBlink, True); } } ``` -------------------------------- ### Orisa AI Setup and Initialization Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_fivenightsatecopoint.txt Sets up the Orisa bot, scales its player model, and initializes game variables. It also handles initial status effects and displays in-world text for AI and meter values. This rule ensures the Orisa AI is ready at the start of the game. ```Overwatch Workshop Script rule ("[G] Orisa Setup") { event { Ongoing - Global; } conditions { Global.NightNumber != 5; } actions { Wait(0.5, Ignore Condition); Create Dummy Bot(Hero(Orisa), Team 2, 1, Vector(-10.7, 8.52, -0.37), Right); Set Global Variable(Orisa, Players In Slot(1, Team 2)); Start Scaling Player(Global.Orisa, 1.35, False); Wait Until(Is Game In Progress, 99999); Set Status(Players On Hero(Hero(Orisa), All Teams), Null, Knocked Down, 9999); Set Global Variable(OrisaMeter, 100); Skip If(Not(First Of(Global.Cheats)), 1); Create In-World Text(All Players(All Teams), Custom String("{0} {1} / {2} A.I", Hero Icon String(Hero(Orisa)), Global.OrisaMeter, Global.OrisaAI), Global.Orisa, 1.2, Do Not Clip, Visible To Position and String, Custom Color(255, 255, 255, 175), Default Visibility); //lbl_0: } } ``` -------------------------------- ### OverPy Setup Code: Dummy Bot Creation and Variable Initialization Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/strings.txt This snippet initializes global variables and sets up dummy bots for the OverPy project. It uses custom functions like Create Dummy Bot, Start Forcing Dummy Bot Name, and Set Global Variable. Dependencies include OverPy's internal functions and potentially Workshop.codes API for string manipulation. ```OverPy Script variables { global: 0: A 1: B 2: C 3: D 4: E 5: F 6: G 7: H 8: owo 127: __holygrail__ } rule ("OverPy <­tx> / <­fg> setup code") { event { Ongoing - Global; } actions { "By Zezombye" Create Dummy Bot(All Heroes, If-Then-Else(Number Of Slots(Team 1), Team 1, If-Then-Else(Number Of Slots(Team 2), Team 2, True)), False, Null, Null); "More info: https://workshop.codes/wiki/articles/tx-reference-sheet" Start Forcing Dummy Bot Name(Last Created Entity, Custom String("______________________________________________________________________________________________________________________________〼")); Set Global Variable(__holygrail__, String Split(First Of(Last Created Entity), Empty Array)); Start Forcing Dummy Bot Name(Last Created Entity, Custom String("______________________________________________________________________________________________________________________________ࡀ")); Set Global Variable(__holygrail__, String Slice(String Replace(Custom String("______________________________________________________________________________________________________________________________〼"), Global.__holygrail__, First Of(Last Created Entity)), 126, True)); Destroy All Dummy Bots; } } ``` -------------------------------- ### Initialize Game Setup and HUD Elements Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_1v1buildyourhero.txt This rule initializes global variables and creates HUD elements at the start of the game. It sets up initial game states and displays important information to players. ```overwatch_workshop rule ("While in setup") { event { Ongoing - Global; } conditions { Is In Setup == True; } actions { Destroy All Dummy Bots; Set Player Variable(All Players(All Teams), FirstHeroBuilt, False); Set Match Time(300); Create HUD Text(All Players(All Teams), Custom String("Press {0} to build your hero!", Input Binding String(Button(Interact))), Custom String("Round will start after both players have confirmed their first build."), Custom String("Press the -> Confirm <- button to confirm your build."), Top, 20, Color(Green), Color(White), Color(White), Visible To and String, Default Visibility); Set Global Variable(StartHud, Last Text ID); Create HUD Text(All Players(All Teams), Custom String("Code: METDP"), Custom String("twitter.com/Seita_ow"), Custom String("Full details: workshop.codes/1v1meta"), Top, 22, Color(Orange), Color(Blue), Color(White), Visible To and String, Default Visibility); Set Global Variable(StartHud2, Last Text ID); Set Ultimate Charge(All Players(All Teams), 0); Set Player Variable(All Players(All Teams), UltKeep, 0); } } ``` -------------------------------- ### Setup Phase Rule Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_1v1buildyourhero.txt A global rule that triggers continuously while the game is in the setup phase. It likely contains conditions or actions specific to the game's initial setup period. ```OverScript rule("While in setup") { event { Ongoing - Global; } conditions { Is In Setup == True; } } ``` -------------------------------- ### OverPy Raycast: Get Hit Player Source: https://github.com/zezombye/overpy/wiki/Functions Demonstrates how to get the player object that was hit by a raycast. The raycast parameters include start and end points, and optional filters for objects and players. ```OverPy raycast(start, end, include, exclude, includePlayersObjects).getPlayerHit() ``` -------------------------------- ### Bastion Setup and Initialization Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_fivenightsatecopoint.txt This script handles the setup for the 'Bastion' character. It creates a dummy bot, sets global variables for Bastion's state, and displays in-world text indicating AI and phase information. ```Overwatch Workshop rule ("G] Bastion Setup") { event { Ongoing - Global; } conditions { Global.NightNumber != 5; } actions { Create Dummy Bot(Hero(Bastion), Team 2, 0, Vector(-12.74, 7, -49.92), Left); Set Global Variable(Bastion, Players In Slot(0, Team 2)); Start Scaling Player(Global.Bastion, 1.3, False); Start Modifying Hero Voice Lines(Global.Bastion, 1.5, True); Wait Until(Is Game In Progress, 99999); Skip If(Not(First Of(Global.Cheats)), 1); Create In-World Text(All Players(All Teams), Custom String("{0} {1} / {2} A.I", Hero Icon String(Hero(Bastion)), Global.BastionPhase, Global.BastionAI), Global.Bastion, 1.2, Do Not Clip, Visible To Position and String, Custom Color(255, 255, 255, 175), Default Visibility); //lbl_0: } } ``` -------------------------------- ### Remove HUD on Round Start Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_1v1buildyourhero.txt This rule ensures that specific HUD texts are destroyed once the game is in progress and not in the setup phase. This cleans up the screen after the initial setup and hero selection. ```overwatch_workshop rule ("Remove Hud") { event { Ongoing - Global; } conditions { Is Game In Progress == True; Is In Setup == False; } actions { Destroy HUD Text(Global.StartHud); Destroy HUD Text(Global.StartHud2); } } ``` -------------------------------- ### OverPy Setup Code for Initialization and Dummy Bot Creation Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/lowercase.txt This snippet defines the initial setup for OverPy. It includes the creation of dummy bots with specific configurations, setting global variables, and managing dummy bot instances. The `__holygrail__` global variable is used for string manipulation related to bot names. ```overpy variables { global: 0: A 1: B 127: __holygrail__ } rule ("OverPy <­tx> / <­fg> setup code") { event { Ongoing - Global; } actions { "By Zezombye" Create Dummy Bot(All Heroes, If-Then-Else(Number Of Slots(Team 1), Team 1, If-Then-Else(Number Of Slots(Team 2), Team 2, True)), False, Null, Null); "More info: https://workshop.codes/wiki/articles/tx-reference-sheet" Start Forcing Dummy Bot Name(Last Created Entity, Custom String("______________________________________________________________________________________________________________________________〼")); Set Global Variable(__holygrail__, String Split(First Of(Last Created Entity), Empty Array)); Start Forcing Dummy Bot Name(Last Created Entity, Custom String("______________________________________________________________________________________________________________________________ࡀ")); Set Global Variable(__holygrail__, String Slice(String Replace(Custom String("______________________________________________________________________________________________________________________________〼"), Global.__holygrail__, First Of(Last Created Entity)), 126, True)); Destroy All Dummy Bots; } } ``` -------------------------------- ### Summoner Intro Cutscene and Setup Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_junkensteinsvictory.txt Initiates the summoner intro cutscene and sets up game variables for the next phase. This includes color assignments, health, power levels, spawn points, and character strings. It also manages dummy bots and object positions. ```Overwatch Script rule("summoner intro cutscene") { event { Ongoing - Global; } conditions { Global.phase == 16; Y Component Of(Global.objective_pos) < 100; Is True For All(Filtered Array(All Players(Team 2), !Is Dummy Bot(Current Array Element)), Distance Between(Current Array Element, Global.objective_pos) < 4) == True; } actions { Stop Chasing Global Variable(shop_angle); Global.door_color = Color(White); Global.summoner_color = Color(Orange); Global.door_health = 100; Global.summoner_power = 100; Global.zomnic_spawns = Array(Vector(56.839, 17.720, -110.326), Vector(74.472, 10.700, -110.592), Vector(101.742, 9.580, -92.779)); Global.door = Vector(89.089, 14.071, -63.589); Global.summoner_chars = Custom String("ηπραγματικότητασκύβειστηθέλησήμουΗΠΡΑΓΜΑΤΙΚΟΤΗΤΑΕΠΙΤΥΧΕΙΣΤΗ ΘΕΛΗΣΗΜΟΥ"); Press Button(Global.merchant, Button(Ability 1)); Global.objective_pos = Global._extendedGlobalCollection; Destroy Dummy Bot(Team 1, Slot Of(Global.merchant.attack)); Global.shop_open = False; Wait(0.400, Ignore Condition); Destroy Dummy Bot(Team 2, 5); Chase Global Variable At Rate(pentagram_radius, 3, 0.316, Destination and Rate); ``` -------------------------------- ### Example Gamemode Integration (Overpy) Source: https://github.com/zezombye/overpy/wiki/Dummy-bot-pathfinding This provides a link to an example gamemode in Overpy's GitHub repository, which can be used to understand and integrate the pathfinding system into existing or new gamemodes. The file is located at modules/bots/example_gamemode.opy. ```Link https://github.com/Zezombye/overpy/blob/master/modules/bots/example_gamemode.opy ``` -------------------------------- ### For Loop Examples in Overpy Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/loops.txt Illustrates the usage of 'for' loops in Overpy for iterating a specific number of times or over a range. The examples show different ways to define loop parameters, including starting value, ending value, and step, as well as iterating with player variables. ```Overpy rule ("for loop") { event { Ongoing - Global; } actions { For Global Variable(I, 1, 3, 2); Modify Global Variable(A, Add, True); End; For Global Variable(I, 1, 3, True); Modify Global Variable(A, Add, True); End; For Global Variable(I, 0, 3, True); Modify Global Variable(A, Add, True); End; For Player Variable(Host Player, I, 0, 3, True); Modify Global Variable(A, Add, True); End; } } ``` -------------------------------- ### Shop UI Setup in Overpy Script Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_junkensteinsvictory.txt This subroutine is responsible for setting up the shop's user interface. It animates a shop angle, creates in-world text elements for shop items and navigation, and displays contextual information based on player selections and shop state. ```Overpy Script rule("shop ui setup") { event { Subroutine; shop_ui_setup; } actions { Chase Global Variable At Rate(shop_angle, 9999800320.000, 250, None); Create In-World Text(Filtered Array(All Players(All Teams), Current Array Element.shop > False), Custom String("{0}{1}", Local Player.shop_selection == 69 ? Custom String("▶ ") : Custom String(""), Local Player.shop == 1 ? Custom String( "[Exit Shop]") : Custom String("[Back]")), Last Of(Global.shop_campos) + Global.shop_left * ( Local Player.shop_selection == 69 ? -3.100 : -3) + Down + Global.shop_left * ( Local Player.shop_selection == 69 ? 0.100 : False) * Sine From Degrees(Global.shop_angle), 2, Do Not Clip, Visible To Position and String, Color(White), Default Visibility); "page 1" Create In-World Text(Filtered Array(All Players(All Teams), Current Array Element.shop == 1), Custom String("{0}Potions {1}", Local Player.shop_selection ? Custom String("") : Custom String("▶ "), Icon String(Poison 2)), Last Of(Global.shop_campos) + Global.shop_left * 1.500 + Up * Sine From Degrees(Global.shop_angle) * (Local Player.shop_selection ? False : 0.100), 3, Do Not Clip, Visible To Position and String, Color(Purple), Default Visibility); Create In-World Text(Filtered Array(All Players(All Teams), Current Array Element.shop == 1), Custom String("{0}Scrolls {1}", Local Player.shop_selection == 1 ? Custom String("▶ ") : Custom String(""), Icon String(Spiral)), Last Of(Global.shop_campos) + Global.shop_left * -1.500 + Up * (Local Player.shop_selection == 1 ? 0.100 : False) * Sine From Degrees(Global.shop_angle), 3, Do Not Clip, Visible To Position and String, Color(Yellow), Default Visibility); Create In-World Text(Filtered Array(All Players(All Teams), Current Array Element.shop == 1), Custom String( "Come forth and browse my alchemical goods,
{0}Or gaze upon my collection of forbidden academia.", Global.newline), Last Of( Global.shop_campos) + Down * 1.500, 1.500, Do Not Clip, Visible To Position and String, Global.t2_hero_colours[6], Default Visibility); "page 2" For Player Variable(Event Player, i, 0, 5, True); } } ``` -------------------------------- ### Setup Pictionary Players Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_pictionary.txt This rule sets up individual players for the Pictionary game once the game has started. It creates in-world text for each player and initializes their score. ```overwatch_script rule ("Setup Pictionary Players") { event { Ongoing - Each Player; All; All; } conditions { Global.StartPictionary == True; } actions { Create In-World Text(Event Player, (Event Player).WordArray, Add(Eye Position(Event Player), Facing Direction Of(Event Player)), 1.5, Do Not Clip, Visible To Position and String, Color(White), Default Visibility); Set Player Variable(Event Player, Points, 0); } } ``` -------------------------------- ### Main Setup for Game Initialization Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_fivenightsatecopoint.txt Initializes the game by creating a Rein dummy bot, forcing player position, setting invisibility, disabling various game modes, and setting up global variables like Power and CurrentTime. It also teleports the player and configures HUD elements. Dependencies include various setup and initialization functions. ```overwatch_script rule("[G] Main Setup") { event { Ongoing - Global; } actions { "REIN" Create Dummy Bot(Hero(Reinhardt), Team 1, 1, Vector(0, 200, 0), Vector(-1, 0, 0)); Start Forcing Player Position(Players In Slot(1, Team 1), Vector(0, 200, 0), False); Set Invisible(Players In Slot(1, Team 1), All); "STUFF" Disable Built-In Game Mode Announcer; Disable Built-In Game Mode Completion; Disable Built-In Game Mode Music; Disable Built-In Game Mode Scoring; Disable Inspector Recording; Global.NightPhase = 999; Wait Until(Is Game In Progress && Has Spawned(Players In Slot(0, Team 1)), 99999); Start Rule(OutlineFix, Restart Rule); Pause Match Time; Global.Player = Players In Slot(0, Team 1); Global.Power = 100; Global.PowerUsage = 1; Chase Global Variable Over Time(CurrentTime, 6, 512, None); Create Effect(Global.Blinded ? Global.Player : Null, Sphere, Color(Black), Global.Player, 100, Visible To Position and Radius); Teleport(Global.Player, Vector(-1.060, 7.400, -27.550)); Set Facing(Global.Player, Vector(0.700, 0, 0.700), To World); Disable Scoreboard(All Players(All Teams)); Disable Game Mode HUD(All Players(All Teams)); Disable Hero HUD(All Players(All Teams)); Start Forcing Player Outlines(All Players(All Teams), All Players(All Teams), False, Color(White), Default); Disable Nameplates(All Players(All Teams), All Players(All Teams)); Disable Text Chat(All Players(All Teams)); Set Knockback Received(All Players(All Teams), 0); Set Damage Dealt(Global.Player, 0); "HUD" Skip If(Global.NightNumber == 5, 1); Create HUD Text(All Players(All Teams), Custom String("{0} AM", Global.CurrentTime < 1 ? 12 : Round To Integer(Global.CurrentTime, ``` -------------------------------- ### Initialize Game Setup Rule Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_islandparty.txt This code defines the initial setup rule for the game. It sets global variables for round timers, player respawning, and island party codes. It also populates a hero list and creates HUD elements to display game information to all players. ```javascript rule ("Is in setup {GLOBAL}") { event { Ongoing - Global; } conditions { Is In Setup == True; } actions { Set Global Variable(roundTimer, 60); Enable Death Spectate All Players(All Players(All Teams)); Disable Built-In Game Mode Respawning(All Players(All Teams)); Set Respawn Max Time(All Players(All Teams), 60); Set Global Variable(islandPartyCode, Custom String("W468T")); Set Global Variable(islandPartySpecialEdition, Custom String("")); Set Global Variable(roundNumber, 0); Set Global Variable(heroList, Empty Array); Set Global Variable(heroesOfPreviousRounds, Empty Array); Set Global Variable(discordSubtringArray, Array(Custom String("vote for the next minigame"), Custom String("give feedback"), Custom String("report bugs"))); Modify Global Variable(heroList, Append To Array, Hero(Ana)); Modify Global Variable(heroList, Append To Array, Hero(Bastion)); Modify Global Variable(heroList, Append To Array, Hero(Brigitte)); Modify Global Variable(heroList, Append To Array, Hero(Doomfist)); Modify Global Variable(heroList, Append To Array, Hero(D.Va)); Modify Global Variable(heroList, Append To Array, Hero(Echo)); Modify Global Variable(heroList, Append To Array, Hero(Genji)); Modify Global Variable(heroList, Append To Array, Hero(Lúcio)); Modify Global Variable(heroList, Append To Array, Hero(Cassidy)); Modify Global Variable(heroList, Append To Array, Hero(Mei)); Modify Global Variable(heroList, Append To Array, Hero(Mercy)); Modify Global Variable(heroList, Append To Array, Hero(Pharah)); Modify Global Variable(heroList, Append To Array, Hero(Reinhardt)); Modify Global Variable(heroList, Append To Array, Hero(Roadhog)); Modify Global Variable(heroList, Append To Array, Hero(Sigma)); Modify Global Variable(heroList, Append To Array, Hero(Soldier: 76)); Modify Global Variable(heroList, Append To Array, Hero(Sombra)); Modify Global Variable(heroList, Append To Array, Hero(Symmetra)); Modify Global Variable(heroList, Append To Array, Hero(Torbjörn)); Modify Global Variable(heroList, Append To Array, Hero(Tracer)); Modify Global Variable(heroList, Append To Array, Hero(Widowmaker)); Modify Global Variable(heroList, Append To Array, Hero(Winston)); Modify Global Variable(heroList, Append To Array, Hero(Zenyatta)); Create HUD Text(All Players(All Teams), Custom String("CODE: {0}", Global.islandPartyCode), If-Then-Else(Compare(Global.islandPartyCode, ==, Custom String("W468T")), Custom String(""), Custom String("SPECIAL EDITION")), Global.islandPartySpecialEdition, Left, -998.5, Color(White), Color(Sky Blue), Color(White), Visible To and String, Default Visibility); Create HUD Text(All Players(All Teams), Null, Custom String(" "), Custom String("Island Party - Heroes Minigames v3.1.1-23"), Left, -998, Color(White), Color(White), Color(Orange), Visible To and String, Default Visibility); } } ``` -------------------------------- ### Setup Pictionary Players Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_pictionary.txt Configures players for the Pictionary game once it has started. It displays the player's word list in-world and initializes their score to zero. ```Lua rule("Setup Pictionary Players") { event { Ongoing - Each Player; All; All; } conditions { Global.StartPictionary == True; } actions { Create In-World Text(Event Player, Event Player.WordArray, Eye Position(Event Player) + Facing Direction Of(Event Player), 1.500, Do Not Clip, Visible To Position and String, Color(White), Default Visibility); Event Player.Points = 0; } } ``` -------------------------------- ### Setup Initial Player Highlight Position - Overwatch Script Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_uno.txt This script sets the initial starting position for highlight effects that indicate the selected player. It assigns the global map position to a player-specific variable, ensuring the highlight starts at a defined point. Requires Event Player and Global variables. ```Overwatch Script Event Player.SelectedPlayerHighlightPosition = Global.MapPosition; ``` -------------------------------- ### Initialize Game State and Dialogue Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_junkensteinsvictory.txt Sets up initial game state variables, defines dialogue sequences for different scenarios, and calls subroutines to manage dialogue presentation. Handles conditional dialogue based on game variables. ```Custom Script actions { Wait(True, Abort When False); Global.phase = 0.100; Global.objective_complete = True; Global.skip_cutscene_pos = Vector(-12.386, 2.259, -4.887); If(!Global._objectVariable_0); Global.active_dialogue_list = Array(Array(Hero(Reinhardt), Custom String( "Our tale begins in Adlersbrunn, where the lord of the castle has called for heroes to come to his aid,"), 0.500), Array(Hero( Reinhardt), Custom String("to defend him against the mad Dr.​ Junkenstein and his minions."), 1), Array(Hero(Mercy), Custom String("Excuse me, minion? Tch, don't be absurd. If anything, the mad doctor is my minion."), 1), Array(Hero(Junkrat), Custom String( "Oh, stick a sock in it, you old hag. I'll have ya know the great Dr.​ Junkenstein doesn't take kindly to such remarks."), 1), Array(Hero(Mercy), Custom String("Old- old hag!? Why, I never!"), 1), Array(Hero(Roadhog), Custom String( "To be fair, you're somewhere between three to six centuries old."), 1), Array(Hero(Mercy), Custom String( "Yet with the complexion of a rose! It's no easy feat staying so youthful."), 1), Array(Hero(Mercy), Custom String( "Do you know how much I spend on vitamin C serums alone?"), 1), Array(Hero(Reaper), Custom String("My wife left me."), 1.500)); Call Subroutine(main_dialogue); End; Wait(0.100, Ignore Condition); If(Global._objectVariable_0); Global.active_dialogue_list = Array(Array(Hero(Reinhardt), Custom String("...", 1), Array(Hero(Reinhardt), Custom String( "...What are you doing with Zommy. Put her back."), 1), Array(Hero(Reinhardt), Custom String( "She's sensitive to the moonlight."), 1)); Call Subroutine(main_dialogue); Wait(1, Ignore Condition); Kill(Global.faq_bot, Null); Wait(2, Ignore Condition); Global.active_dialogue_list = Array(Array(Hero(Reinhardt), Custom String("...Okay, nevermind. Let's just move on."), 1), Array( Hero(Reaper), Custom String("I miss my wife."), 1.500)); Call Subroutine(main_dialogue); End; Global.skip_cutscene_pos = Global._extendedGlobalCollection; Global.phase = 1; Global.objective = Custom String("Reach the Village of Adlersbrunn."); Start Rule(obj_color, Restart Rule); Global.objective_pos = Vector(8.302, 6, -68.151); Global.objective_complete = False; All Players(Team 2).late_join_check = True; Destroy Dummy Bot(Team 2, 5); } } ``` -------------------------------- ### Genji Setup Rule Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/z_fivenightsatecopoint.txt This rule initializes Genji's presence in the game. It creates a dummy bot, sets its global variable, scales its player, and handles initial game state conditions. It also includes logic for displaying in-world text related to Genji's power and AI. ```overpy rule ("[G] Genji Setup") { event { Ongoing - Global; } conditions { Global.NightNumber != 5; Global.NightNumber > 1; } actions { Wait(0.75, Ignore Condition); Create Dummy Bot(Hero(Genji), Team 2, 3, Vector(-2.6, 7, 54.5), Vector(-0.7, 0, -0.71)); Set Global Variable(Genji, Players In Slot(3, Team 2)); Start Scaling Player(Global.Genji, 1.6, False); Wait Until(Is Game In Progress, 99999); Set Status(Players On Hero(Hero(Genji), All Teams), Null, Knocked Down, 9999); Set Global Variable(HeaterPower, 100); Skip If(Not(First Of(Global.Cheats)), 1); Create In-World Text(All Players(All Teams), Custom String("{0} {1} / {2} A.I", Hero Icon String(Hero(Genji)), Global.HeaterPower, Global.GenjiAI), Global.Genji, 1.2, Do Not Clip, Visible To Position and String, Custom Color(255, 255, 255, 175), Default Visibility); Create Effect(All Players(All Teams), Zarya Particle Beam Sound, Color(Team 2), Value In Array(Global.CamPositions, 7), Divide(Global.HeaterPower, 2), Visible To Position and Radius); Create In-World Text(If-Then-Else(Compare(Global.CurrentCam, ==, 7), Global.Player_, Null), String Slice(Custom String("■■■■■■■■■■■■■■■■"), 0, Divide(Global.HeaterPower, 6.25)), Update Every Frame(Add(Multiply(Direction From Angles(Horizontal Facing Angle Of(Global.Player_), Add(Vertical Facing Angle Of(Global.Player_), 22)), 1000), Value In Array(Global.CamPositions, 7))), 2.7, Do Not Clip, Visible To Position String and Color, Custom Color(255, Multiply(Global.HeaterPower, 2.55), Global.HeaterPower, If-Then-Else(Compare(Divide(Global.HeaterPower, 6.25), >, 15.5), 215, 160)), Default Visibility); } } ``` -------------------------------- ### Genji Setup and Initialization Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_fivenightsatecopoint.txt Sets up the Genji character in the game, including creating a dummy bot, scaling it, and applying initial status effects. It also displays in-world text related to Genji's AI and power. ```Overwatch Lua Wait(0.750, Ignore Condition); Create Dummy Bot(Hero(Genji), Team 2, 3, Vector(-2.600, 7, 54.500), Vector(-0.700, 0, -0.710)); Global.Genji = Players In Slot(3, Team 2); Start Scaling Player(Global.Genji, 1.600, False); Wait Until(Is Game In Progress, 99999); Set Status(Players On Hero(Hero(Genji), All Teams), Null, Knocked Down, 9999); Global.HeaterPower = 100; Skip If(!Global.Cheats[0], 1); Create In-World Text(All Players(All Teams), Custom String("{0} {1} / {2} A.I", Hero Icon String(Hero(Genji)), Global.HeaterPower, Global.GenjiAI), Global.Genji, 1.200, Do Not Clip, Visible To Position and String, Custom Color(255, 255, 255, 175), Default Visibility); ``` -------------------------------- ### OverPy Raycast: Get Normal Source: https://github.com/zezombye/overpy/wiki/Functions Explains how to perform a raycast and retrieve the normal vector of the surface hit. The raycast originates from 'start' and extends to 'end', with optional inclusion/exclusion filters for objects and players. ```OverPy raycast(start, end, include, exclude, includePlayersObjects).getNormal() ``` -------------------------------- ### Create and Manage Merchant Dummy Bot with Dialogue Source: https://github.com/zezombye/overpy/blob/master/src/tests/decompiler/z_junkensteinsvictory.txt This snippet demonstrates how to create a dummy bot that acts as a merchant, initiates a dialogue sequence with players, and manages dialogue priority. It includes setting up the bot's initial state, dialogue content, and dialogue management logic. ```Overwatch Workshop Create Dummy Bot(Hero(Moira), Team 2, 9, Global._extendedGlobalCollection, Vector(0.910, False, 0.420)); Global.merchant = Last Created Entity; Wait(5, Ignore Condition); Abort If(Global.dialogue_priority >= 3); Global.skip_cutscene_pos = Vector(7.650, 7.080, -72.890); Global.dialogue_priority = 2; Global.is_dialoguing = True; Wait Until(!Global.main_dialogue, 99999); Global.is_dialoguing = False; Global.active_dialogue_list = Array(Array(Hero(Moira), Custom String("Come hither, evil ones, and browse my arcane wares."), 1), Array(Hero(Junkrat), Custom String("Ooh, a merchant! I hope she accepts evil dollars."), 1), Array(Hero(Mercy), Custom String( "Oh, be still, my accursed heart! Arcane wares? You certainly know how to treat a lady."), 1), Array(Hero(Moira), Custom String("Wicked Witch, I'm afraid this is no treat. I'm here to run a business, you see."), 1), Array(Hero(Mercy), Custom String("How you enchant me with your sinister voice! Your spell of seduction is strong, fellow witch."), 1), Array(Hero( Moira), Custom String("I am no witch. I am merely a merchant of darkness."), 1), Array(Hero(Mercy), Custom String( "Tut, tut! No need for humility, my love. Pray tell, are you free later at break of dawn?"), 1), Array(Hero(Mercy), Custom String("I just have an errand to run. Kill the Lord and all that, you know how it is."), 1), Array(Hero(Moira), Custom String("Wicked witch, I plead of you. I am only here to sell my wares. Please buy something."), 1), Array(Hero(Mercy), Custom String("Oh, you can tell me all about your wares at supper later, you charming devil."), 1), Array(Hero(Moira), Custom String("Please. Buy something."), 1.500)); Call Subroutine(main_dialogue); Global.dialogue_priority = False; Global.skip_cutscene_pos = Global._extendedGlobalCollection; Global.phase = 8; Global.objective_pos = Vector(28.598, 6.067, -72.890); ``` -------------------------------- ### Set Global Variable with Formatted Sequences Source: https://github.com/zezombye/overpy/blob/master/src/tests/results/strings.txt Demonstrates setting global variables with various sequential string formats. These examples showcase different patterns of repeating and ordered variables within custom strings. ```overpy Set Global Variable(A, Custom String("A, B, B, C, D {0}{1}{1}{2}", Global.A, Global.B, Custom String("{0}{1}", Global.C, Global.D))); Set Global Variable(A, Custom String("A, B, C, D {0}{1}{2}", Global.A, Global.B, Custom String("{0}{1}", Global.C, Global.D))); Set Global Variable(A, Custom String("A, A, B, B {0}{0}{1}{1}", Global.A, Global.B)); Set Global Variable(A, Custom String("A, B, C, B, A {0}{1}{2}{1}{0}", Global.A, Global.B, Global.C)); Set Global Variable(A, Custom String("A, B, C, D, A, B {0}{1}{2}", Global.A, Global.B, Custom String("{0}{1}{2}", Global.C, Global.D, Custom String("{0}{1}", Global.A, Global.B)))); ```