How do I create an ability that creates one unit, which the caster can only have 3 of at max, and if he summons the 4th, the 1st one summoned will die.
Also each unit has a 30 second duration, which will kill them when the duration expires. Any suggestions on how to do this?
(the ability part is not a problem, it's only the actual "kill the oldest if more than 3 units"-part)
If this is a one-per-player hero unit just search the entire map for units of the summoned type owned by the player or something.
If there can be multiple summoners try using the Effect - Spawn field on the Create Unit effect to apply a stacking buff to the caster. Then use one of the Effect fields on this buff to kill the summoned unit. Not sure how the scope is set, I would hope Caster targets the summoner and Create Unit: Target targets the summoned unit. I know it's possible to kill a summoned minion this way, identifying the oldest might be tricky.
I don't know if the Refresh Effect calls the latest instance of the Behavior or the oldest, if it's the latter you could use that directly. In the worst case you need a unique buff for each summoned unit and a Set+Validators combo to "count" minions, which should still be doable for a maximum of 3 summons.
If you want your minions to survive even if the summoner dies stick a CasterNotDead validator on the Kill effects and/or stay away from the Effect - Final field.
If behaviour buff stacks retain their source unit you could use them to track summons with an on remove effect that kills the summon and stack count 3.
If the summoned units don't use energy, you can use the energy as a timer - set their energy regeneration rate to -1 per second.
You then have, on Summoned Unit Birth, a Search Area Effect run that looks for units of that type.
This Search Area has an Enumerate Area Validator for the Target checking for units that fulfil another two Validators - Same unit type, and Target (of Enumerate Area) has less Energy than the Target of the Search Area Effect. Enumerate Area is set for the entire map.
The Enumerate Area Validator is set to negative, so it's validating that there are no units of the same type with less energy on the map. If this is true, that means that that target of the Search Area Effect is the oldest (lowest energy) unit of that type on the map. It then applies an effect killing it.
You can also use Veterancy, Behavior Count or maybe even a unit field instead of Energy.
I'm not very good with the whole Caster/Target/Source stuff so I'm not sure what value to set for what and for what effect, but I think this'd be possible.
I would just have each summon applies a buff to the summoned units and when summoning a new one the monster with the most stacks gets killed.
Use the Create Unit effect to apply a set effect that applies two buffs to the caster. One applies a buff to the target of the effect the other is a low duration buff used for counting. The buff on the summon used the effect that applied the buff to validate the casting unit if it has a case of the having summoned buff. The buff on the summon then adds a counter that when it hits a certain number activates itself and suicides.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
How do I create an ability that creates one unit, which the caster can only have 3 of at max, and if he summons the 4th, the 1st one summoned will die.
Also each unit has a 30 second duration, which will kill them when the duration expires. Any suggestions on how to do this?
(the ability part is not a problem, it's only the actual "kill the oldest if more than 3 units"-part)
If this is a one-per-player hero unit just search the entire map for units of the summoned type owned by the player or something.
If there can be multiple summoners try using the Effect - Spawn field on the Create Unit effect to apply a stacking buff to the caster. Then use one of the Effect fields on this buff to kill the summoned unit. Not sure how the scope is set, I would hope Caster targets the summoner and Create Unit: Target targets the summoned unit. I know it's possible to kill a summoned minion this way, identifying the oldest might be tricky.
I don't know if the Refresh Effect calls the latest instance of the Behavior or the oldest, if it's the latter you could use that directly. In the worst case you need a unique buff for each summoned unit and a Set+Validators combo to "count" minions, which should still be doable for a maximum of 3 summons.
If you want your minions to survive even if the summoner dies stick a CasterNotDead validator on the Kill effects and/or stay away from the Effect - Final field.
If behaviour buff stacks retain their source unit you could use them to track summons with an on remove effect that kills the summon and stack count 3.
@Demtrod: Go
Uhh... ok ok. This is messy.
If the summoned units don't use energy, you can use the energy as a timer - set their energy regeneration rate to -1 per second.
You then have, on Summoned Unit Birth, a Search Area Effect run that looks for units of that type.
This Search Area has an Enumerate Area Validator for the Target checking for units that fulfil another two Validators - Same unit type, and Target (of Enumerate Area) has less Energy than the Target of the Search Area Effect. Enumerate Area is set for the entire map.
The Enumerate Area Validator is set to negative, so it's validating that there are no units of the same type with less energy on the map. If this is true, that means that that target of the Search Area Effect is the oldest (lowest energy) unit of that type on the map. It then applies an effect killing it.
You can also use Veterancy, Behavior Count or maybe even a unit field instead of Energy.
I'm not very good with the whole Caster/Target/Source stuff so I'm not sure what value to set for what and for what effect, but I think this'd be possible.
I would just have each summon applies a buff to the summoned units and when summoning a new one the monster with the most stacks gets killed.
Use the Create Unit effect to apply a set effect that applies two buffs to the caster. One applies a buff to the target of the effect the other is a low duration buff used for counting. The buff on the summon used the effect that applied the buff to validate the casting unit if it has a case of the having summoned buff. The buff on the summon then adds a counter that when it hits a certain number activates itself and suicides.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
@DrSuperEvil: Go
Ah- that's pretty smart :) Thanks, will test it out when I've got the time :)