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

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,658
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