• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Making mercenaries available/unavailable

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,516
So there's an Action for Limiting the training of units, but it doesn't work for sold units.

A possible solution: Create localized Mercenary buildings for each player while hiding them from others. This way each player will have their own version of the Mercenary building stacked on top of one another, giving the illusion that they're all the same building. This Mercenary building won't actually Sell Units, and will instead Train them like a Barracks would. What you do is catch when the building begins training a unit (Event: A unit begins training a unit) and immediately cancel the training process. Then create the Trained unit-type for the owner of the Building at it's position. Finally, limit the training of this unit to 0 for EACH player. From there you simply Limit the training back to 1 for each player once the card is drawn again.
 
Level 5
Joined
Oct 16, 2007
Messages
67
As alternative solution.
Add the Sell Units ability. Now you can use Neutral Building - Add Unit-Type (To Marketplace). Then you can use a second trigger that runs if a unit is bought and removes it from that.
However, if you want the charges (Sell amount) to stack you will need to use variables and manage that yourself (example: Card drawn more then once).
 
Level 26
Joined
Dec 3, 2018
Messages
871
Erm... I've tryed Lartin's version, the trigger loooks like this and it doesn t work. What on earth am I doing wrong pls tell me
Yes the units appear
 

Attachments

  • Aaaa.png
    Aaaa.png
    24.9 KB · Views: 17
Status
Not open for further replies.
Top