• 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.

Max units deployed of certain types?

Status
Not open for further replies.
Level 3
Joined
Sep 29, 2012
Messages
18
Hello. This is for a melee map, and my idea is the following:

Let's say I'm playing the Human race, I've built the Barracks, so on. Now, I'm able to purchase Footmen, an unlimited amount basically, as much as my food limit allows me to.

Now, is there any way to set a limit to them? Let's say, I'm able to deploy a maximum of 15 Footmen per match, and after they die, I'm no longer able to buy any. What would I need to do in the World Editor to make this happen?

And, a similar question. Let's say I can only have 3 Siege Engines alive/deployed at a time during a match. Which means, I can't buy any more if I have 3, but if 1 of them dies, I'd be able to buy 1, after which I'll once again won't be able to buy any. Again, what would I need to do to make this happen?

Thanks in advance!
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Hello. This is for a melee map, and my idea is the following:

Let's say I'm playing the Human race, I've built the Barracks, so on. Now, I'm able to purchase Footmen, an unlimited amount basically, as much as my food limit allows me to.

Now, is there any way to set a limit to them? Let's say, I'm able to deploy a maximum of 15 Footmen per match, and after they die, I'm no longer able to buy any. What would I need to do in the World Editor to make this happen?

And, a similar question. Let's say I can only have 3 Siege Engines alive/deployed at a time during a match. Which means, I can't buy any more if I have 3, but if 1 of them dies, I'd be able to buy 1, after which I'll once again won't be able to buy any. Again, what would I need to do to make this happen?

Thanks in advance!

If you'd use training units instead of buying, then all you'd need would be 1 function.
  • Player - Limit training of Footman to 1 for Player 1 (Red)
If you still want to use buying, then you need to add/remove units to/from shop.
 
But if this map must retain as Melee, then it's impossible, although I agree with Xonox point. That is the thing you need :)

Also, reach 100 Posts at last :)

EDIT : One note, Xonox, I think the Trigger above apply even if you buy the units, since I ever us that trigger to Limit the amount of Custom Tavern Heroes I have in-game.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
But if this map must retain as Melee, then it's impossible, although I agree with Xonox point. That is the thing you need :)

Also, reach 100 Posts at last :)

EDIT : One note, Xonox, I think the Trigger above apply even if you buy the units, since I ever us that trigger to Limit the amount of Custom Tavern Heroes I have in-game.

Sadly not. Maybe it works for heroes, but definitely not for normal units. I've had a map where that caused problems.
 
If you'd use training units instead of buying, then all you'd need would be 1 function.
  • Player - Limit training of Footman to 1 for Player 1 (Red)
If you still want to use buying, then you need to add/remove units to/from shop.

Its a very good solution, still, if you want something more complicated such as, when 3 footmans dies allow +3 footmans again, you should

init:
int2[playernumber] =15
Player - Limit training of Footman to int2[playernumber] for [playernumber]

trig1:
event unit dies.
create unitgroup = footmans owned by player, set integer = number of units in unit group call remove unitgroup if integer less than 15 {player - limit training of footman to int2+ integer} set int2[playernumber]=int2[playernumber]+integer
 
Status
Not open for further replies.
Top