If you dont have alot of these units "that make drones" say only one per player you could easily create a unit group and add the spawned "summoned" units to it with a trigger. Then when the "summoner" ( the unit that spawns drones) dies you can just kill all the units in that unit group for a specific player.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
There are several ways to do this. I can't know the specifics of what your drone is used for so here are just some suggestions.
1. Instead of using the create unit use the Arm Magazine ability (basically the same ability Carriers use) this insures that when your caster unit dies the drone will die as well. However it does come with limitations and if you need that drone to function like a normal drone or act as a completely independent unit then arm magazine will not work well with your needs.
2. you should be able to do this via triggers as well. I'm not sure there is another way via data, but you can make sure that whenever you create a drone it attachs a behavior to the drone (for identification purposes) and then on the death of your caster unit use a pick each unit in unit group and do actions. Then follow it up with an if then that matches the picked units against a true false if they have the behavior and kill the ones that do. Since images are worth a million words Ill post images of both triggers so u have an idea of what to do
3. do what SouLCarveRR suggested it's almost what Ive suggested but a little easier because you don't need a dummy behavior
I decided to make a demonstration map to make it simpler to explain. Not that it's very complicated, but it's always good to have an example.
I made two abilities, DronePuppet and ZerglingPuppet. DronePuppet is an instant cast ability which creates a drone next to the caster, while ZerglingPuppet is a unit targeted ability which creates a zergling next to a target unit.
They both link to a create unit effect which creates the unit. These effects will then start the effect Generic - ApplyCasterPuppetLink. The reason I called the prefix Generic is because the effect is reusable for any Create Unit effect you make to make the units die when the caster dies.
When a Create Unit effect starts another effect, the following effect will have the target set to the unit being created instead of the unit you cast the effect on. This even works with unit targeted abilities like ZerglingPuppet. This is fortunate for us, as without this link it would have become slightly more complicated to make this link between caster and puppet.\
Consequently a behavior is applied to target (the unit being created), and the behavior will periodically call a damage effect which will attempt to kill the target (still created unit). I made a validator that checks if the caster is dead and applied it to the damage effect. This is what kills the unit when the caster dies.
I'd do exactly what Bob did too :) the core effect 'suicide' is your friend for killing a unit. I think the liberty validator 'caster not dead' is also what you're looking for (if you dont want to make new effects/validators.)
Hi. If i have a ability that make a drone. And the unit that made the drones dies. Can i somehow make the the drone die also?
So if the caster unit dies all the units made by him also dies?
@kongkim82: Go
there are possible ways to do this.
If you dont have alot of these units "that make drones" say only one per player you could easily create a unit group and add the spawned "summoned" units to it with a trigger. Then when the "summoner" ( the unit that spawns drones) dies you can just kill all the units in that unit group for a specific player.
There are several ways to do this. I can't know the specifics of what your drone is used for so here are just some suggestions.
1. Instead of using the create unit use the Arm Magazine ability (basically the same ability Carriers use) this insures that when your caster unit dies the drone will die as well. However it does come with limitations and if you need that drone to function like a normal drone or act as a completely independent unit then arm magazine will not work well with your needs.
2. you should be able to do this via triggers as well. I'm not sure there is another way via data, but you can make sure that whenever you create a drone it attachs a behavior to the drone (for identification purposes) and then on the death of your caster unit use a pick each unit in unit group and do actions. Then follow it up with an if then that matches the picked units against a true false if they have the behavior and kill the ones that do. Since images are worth a million words Ill post images of both triggers so u have an idea of what to do
3. do what SouLCarveRR suggested it's almost what Ive suggested but a little easier because you don't need a dummy behavior
Thx for the ideas it can be used :)
But aint there a way to do it from the Data Editor? Link the units together somehow?
@kongkim82: Go
Yes there is. I can write up how to do it a bit later. Right now I don't have enough time. Check back here in an hour or two
@Builder_Bob: Go
Ok. sounds really good :)
@kongkim82: Go
I decided to make a demonstration map to make it simpler to explain. Not that it's very complicated, but it's always good to have an example.
I made two abilities, DronePuppet and ZerglingPuppet. DronePuppet is an instant cast ability which creates a drone next to the caster, while ZerglingPuppet is a unit targeted ability which creates a zergling next to a target unit.
They both link to a create unit effect which creates the unit. These effects will then start the effect Generic - ApplyCasterPuppetLink. The reason I called the prefix Generic is because the effect is reusable for any Create Unit effect you make to make the units die when the caster dies.
When a Create Unit effect starts another effect, the following effect will have the target set to the unit being created instead of the unit you cast the effect on. This even works with unit targeted abilities like ZerglingPuppet. This is fortunate for us, as without this link it would have become slightly more complicated to make this link between caster and puppet.\ Consequently a behavior is applied to target (the unit being created), and the behavior will periodically call a damage effect which will attempt to kill the target (still created unit). I made a validator that checks if the caster is dead and applied it to the damage effect. This is what kills the unit when the caster dies.
Very nice.
I'd do exactly what Bob did too :) the core effect 'suicide' is your friend for killing a unit. I think the liberty validator 'caster not dead' is also what you're looking for (if you dont want to make new effects/validators.)
Now im a littel slow here :P
But thx alot it all works now :)