Warcraft III resources & community, 2003–2006 · archived

Need help with Summoned unit limit

9 posts
#1

Need help with Summoned unit limit

I'm creating a custom spell based on the standard spell black arrow. If the spell is successful, one summon spawns, and the spawn is permanent (untimed). I want to limit the number of spawns that can be in the game at any time to 4. I have not been able to find a way to trigger it properly to make it work. Can someone help me out? It should be simple but I can't seem to get it to work.
#2
Err... how about something based off carrion beetles?
#3
it has to be based on black arrow.

The skill is a combination nuke/summoning spell, so it must both do damage and create units. That constraint effectively eliminates carrion beetles, water elemental, feral spirit, etc.

Surely theres a way to trigger this. I refuse to beleive its not possible. I just don't have the expertise to do it yet, which is why I need you guys to help me out.

I'm sure someone who is really good at this kinda thing could whip something out in 10 minutes or less. I've been working on it for days and haven't been able to get it to work.
#4
Have you tried removing the sumoned buff and setting it to 0? 0 means infinite.
#5
if you are talking about making the summons permanent, then yes, I have already done that.

The part I am struggling with is the summoned unit cap. I need something that accomplishes the following, but I can't seem to translate it into triggers and make it work.

Unit begins casting an Ability
Ability is equal to Name
If
units of unit-type equal to UnitName = 4 (value)
Then
remove last-created unit from the game
else
do nothing

Basically, what this is supposed to be doing is checking whether there are already four units of the summoned unit-type in the game, and if so, summoning a fifth and killing it, effectively capping the total summons at four until one dies.

Unfortunately, I haven't figured out how to translate that simple idea into a trigger that works.
#6
Im not exactly sure how black arrow works, but try using the event Unit is spawned.
#7
The way I'm thinking right now (unless it has to be multi instanceable) is have an integer to keep track of the units you kill with this nuke.

Wheenver you make a unit with this spell, add 1.
Whenever one of your summons dies, take away 1.

I'm just not sure if black arrow counts as you spawning a unit, if it does, easy.

A unit spawns a unit

Cond.

Summoning unit = Your hero
Summoned unit = skelly

actions

if/then/else multiple
if spawncount (integer) >= 4
then
remove summoned unit
else
set spawncount = spawncount + 1
Unit - replace summoned unit with MyNewCoolUnit


and

A unit dies

type of dying unit = MyNewCoolUnit

set spawncount = spawncount - 1
#8
Or use what Nitro said, but before they spawn, you check with an integer condition to see number of units of type skelly owned by player
#9
Event:A Unit is Spawned
Conditions:Triggering unit=(Your Summon)
Actions:Pick all units of type (Your Summons) and add them to Unit_Group(unit group var)
If Number of Units in Unit_Group is greater then 4, then remove random unit in Unit_Group matching
Matching Unit is not equal to Triggering Unit

Works like carrion beetles