The spell is still MUI, SUMI even (that's what the local trick is for).
Edit:
tarnos12 said:
you named skill channel, not sure if its just random name but my skill is not channeling skill
It's not a random name: "Channel" (neutral hero skill) is the best ability to base triggered spells on.
Its name may be misleading, because it can be anything (unit-target, point-target, instant cast), doesn't have to be a channeled spell.
endedit
tarnos12 said:
Also I dont understand:
-
Custom script: local location udg_TempLoc1
That's basically how the local trick works. I'll try to explain it (I thought I explained this somewhere else, but I can't find it anymore).
Warning: lots of text.
For this, you need to know the difference between local and global variables.
You are already familiar with
global variables. They're called "global" because you can use them in any trigger you want.
The problem with globals is that they can be overwritten.
Take this trigger for example:
-
Instakill
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
(Ability being cast) Equal to Instakill
-
Actions
-
Set TempUnit = (Target unit of ability being cast)
-
Wait 2.00 seconds
-
Unit - Kill TempUnit
If the spell "Instakill" is cast more than once within 2 seconds, then "TempUnit" will be overwritten and the spell will only work for the last instance.
But you can't use "Target unit of ability being cast" after a wait, because that will also fail.
So how do you solve this without the trigger becoming too complicated?
Locals.
Local variables are pretty much JASS-only.
They exist
only in the trigger they're created in, and if the trigger is done, so is the local variable.
Local variables cannot be overwritten: every instance of the trigger will create a new local variable with another value.
Consider the same spell, but then with local variables:
-
Instakill
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
(Ability being cast) Equal to Instakill
-
Actions
-
Custom script: local unit udg_TempUnit
-
Set TempUnit = (Target unit of ability being cast)
-
Wait 2.00 seconds
-
Unit - Kill TempUnit
It's only 1 line longer, yet it performs beautifully.
You can spam this skill all you like, it will kill every unit 2 seconds after it was cast on him.
There's only 1 minor problem with this: the local variable may be gone, but the value inside it still exists.
When a value exists and cannot get accessed anymore, it's a memory leak.
So with local variables you have an extra memory leak you need to take care of, this is done by setting the value to "null" (this means "no value").
Here's how it looks:
-
Custom script: set udg_TempUnit = null
Add that to the previous trigger and it's complete.
Note: setting the variable to null must be done
after cleaning the major leak first.
This is how it should look for a location:
-
Custom script: call RemoveLocation( udg_TempLoc )
-
Custom script: set udg_TempLoc = null
What exactly do you need to know?
1) Global Variables are (by default) named "udg_" + VAR_NAME. So when you create a new variable in the variable editor called "TempLoc", the
actual name is "udg_TempLoc".
2) Local variables create an extra leak (this does not count for integers, reals and booleans).
This can be solved by setting the local to null at the end of the trigger,
after cleaning the first leak.