• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Putting a limit to a unit

Status
Not open for further replies.
Level 4
Joined
Feb 25, 2010
Messages
73
Greetings. I would like some help with a trigger (or another way, if exists) that limits the number of certain unit that can be on the map.

Think like the same limit for the Mines from Goblin Techies in DoTA (there is possible have only 15 mines in the entire map, at same time). When you put a 16th mine, the older mine will be destroyed. This is exactly what i want to do.

Thanks :)
 
Level 2
Joined
Jun 20, 2011
Messages
19
The carrion beetles ability has a limit for summoned units. Perhaps you could tailor something out of that?
Feral Spirit also gets rid of the old wolves when new ones get summoned IIRC, but that would only work to cycle whatever comes out in a single cast of your ability.
Are we even talking a summoning spell here?
 
Level 4
Joined
Feb 25, 2010
Messages
73
Yeah, i will use this 'limit system' in a skill that put 'mini towers' over the map, but with a limit of only ONE at lvl 1. However, at lvl 2, you can put up to two towers at same time (however, a third tower will causes the older tower to be instantly destroyed)

However i didn't think about this skills. But, carrion beetles need corpses to be created right? There is a method to create the beetles (towers) without need the corpses?
 
Level 2
Joined
Jun 20, 2011
Messages
19
However i didn't think about this skills. But, carrion beetles need corpses to be created right? There is a method to create the beetles (towers) without need the corpses?
Try changing "targets allowed" from "Dead" to something else. Never really messed around with beetles myself, just a thought.

If this limit is unique to the map, or at most, per player, a few variable arrays might do the trick, but I'm a little too tired to write down details right now.

As a final idea, you might be able to fake it by making your tower units trainable/buildable by whoever has the ability to lay them, make it look like it's just another ability, and from there, capping training/construction should be simple enough...I think.
 
Level 4
Joined
Feb 25, 2010
Messages
73
Queue system ahn? I think it is what i need...
... But how exactly i can do it? Talk more about it, please. xD


Oh, about the Carrion Beetle skill, i tried using it but the skill checks the nearest target (that can be a corpse, tree, etc) and create a beetle. My custom skill must have a target, so the player can put the turret where he want
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Well in the case of an array queue. You allocate some array space to a unit for the spell representing the queue. When you add to the queue, you add to the next index which you then make wrap around if it exceedes the allocated array size (so if allocated array size was 10 and it stores in element 9, next is element 0). If number of elements is the same size as the array size, then you have queued up to capacity so remove the head of the queue and replace it with a new end element.

If a unit in the queue dies, you can then loop through the queue from the head backwards, and move foward all elements past the removed element. Not efficient but does not really need to be.
 
Status
Not open for further replies.
Top