Last created entity in player variable?

I’m trying to give a character a new ult. The idea is that upon activation, an effect spawns in at the players location, and for 10 seconds any teammates within a radius of the effect with be healed, then the effect gets destroyed. I’m trying to put the effect into a player variable. The current script for the healing portion of it is

“Ongoing - Each Player : All : Sombra”
Conditions:
Players Within Radius(Player Variable(Event Player, F), 10, Team Of(Event Player), Surfaces and Enemy Barriers) == True
Actions:
Wait(0.5, Abort If False)
Heal(Players Within Radius(Player Variable(Event Player, F), 10, Team Of(Event Player), Surfaces and Enemy Barriers), Event Player, 10)
Loop

However, this doesn’t actually work, and the effect also doesn’t get destroyed after 10 seconds in a separate script, so I was wondering if you actually can use a player variable to represent an effect or if i’m doing something wrong.

  1. You cannot use an effect / entity as a position. You must use the actual vector or “Position Of” ( which only works for player positions ) to get the position.

  2. To create an effect and save it as a variable, do this:

Create effect( all players( all teams), sphere, white, event player, 2, visible to position and radius )
Set Player Variable( Event Player, Y, Last Created Entity )

Create Effect ( … blah blah blah … )
Set Player Variable at Index( Event Player, Z, 1, Last Created Entity )

In the two lines of code, you will see that I created an effect and defined it as the Event Player’s “Y” variable. That means if I want to destroy that effect, I must do it for that specific player’s player variable “Y”.

In the second line of code, I added the effect to a new array, called player variable “Z”, and I set it to the Index 1. That means, if I want to destroy that one, I have to destroy the value at the index 1.

See below for examples of both.

Destroy Effect( Player Variable( Event Player, Y ) )
Destroy Effect( Value in Array( Player Variable( Event Player, Z ) , 1 ) )

YouTube Example: Making Rein a Paladin

https://youtu.be/ozQGQdTow6A

Edit: By the way, you can use

[code] 
code blocks for a
block of
text like this
[/code]

`` or these things for a single line ``

To make things clear, “Last created entity” and “Last text ID” are actually not pointers towards the object of the effects/texts. They are just IDs, only used by the destroy effect(), destroy HUD text() and destroy inworld text() actions.

So, like AnEnemyChamp wrote, you want to store the poisition of the effect in a player variable to use it in the players within radius() condition and the ID of the effect (last created entity) in another player variable to use it in the destroy action.