Login
Create
KaBLUey

Advanced Ability Handler

This code is over 6 months old. The code may have expired and might no longer function.

Overwatch Advanced Ability Handler || By KaBLUey#11520

Please credit me if you use this

Ability Handler

A handler by definition, is a routine, function, or method that is specialized in a particular type of data or is used in a specific way In this case, an ability handler is a type of handler that makes creating custom abilities much easier, and more optimized.

Making an ability reworking game can be pretty difficult, especially when starting from scratch. The job of this workshop tool is to make creating custom ability reworks easier, practical, and optimized. The handler includes many features like custom hero roles (e.g Tank, DPS, Support, ect.), an anti-crash system, automatic ability display, and much more.

The majority of features included in this ability handler can be pretty confusing to learn at first, but this description should hopefully provide enough information on how the features work.


Ability Display

The ability display is the information at the top left of your screen. It shows all reworked abilities as well as the hotkey it replaces, and a description of what the ability does.

To create your own ability display, you will need a set player variable action. The value of the variable will need to be set to array with up to 1,000 values in it

In the array, each value of the array must be set to another array. This array needs a minimum of 3 values.

Array index Description Value Type
0 The name of your ability custom string
1 The hotkey players press to use your ability button or null if the ability is passive
2 The description of your ability custom string
3 - 999 Any extra info on your ability, OR sub-ability custom string OR array (if sub-ability)

Sub Ability

A sub ability is an ability inside an ability. For example, when you activate an ability, some keybinds activate a completely different ability than before

Array index Description Value Type
0 The name of your sub-ability custom string
1 The hotkey players press to use your sub-ability button or null if the ability is passive
2 The description of your sub-ability custom string
3 - 999 Any extra info on your sub-ability custom string

Sub-sub abilities aren't added in the game yet. But who wants those?

EXAMPLE
I want to make it so that Junkrat players can view all of his abilities without having to open the help menu. This is what I would do
    variables
{
    player:
        121: abilities
}

rule("[Junkrat] View abilities")
{
    event
    {
        Ongoing - Each Player;
        All;
        Junkrat;
    }

    actions
    {
        Event Player.abilities = Array(Array(Custom String("Total Mayhem"), Null, Custom String(
            "Deals no damage to self with explosions. Drop bombs"), Custom String("on death")), Array(Custom String("Frag Launcher"),
            Button(Primary Fire), Custom String("Bouncing Explosive Projectile Weapon")), Array(Custom String("Concussion Mine"), Button(
            Ability 1), Custom String("Throw a knockback mine"), Array(Custom String("Detonate"), Button(Secondary Fire), Custom String(
            "Detonates current concussion mine"))), Array(Custom String("Steel Trap"), Button(Ability 2), Custom String(
            "Place an immobilizing trap")), Array(Custom String("Rip Tire"), Button(Ultimate), Custom String(
            "Drive and detonate an exploding tire")));
    }
}

Placer

