Well instead you could be more specific like instead of any unit it could be variable_Unit dies or unit with unit type dies. Then you can create a unit with same unit type or something.
If you are trying to make the spawned zergling to be owned by the same player with the dead unit you can say owner of triggering unit.
Well i'm trying to set it up as a respawn trigger - so when zergling 1 dies a zergling spawns at point 1, and when zergling 2 dies a zergling spawns at point 2 - etc.
It doesn't need to remember the team because the zerglings will always belong to hostile.
Oh. Well make a unit variable and set zergling 1 to that variable. Then the event will be when Unit dies (Unit_Variable). Spawn This unit, Set Unit_variable to last created unit.
If you use variables in events you have to remember that events WONT change when the variable changes.
When Variable[Any Unit] is null initially and then during game gets changed to Zergling #1, then the trigger won't fire when Zergling #1 dies.
So it's better to do:
You can link a integer value through the trigger "Unit - Set Custom Value of Unit".
So you could make a point array with your Point1, Point2, etc.
Then set the custom value of each Zergling to the array index of the point they're supposed to respawn.
Then use:
For anyone wanting to use this for future reference - you have to use convert real to integer for custom value of unit as an index in addition to what he said because apparently custom values are real numbers instead of integers
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi, Im looking for a way to get an index number from an event with a variable further down the road in an action. For Example:
Events:
Unit -Unit Variable[Any Unit] Dies
Actions:
Spawn 01 Zergling at Point Variable[Same index number as the event variable] facing Default Degrees
What do I put as the index so the trigger can remember the index number I used in the action? Does that make sense?
Well instead you could be more specific like instead of any unit it could be variable_Unit dies or unit with unit type dies. Then you can create a unit with same unit type or something.
If you are trying to make the spawned zergling to be owned by the same player with the dead unit you can say owner of triggering unit.
@Tradnan: Go
Well i'm trying to set it up as a respawn trigger - so when zergling 1 dies a zergling spawns at point 1, and when zergling 2 dies a zergling spawns at point 2 - etc. It doesn't need to remember the team because the zerglings will always belong to hostile.
@Redwulf85048: Go
Oh. Well make a unit variable and set zergling 1 to that variable. Then the event will be when Unit dies (Unit_Variable). Spawn This unit, Set Unit_variable to last created unit.
Will that work?
If you use variables in events you have to remember that events WONT change when the variable changes.
When Variable[Any Unit] is null initially and then during game gets changed to Zergling #1, then the trigger won't fire when Zergling #1 dies.
So it's better to do:
You can link a integer value through the trigger "Unit - Set Custom Value of Unit".
So you could make a point array with your Point1, Point2, etc.
Then set the custom value of each Zergling to the array index of the point they're supposed to respawn.
Then use:
@s3rius: Go
Thanks - that worked perfectly!
For anyone wanting to use this for future reference - you have to use convert real to integer for custom value of unit as an index in addition to what he said because apparently custom values are real numbers instead of integers