HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

"Hero" units

04-23-2007, 12:11 PM#1
AqoTrooper
I want to make units that have a limit to the amount of them you can have, similar to how you can only have one hero of each type at a time. How could this be done?
I could add a trigger to remove a newly bought unit once it's created if there is already one, but I want a more elegant way, that'd change the interface and grey-out the unit once you have it (or an x amount of it).
04-23-2007, 01:09 PM#2
Zwan
If they are being purchased from shops you can simply remove them from the shop add a dummy item to the shop with a stock of 0. You can use a disabled version of the unit icon for the dummy item and it will appear greyed out.

Alternatively you could just make the dummy item's stock start delay max so it never cools down.
04-23-2007, 05:08 PM#3
PsychoPif
Since this was on my list of thing to do in my map, I'll add more to your question if you don't mind Ago :)

Since it's a two team map, with five player per team, how can you prevent one player from buying anymore of the unit while the other 4 still can ?
04-23-2007, 05:29 PM#4
Conquestor
Quote:
Originally Posted by AqoTrooper
I want to make units that have a limit to the amount of them you can have, similar to how you can only have one hero of each type at a time. How could this be done?
I could add a trigger to remove a newly bought unit once it's created if there is already one, but I want a more elegant way, that'd change the interface and grey-out the unit once you have it (or an x amount of it).


Trigger:
Melee Initialization
Collapse Events
Map initialization
Conditions
Collapse Actions
Player - Limit training of Footman to 3 for Player 1 (Red)
The option to buy the unit will not even appear in the barracks, if you have 3 footmen built. As soon as 1 dies, it will appear again.

If you want it to be greyed out, just check how many are out, everytime a unit is built, and then remove an upgrade that the unit requires.

Quote:
Since this was on my list of thing to do in my map, I'll add more to your question if you don't mind Ago :)

Since it's a two team map, with five player per team, how can you prevent one player from buying anymore of the unit while the other 4 still can ?

The same action will work fine, for this.

I don't think there is a way to do it withought triggers, so this should probably be moved to the trigger section.
04-23-2007, 07:10 PM#5
AqoTrooper
Thanks a lot Conquestor, exactly the info' I needed.