A placer is an ability type, where you choose where something gets placed (think of it like Symmetra's teleporter)

To make an ability have a placer, you need to set the player variable newPlacer to the value array.

Array index Description Value Type
0 Size of placer number
1 Max distance placer can travel number
2 Force placer on ground boolean (true or false)
3 The color the placer shows up as Color or Custom Color

After that, another action needs to be added called call subroutine. The subroutined we're calling is called createPlacer

After that, another action needs to be added called abort if. The check will compare if player variable newPlacer == N

After that you may run any code that the placer does. Use the player variable newPlacer for the position of the placer

EXAMPLE
I want to give mei some sort of special ability where she can place an ice-sculpture down that freezes enemies in the way of it. This ability will replace ability 2.
First, I will need to initialize the player
Simply put, I will disallow the button ability 2 when the player swaps to mei.
rule("[Mei] Initialize")
{
    event
    {
        Ongoing - Each Player;
        All;
        Mei;
    }

    actions
    {
        Disallow Button(Event Player, Button(Ability 2));
    }
}
After I initialize the player, I will make the effect. I will need to check if the player isn't dead, isn't emoting, or doesn't have specific bad statuses. Then, I create the placer and call the subroutine.
Whatever comes next is up to you. I just decided to make a cool looking stalagmite.
    variables
{
    player:
        127: newPlacer
}

subroutines
{
    125: createPlacer
}

rule("[Mei] Ice Sculpture")
{
    event
    {
        Ongoing - Each Player;
        All;
        Mei;
    }

    conditions
    {
        Is Button Held(Event Player, Button(Ability 2)) == True;
        Is Dead(Event Player) == False;
        Is Communicating Any Emote(Event Player) == False;
        Has Status(Event Player, Hacked) == False;
        Has Status(Event Player, Knocked Down) == False;
        Has Status(Event Player, Asleep) == False;
        Has Status(Event Player, Frozen) == False;
        Has Status(Event Player, Stunned) == False;
        Ability Cooldown(Event Player, Button(Ability 2)) == 0;
    }

    actions
    {
        Event Player.newPlacer = Array(3.750, 7, True, Color(Aqua));
        Call Subroutine(createPlacer);
        Disallow Button(Event Player, Button(Ability 2));
        Abort If(Event Player.newPlacer == Custom String("N"));
        Play Effect(All Players(All Teams), Explosion Sound, Color(White), Event Player.newPlacer, 200);
        Play Effect(All Players(All Teams), Good Pickup Effect, Team Of(Event Player), Event Player.newPlacer, 1);
        Play Effect(All Players(All Teams), Good Pickup Effect, Team Of(Event Player), Event Player.newPlacer + Vector(0, 1, 0), 1);
        Play Effect(All Players(All Teams), Good Pickup Effect, Team Of(Event Player), Event Player.newPlacer + Vector(0, 2, 0), 1);
        Play Effect(All Players(All Teams), Ring Explosion, Team Of(Event Player), Event Player.newPlacer, 3.750);
        Play Effect(All Players(All Teams), Ring Explosion, Team Of(Event Player), Event Player.newPlacer + Vector(0, 1, 0), 2);
        Play Effect(All Players(All Teams), Good Pickup Effect, Team Of(Event Player), Event Player.newPlacer + Vector(0, 2, 0), 0.500);
        Set Status(Players Within Radius(Event Player.newPlacer, 3.750, Opposite Team Of(Team Of(Event Player)), Surfaces), Event Player,
            Frozen, 3.500);
        Set Ability Cooldown(Event Player, Button(Ability 2), 12);
    }
}
    

Projectile

Hopefully I don't have to define what a projectile is...

To make a custom projectile, you need to set the player variable newProjectile to the value array

Array index Description Value Type
0 Speed of projectile number
1 Gravity of projectile This doesn't work yet... still in development :( number
2 Size of projectile number
3 Color of projectile (to teammates) Color or Custom Color
4 Color of projectile (to enemies) Color or Custom Color
5 Lifetime of projectile number
6 Collision ID When a projectile collides with a wall, this is the value returned
7 Shields sigma gains from eating projectile (set to 0 if projectile is immune) So far sigma can't earn shields yet but he can still consume projectiles number
8 Can D.Va eat this bullet with defense matrix? boolean (true or false)
9 Can Genji deflect this bullet with deflect? boolean (true or false)

In a new ongoing - each player rule, you will add the condition checking if the player variable currentProjectileID == Collision ID

In the actions menu you can put whatever for making the projectile function. To get the position of the projectile, use the player variable projectilePosition

EXAMPLE
I want to give Cassidy a special ability where he shoots 3 fireworks that will explode.
First I need to initialize. I will disable his ability 2 since that is the ability that is being replaced.
rule("[Cassidy] Initialize")
{
    event
    {
        Ongoing - Each Player;
        All;
        Cassidy;
    }

    actions
    {
        Disallow Button(Event Player, Button(Ability 2));
    }
}

After that, I need to make the ability function.
I will check if the player uses ability 2, then if the player isn't dead, emoting, or has certain bad statuses.
Then, I will create 3 projectiles that are exactly the same, but shot at different times.
variables
{
    player:
        124: newProjectile
}

subroutines
{
    124: createProjectile
}

rule("[Cassidy] Create 3 fireworks")
{
    event
    {
        Ongoing - Each Player;
        All;
        Cassidy;
    }

    conditions
    {
        Is Button Held(Event Player, Button(Ability 2)) == True;
        Is Dead(Event Player) == False;
        Is Communicating Any Emote(Event Player) == False;
        Has Status(Event Player, Hacked) == False;
        Has Status(Event Player, Knocked Down) == False;
        Has Status(Event Player, Asleep) == False;
        Has Status(Event Player, Frozen) == False;
        Has Status(Event Player, Stunned) == False;
        Ability Cooldown(Event Player, Button(Ability 2)) == 0;
    }

    actions
    {
        Event Player.newProjectile = Array(27, 0, 0.120, Color(Yellow), Color(Red), 0.370, Custom String("Firework"), 25, True, True);
        Call Subroutine(createProjectile);
        Wait(0.200, Ignore Condition);
        Event Player.newProjectile = Array(27, 0, 0.120, Color(Yellow), Color(Red), 0.370, Custom String("Firework"), 25, True, True);
        Call Subroutine(createProjectile);
        Wait(0.200, Ignore Condition);
        Event Player.newProjectile = Array(27, 0, 0.120, Color(Yellow), Color(Red), 0.370, Custom String("Firework"), 25, True, True);
        Call Subroutine(createProjectile);
        Set Ability Cooldown(Event Player, Button(Ability 2), 10);
    }
}

Now, I will make the ability function.
We won't set which hero this works as, because this ability also works if Genji deflects the ability.
I just made a simple explosion that deals damage.
variables
{
    player:
        122: projectilePosition
        123: currentProjectileID
}

rule("[Cassidy] Fireworks explode")
{
    event
    {
        Ongoing - Each Player;
        All;
        All;
    }

    conditions
    {
        Event Player.currentProjectileID == Custom String("Firework");
    }

    actions
    {
        Play Effect(All Players(All Teams), Bad Explosion, Team Of(Local Player) == Team Of(Event Player) ? Color(Yellow) : Color(Red),
            Event Player.projectilePosition, 2);
        Play Effect(All Players(All Teams), Explosion Sound, Color(White), Event Player.projectilePosition, 200);
        Damage(Players Within Radius(Event Player.projectilePosition, 5, Opposite Team Of(Team Of(Event Player)),
            Surfaces And Enemy Barriers), Event Player, 35);
    }
}

Ability allowing/disallowing

Overwatch automatically has the ability to allow and disallow buttons. But you can't allow/disallow more than one at a time in a single action. So I decided to fix that.

Simply set the variable buttons to an array consisting of all the buttons you want to enable/disable. Keep in mind that each value in the array should be the value button, and not any other value type.

Follow this action with a call subroutine or start rule with the rule named Allow Buttons or Disallow Buttons

EXAMPLE
I want to make players unable to use their abilities. This is all I need to do
variables
    {
        player:
            126: buttons
    }
subroutines
    {
        127: disallowButtons
    }

actions
    {
        Event Player.buttons = array(button(Ability 1), button(Ability 2), button(Ultimate));
        Call Subroutine(disallowButtons);
    }

Modifiers

A modifier in this case is a stat (e.g. damage dealt, move speed, healing received, ect). The only problem with them is that they aren't stored as a value. This means you can't store variables as these modifiers unless you set them as a value before chaging the modifier.

With this change, you can change modifiers easily by changing a certain value in an array.

To change a modifier, use a set player variable at index or modify palyer variable at index. Choose the index you want to change, and set it to a number value.

Keep in mind that if you want to reset a value of a modifer, set the value to 0 instead of 100. If you set the value to 100, the modifier will output to 200% effectiveness

Array index Index Modifier Type
0 Move speed
1 Damage Dealt
2 Damage Received
3 Healing Dealt
4 Healing Received
5 Player scale
EXAMPLE
I want to give the players a small speed boost while they are in their spawn so they can get to the objective faster. This is what I would do.
Variables
    {
    player:
        111: modifiers
    }

Rule("[General] Speed Buff in spawn")
{
    event
        {
            Ongoing - Each Player;
            All;
            All;
        }
    
    Conditions
        {
            Is In Spawn Room(event player) == true;
        }
    
    Actions
        {
        Event Player.modifiers[0] += 50;
        Wait Until(!Is In Spawn Room(Event Player), 99999);
        Event Player.modifiers[0] -= 50;
        }
    }

Other Features

Extra features that are worth mentioning

  • Server anti-crash system

The handler automatically has a built-in anti-crash system. This will prevent the server from stopping when the workshop load gets too high by slowing the game speed. This is only really useful in gamemodes that use more resources, so keep that in mind.

If your game keeps using anti-crash system, you should probably optimize your game to make it less resource consuming.

  • Automatic Un-initializing

Basically, anytime you change your hero, all effects, texts, icons, and health pools local to the player's data will be removed.
Make sure you use the following variables as arrays for storing effects, hud texts, and more

| Variable | What to store |
| heroUI | text ids (hud texts, in-world texts, and progress bar texts) |
| effects | created entities (beams, effects, and icons) |
| healthPools | health pools ids |

The feature can do more, like automatically enabling all buttons when changing hero, turning off ability info and re-enabling it, and resetting player's health

  • Custom Roles

The gamemode has a rule specifically for configuring what roles exist, the color of their roles, and what heroes have what role.
There isn't that much to it, so uhhh yeah


Other Plans

These are features that aren't implimented into the game, but I plan to add.

  • In-game cooldowns

Basically 3 variables in-game that are automatic cooldowns. They will count down to zero, and all you have to do is display them

  • In-game ability charges

2 variables in-game that work as charges. You can configure their cooldowns and the maximum at a time. After that, all you have to do is display them

  • In-game ability resource

2 variables in-game that work as resources. You can configure their delay before recharging, and their resource recharge time. After that, all you have to do is display them

  • A custom set health feature.

You can set a player variable to an array of 3. The first value will be the health of the player, the second will be the shields of the player, and the 3rd will be the armor of the player.
Unfortunately, if the hero you want to change already has armor/shields, it is impossible to get rid of a tiny portion of them.

  • Custom Role Selection

A list of all roles that are in the game. You can choose which role you want to select, and you can also see how many slots of each role are available. Once you choose a role, you can only select heroes based on the role you chose.

You will be able to use workshop settings to change role settings, or disable them completely

  • Difficulty Chart

This one is more just plain fun, but you can rate the difficulty of a hero from 1 to 5 in stars. The average difficulty of all the players ratings in the server will be viewed in the hero info.


If you used my handler, thanks, and I hope it was useful, at least in the slightest.

And uhhhhhh, thanks for coming to my TED talk










Is this even a ted talk? What are we even talking about at this point?

Players | 1 - 10
Categories: Hero Adjustments, Tools
Heroes: D.va, Orisa, Reinhardt, Roadhog, Sigma, and 27 more...
Created at:
Last updated:
Current version: 1.0

Controls

Crouch + Reload
Toggle ability info
+
Toggle ability info
+
Toggle ability info
+
Toggle ability info
+
Toggle ability info

Snippet

Loading...

Users Also Like

Similar Codes

Elo Hell Logo_H-M-Dark
Join the Elo Hell Workshops Discord