I've got the event "Any unit enters a distance of (real) from (unit)" multiple times with different (units) in the same trigger. Now, the "any unit" is the one I get calling "Triggering Unit", but is there a way to find out which (unit) is the one where the triggering unit got near to?
There I want to know whether the trigger was triggered because a unit came in range of Pool 1 oder Pool 2.
My current "workaround" would be to create a trigger for each pool, but those triggers would all contain the same code with the exception of Pool 1 being Pool 2 or 3 etc. And if I change one thing, I have to update all the others... so how would I do this?
This was the first thing that came to mind that could work for you.
Local Variables
Pool = No Unit <Unit>
Actions
Variable - Set Pool = (Closest unit to (Position of (Triggering unit)) in (*Unit Type of the Pools* units in (Entire map) owned by player Any Player matching No Unit Filter, with at most Any Amount))
Then your variable "Pool" would be the nearest pool to your triggering unit, presumably the one involved in getting the trigger to fire.
Is there a way to do "Any unit enters a distance of (real) from (unit of type x)" instead of taking a specific unit and copy-paste the event for each unit of that type?
Well, late reply, but I just got back to that project.
Thanks BeLugh, somehow "acquired target" does exactly what I want (no way I would have found that out by myself, the variable description tells something whole different and it's even greyed out in the list).
But the other problem still exists: I still must put each variable under Events (the Pool 1, 2, ... in this case), instead of just putting a unit group or unit type there :( This is a big problem, because some of the units where I want to check the event are created during the game and are not editor-placed ones so I can't even select them in the event unit list.
Sounds too simple, but looks impossible somehow. :(
I've got the event "Any unit enters a distance of (real) from (unit)" multiple times with different (units) in the same trigger. Now, the "any unit" is the one I get calling "Triggering Unit", but is there a way to find out which (unit) is the one where the triggering unit got near to?
There I want to know whether the trigger was triggered because a unit came in range of Pool 1 oder Pool 2.
My current "workaround" would be to create a trigger for each pool, but those triggers would all contain the same code with the exception of Pool 1 being Pool 2 or 3 etc. And if I change one thing, I have to update all the others... so how would I do this?
This was the first thing that came to mind that could work for you.
Local Variables
Pool = No Unit <Unit>
Actions
Variable - Set Pool = (Closest unit to (Position of (Triggering unit)) in (*Unit Type of the Pools* units in (Entire map) owned by player Any Player matching No Unit Filter, with at most Any Amount))
Then your variable "Pool" would be the nearest pool to your triggering unit, presumably the one involved in getting the trigger to fire.
Thanks, that was exactly what I was looking for!
Is there a way to do "Any unit enters a distance of (real) from (unit of type x)" instead of taking a specific unit and copy-paste the event for each unit of that type?
Any ideas?
Yes, make a variable with unit type as well and define it's default as the one you want.
But "Any unit enters a distance of (real) from (unit)" needs a specific unit variable and doesn't like "unit type" variables. :(
if "pool" is a unit then use "acquired target" for the pool unit, the entering unit is "triggering unit"
Well, late reply, but I just got back to that project.
Thanks BeLugh, somehow "acquired target" does exactly what I want (no way I would have found that out by myself, the variable description tells something whole different and it's even greyed out in the list). But the other problem still exists: I still must put each variable under Events (the Pool 1, 2, ... in this case), instead of just putting a unit group or unit type there :( This is a big problem, because some of the units where I want to check the event are created during the game and are not editor-placed ones so I can't even select them in the event unit list.
Sounds too simple, but looks impossible somehow. :(
Really not possible?