You can use a local variable to store TempUnit and/or DamageEventTarget. This way they cannot be overwritten.
However to use locals, you need custom scripts.
You can declare locals at the beginning of the trigger like this:
-
Custom script: local unit u = udg_TempUnit
"u" is the name of the local variable and you set it's value to TempUnit.
However accessing local variables in GUI triggers is not possible, so you cannot do:
Set Life of u to 100%
To avoid this problem, you create a new variable called LocalUnit or something.
Then you can use:
-
Custom script: local unit udg_LocalUnit = udg_TempUnit
Now LocalUnit is both a local and a normal (global) variable. But in this trigger you will always refer to the local variable. So you use
Set Life of LocalUnit to 100%
and it will change the life of the unit that is described by the local variable.
In total you should have:
A unit variable called "LocalUnit"
At the beginning of your trigger use:
-
Custom script: local unit udg_LocalUnit = udg_TempUnit
Instead of changing life of "DamageEventTarget", use "LocalUnit".
After that you should null the local variable to prevent a leak:
-
Custom script: set udg_LocalUnit = null