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

Limit Number of certain Buildings for Player

Status
Not open for further replies.
Level 5
Joined
Aug 23, 2008
Messages
116
Hi!

Do you know DARK DEEDS? There you can only have 1 Farm. If you have built one, its ''build button'' will become dark and the following text appears if the cursor goes over it:

Build new Farm
-Old Farm must be destroyed


How can I trigger this? And how can i limit a building to 2 or 3? (Even if their 'earlier versions' are upgraded?)

MfG

Cyrax

PS: The 'standard trigger' for limiting buildings makes the build button disappear. I dont like this...
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Make a dummy unit called "Old Farm must be destroyed", and place it on the map for each unit.

Go to the farm, techtree, and add the requirement: "Old Farm must be destroyed", the dummy unit, that is.

Make a trigger that whenever a farm is constructed, every unit of type "Old Farm must be destroyed" owned by the player, is removed

Make another trigger that whenever a farm is destroyed, a dummy unit of type "Old Farm must be destroyed" is created for the owner of the farm

EDIT: ofcourse an alternative solution would be using the "Limit units of type "Farm" to 1 per player" action at map initialization, but that wouldn't add the "Old farm must be destroyed" requirement.
 
Level 5
Joined
Aug 23, 2008
Messages
116
Sounds good TY ;-)
But I have the following problem:

I limit e.g little houses to 2
Houses are upgraded in greater houses

Now have i build 2 little houses and upgrade 1 of them

The Problem:
Now I can build a small house again(!) though i have 2 houses on the map (normal one and upgraded one)

How can I prevent this?
 
Level 5
Joined
Aug 23, 2008
Messages
116
Hey,

I thought about your tip and I think I know now how I can use these 'Dummies' to solve my problems!

Thank you very much ;-)

Cyrax
 
Status
Not open for further replies.
Top