• 🏆 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!

how to limit buying a unit type to 1 ?

Status
Not open for further replies.
Level 6
Joined
Jan 4, 2014
Messages
227
Good day ! my question is how to limit buying a unit type to 1 from a marketplace while other players must still be able to buy that unit, how can this be done ??

i tried disabling training of that unit type for the buying player but it does not work, any other solution is welcome :)

Thanks :)
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
There is a trigger action "Player - Limit training of (unit) to (integer) for (player)"
Make a loop that loops through all players and limit the training of your unit to 1.
I think that it also works on marketplaces but I am not sure.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I guess that the neutral building - limit unit sold is for all players... could try that one too but I am not very confident about it.

If that doesn't work, then you should do something like this:
Event:
- Player 1 picks a unit.
- Player 2 picks a unit.
- Player 3 picks a unit.
- etc.

Conditions:
- Unit type equal to mercenary camp.

Actions:
- If triggering player has unit of unit type (unit)
- Then remove unit from mercenary camp.
- Else add unit to mercenary camp.

That should do it... Hopefully
 
Level 6
Joined
Jan 4, 2014
Messages
227
Thanks guys :)
for the moment i'm using 1 lumber to buy that unit, because there is no wood in my map, but the @chaosy solution is much more better, i'm gonna try it.
 
Level 6
Joined
Jan 4, 2014
Messages
227
Exept that there is no "proper" way to get the money cost of a unit.

in my situation there is only one unit which is easy.
in case you have lot of unit i suggest creating that unit for a neutral player and cast transmute on it with a dummy caster, and see how much money you have which is the price of the unit in gold, and then reset the neutral player gold to 0.
 
Level 6
Joined
Jan 4, 2014
Messages
227
I would make abilities based on "Some-neutral-spell-that-has-a-gold-cost" dont know the name atm but you can set its base id and a gold cost instead of mana.
With that you can disable the ability for a player.

Interresting, when you find the name of the ability informe us pleas.
 
Event -
<Unit> (Marketplace) sells a unit

Condition -
Unit type of being sold = <My Unit Type>

Action -
Do multiple actions and conditions > if the player with the sold unit already has the same unit type, then delete the newly purchased unit and refund the player. If not, then continue doing nothing.

_________
_________
_________
 
Status
Not open for further replies.
Top