Don't mean to spam. I made a thread like this a few days ago but I'm still sorta stuck on this same issue.
Lemme start by explaining exactly what I'm doing. I have this hero I am working on and one of their abilities is to spawn a unit. This isn't a real unit in the sense that it moves and attacks like you'd think, but its a dummy unit simply their for its behavior/art. Naturally, I made it invulnerable, non selectable, etc...
What it does is it sits idle and its behavior periodically searches a small radius around it and applies behaviors to nearby units. Its basically like a trap that spreads behaviors to units that get to close.
I'm trying to design this so only one can exist at a time however unless another is created it will be there forever. The problem is I have no idea how to kill the first unit when the hero is spawning a new one. Been stuck on this for a few days. Searching the threads for info on killing units in this manner. Im at this point I'm even willing to use a trigger as a solution. Any help would be much appreciated.
On spawning the unit, use a search area effect and look for the same unit type (dunno exactly how to check that, never did that. Most likely possible, though, probably a validator or target sort).
Exclude self and make it affect only player units, radius would be the whole map. Then kill the picked unit. Voila ;)
You could also look at the mothership requirement and allow the ability only in case the other unit is gone (if it has a timed llife or something)
I havent really tried this, but maybe you can replace that unit and behavior through a persistent effect that does the same thing (it appears you're using the unit behavior combo as a persistent effect anyway).
If i remember right, theres an effect type "destroy persistent". Havent ever tried it out, but check its fields and try to kill previous persistents with that effect, and then spawn a new one.
Don't mean to spam. I made a thread like this a few days ago but I'm still sorta stuck on this same issue.
Lemme start by explaining exactly what I'm doing. I have this hero I am working on and one of their abilities is to spawn a unit. This isn't a real unit in the sense that it moves and attacks like you'd think, but its a dummy unit simply their for its behavior/art. Naturally, I made it invulnerable, non selectable, etc... What it does is it sits idle and its behavior periodically searches a small radius around it and applies behaviors to nearby units. Its basically like a trap that spreads behaviors to units that get to close.
I'm trying to design this so only one can exist at a time however unless another is created it will be there forever. The problem is I have no idea how to kill the first unit when the hero is spawning a new one. Been stuck on this for a few days. Searching the threads for info on killing units in this manner. Im at this point I'm even willing to use a trigger as a solution. Any help would be much appreciated.
On spawning the unit, use a search area effect and look for the same unit type (dunno exactly how to check that, never did that. Most likely possible, though, probably a validator or target sort).
Exclude self and make it affect only player units, radius would be the whole map. Then kill the picked unit. Voila ;)
You could also look at the mothership requirement and allow the ability only in case the other unit is gone (if it has a timed llife or something)
@Kueken531: Go
how exactly would you go about killing the unit that is found with the search effect.
@Writhes: Go
Search effect with massive area > apply effect (damage) > amount 9000, requirement: invulnerable
@PirateArcade | I make games | Ask me things on Discord
I havent really tried this, but maybe you can replace that unit and behavior through a persistent effect that does the same thing (it appears you're using the unit behavior combo as a persistent effect anyway).
If i remember right, theres an effect type "destroy persistent". Havent ever tried it out, but check its fields and try to kill previous persistents with that effect, and then spawn a new one.
Another thing is to use triggers.
Thanks a lot for the replies. I feel pretty confident I can put the problem to rest now. Again thank you for responding.