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

Requirement on buildings {limiting the buildings to a number}

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2007
Messages
57
hi :) how to do so if someone builds a gold mine, he cant buy one more? (ive seen maps where they simply disappear from the buildings tab, and ive seen where it says "-Requires: Only one allowed"), i dont care which of these you tell me how to do, because i just need one of them :) reason why: gold is used for buildings, lumber for items, and food for trainable units, so im kinda stuck :( thanks for your help :)
 
Level 4
Joined
Jan 25, 2009
Messages
117
Trigger 1
Event- Unit finishes construction
Conditions-
if constructed structure equal to Gold Mine
If limit equal to 0
Actions- Set limit to 1

Trigger 2
Event- Unit finishes construction
Conditions- if constructed structure equal to Gold Mine
Actions- if limit equal to 1 then remove constructed structure from play else do nothing

Trigger 3
Event- Unit dies
Conditon- dieing unit equal to Gold mine
Action- set limit to 0

Note: Limit is a variable, the type is real.
And if u need this to work for multiple players u need to make variables for each player and make these 3 triggers for each player.
 
Level 4
Joined
Nov 17, 2007
Messages
57
I cant find the
Conditions-
if constructed structure equal to Gold Mine
If limit equal to 0
part >.< i can make Constructed structure equal to Gold Mine - but the "if" is nowhere, ive searched for it too
 
Level 11
Joined
Nov 15, 2007
Messages
800
Conditions - Unit-Type Comparison

Conditions - Integer (or Real) Comparison

Also, you don't have to make a variable for every player; make it an "Array" with a size of the max number of players in your map, and use Variable[Player Number of (Owner of unit)]

Edit: His solution won't disable the construction of your gold mine, it'll just remove one when it's constructed. Could be frustrating, there's a better solution but I don't feel like thinking of it right now.
 
Level 11
Joined
Feb 16, 2009
Messages
760
Dont be so hard, it would make people lose gold. This triggers disables the training availbility.

Trigger 1
  • Only one gold mine
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Gold mine
    • Actions
      • Player - Make Gold mine Unavailable for training/construction by (Owner of (Triggering unit))
Trigger 2
  • Gold mine destructed
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Gold mine
    • Actions
      • Player - Make Gold mine Available for training/construction by (Owner of (Triggering unit))
Thats it
 
Level 4
Joined
Nov 17, 2007
Messages
57
(Unit-type of (Constructed structure)) Equal to Gold mine --- how can i do that? for my other triggers ive used things like "TempUnit equal to last created unit" "force last created unit to" bla bla bla... is there any way to do that or did you just click Select a Unit ?
 
Level 8
Joined
Mar 12, 2008
Messages
437
(Unit-type of (Constructed structure)) Equal to Gold mine --- how can i do that? for my other triggers ive used things like "TempUnit equal to last created unit" "force last created unit to" bla bla bla... is there any way to do that or did you just click Select a Unit ?

Unit-type comparison.

Like Mr M4stah said, "Constructed structure" is an event response, similar to "Triggering unit" or "Hero manipulating item" and refers to someone who's done something in the event.
 
Level 4
Joined
Nov 17, 2007
Messages
57
thx lots everyone :) if i could id add rep, but i doubt i can :x

{EDIT}
would i still have to make a trigger for everyone, or is those 2 triggers enough for all players?
 
Last edited by a moderator:
Status
Not open for further replies.
Top