1) I assume triggers run in their own threads? I mean, there is obviously concurrency, but I don't think SC2 has its own time slicing?
2) Is there a way to avoid Last Created [X] when assigning the return value of a function?
If for example I have two triggers that create units, trigger A creates them periodically and trigger B creates them when a player gets a unit to a certain region, it could happen that when trigger B just created a unit, but before executing the rest of the trigger, trigger B could be using the unit created by trigger A instead of its own.
And no, variables are no help cause they have the exact same problem.
Last created unit refers to the most recent unit created BY THAT TRIGGER. I had the same question as you and I believe triggers run separate. So you could have 1 trigger running twice at the same time for 2 different players and it wont mess up. But if your trigger assigns a value to a global variable, THEN another trigger setting that same variable to something else might mess things up.
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
1) I assume triggers run in their own threads? I mean, there is obviously concurrency, but I don't think SC2 has its own time slicing?
2) Is there a way to avoid Last Created [X] when assigning the return value of a function? If for example I have two triggers that create units, trigger A creates them periodically and trigger B creates them when a player gets a unit to a certain region, it could happen that when trigger B just created a unit, but before executing the rest of the trigger, trigger B could be using the unit created by trigger A instead of its own. And no, variables are no help cause they have the exact same problem.
Last created unit refers to the most recent unit created BY THAT TRIGGER. I had the same question as you and I believe triggers run separate. So you could have 1 trigger running twice at the same time for 2 different players and it wont mess up. But if your trigger assigns a value to a global variable, THEN another trigger setting that same variable to something else might mess things up.
Ah, thanks Then I guess there's no need to worry.