When does Get(TriggerVariables) stop working?

Status
Not open for further replies.
Basically they are replaceable. If you have a trigger event for a generic unit death, and kill another unit within that trigger or between a wait period, the killing unit/dying unit basically get assigned to the new dying unit, which is why it's almost never a good idea to call those functions more than once. They should be stored into local variables or arrays so they can become untouchable.
 
I assumed that much. But since the variable will continue through a thread so long as it's not reassigned, how far will it go? It obviously won't carry into the calls I mentioned, so what calls determine where it will go?

If I do:

function blah takes nothing returns nothing
call blah2()
endfunction

function blah2 takes nothing returns nothing
call SomeNativeFunction(somevariable, somedata, function blah3)
endfunction

function blah3 takes nothing returns nothing
local unit t = GetTriggerUnit()
call KillUnit(t)
endfunction

I assume t will not be killed. Probably because if you're using a native function that calls a boolexpr the triggering variables will not be carried to it.

Am I correct? And what other functions or calls should I watch out for with this?
 
They stop (are removed) at the end of the thread.

The calls you mentioned generate new threads (or atleast new stacks). Thus why they do no longer exist.

For example you can carry them from trigger to trigger via chaining triggers (I remember someone doing this with GUI) together with the native that runs triggers. You can not however recall them after a timer cause that creates a new chain of execution and stack.

This is cause they are actually locals in a way, thus they last as long as the chain of execution does.
 
Status
Not open for further replies.
Back
Top