This code adds Tracer's Flash talent from Overwatch 2 to the current game. Flash was shown during Blizzcon. The talent reads "Blinking through enemies damages them".
- Dashing through someone will cause 100 damage.
- You can hit multiple enemies with a single dash.
- Due to the nature of how positions checks are done in the Workshop, dashing in to (but not through) someone will also damage them.
- There is a small delay on when you dash and when the damage is actually done. This is roughly 200ms.
You can spawn bots to test out the ability. Hold Crouch and Press Interact [F] to spawn a bot. You can spawn a maximum of 6 bots and they don't respawn. This is just for testing purposes, so feel free to adjust this if necessary.
The code won't work in Deathmatch, but it will work in all Team modes. As it is right now it's mostly just meant to play around with the new talents. I plan on adjusting it some more so it could be adding to your own gamesmodes.
For anyone wondering how this is done;
- When dashing your starting position is recorded.
- When you dash is complete your ending position is recorded.
- The difference between these two values is calculated by subtracting the starting position from the ending position.
- Between these two points we draw different spheres. The position of the spheres is determined by the difference between the start and end, and divided by the amount of spheres we want to draw.
- For each sphere we check if there's players inside and add these to an array.
- It's possible players are in more than 1 sphere. We loop over the array we created and place the players in a new array. If they already exist in this array, we skip them. Essenstially creating a new array without duplicated.
- These players are then damaged.