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

Building limit {having to destroy a building-type to build another type}

Status
Not open for further replies.
Level 5
Joined
Jan 22, 2009
Messages
66
ok im a new user and im trying to re-create a map from scratch cuz da author is long gone, so im having a little trouble with building limit.

say i got building a, b and c and i want da players only b able to pik one of them AT A TIME, so say i got building A but now i want B so i have to destroy building A to i can build B how do i do that?

THX IN ADVANCE ^_^

EDIT:
da map name is Empire NOT Empires is old and simple u can find it in epicwar.com real fast just if u wanna know

Empire V1.3 - Warcraft 3 Maps - EpicWar.com
 
Last edited by a moderator:
Level 2
Joined
Jan 12, 2009
Messages
19
If I think I know what you mean correctly, then you can just use a trigger something like this:
Event: (unit) finishes contruction
Coindition: Triggering unit is building (building A)
Action: Kill/Destroy (building B)
Something like that?
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I don't think you can restrict buildings directly. I don't have the WE with me right now, but I think it's possible to cancel a building's creation. If so, you should cancel the building as soon as building starts and return the lost gold to the owner. To check if a building is already build, make a Boolean variable (e.g. BuildingBuild). When building A, B or C is build and BuildingBuild = False, set BuildingBuild = True. If BuildingBuild is True, cancel the building and return the gold, like I said before. When a building is destroyed, set BuildingBuild back to False.

Another option is to use an Integer variable (e.g. BuildingCount). It works the same. If you build 1 of the buildings, set BuildingCount = (BuildingCount + 1.00). If BuildingCount Greater then or equal to 1, cancel the building and return the lost gold (like said before). The advantage in using an Integer is that you can also restrict to give a maximum of 2, 3, 4 or more buildings. Just what you want.
 
Level 12
Joined
Aug 22, 2008
Messages
911
I offer another option:
Creating a seperate trigger for each building of A, B, and C. Each one does the following (now taking A as an example):
  • Upgrading to Building A
    • Events
      • Unit - A unit starts upgrading/training/building(not sure, correct me)
    • Conditions
      • (Unit type of (Triggering Unit)) equal to Building A
    • Actions
      • Unit Group - Pick every unit owned by (Owner of (Triggering Unit)) matching ((Unit type of (Matching Unit) equal to Building B) or ((Unit type of (Triggering Unit equal to Building C)))
        • Actions
          • Unit - Kill / Remove (Picked Unit) - By your choice
Also, I advise you to inform the user that all his other buildings will be destroyed in the proccess. And if you want to give them back their money you can add them with the Player - Add (Integer Value) to Player's lumber / gold.
 
Level 5
Joined
Jan 22, 2009
Messages
66
there is trigger that u can set max amount for buildings/units by player that he can produce

thx ive actually tried doin dat at first, but if u opened da map as u can see all the units are in building "A"
but i want to add more units in da remade map so i made 3 buildings A, B C each one has da same untis but stronger version of dem and dey will be allowed after a certain amount of time
da one building allowed per player was ez ^^ but i coulnt find an instant one for wut i first said i tried so many things n it turns out when i build "A" den kill it den i cant build "B" or "C" i can only build "a" from now on

EDIT1:
I offer another option:
Creating a seperate trigger for each building of A, B, and C. Each one does the following (now taking A as an example):
  • Upgrading to Building A
    • Events
      • Unit - A unit starts upgrading/training/building(not sure, correct me)
    • Conditions
      • (Unit type of (Triggering Unit)) equal to Building A
    • Actions
      • Unit Group - Pick every unit owned by (Owner of (Triggering Unit)) matching ((Unit type of (Matching Unit) equal to Building B) or ((Unit type of (Triggering Unit equal to Building C)))
        • Actions
          • Unit - Kill / Remove (Picked Unit) - By your choice
Also, I advise you to inform the user that all his other buildings will be destroyed in the proccess. And if you want to give them back their money you can add them with the Player - Add (Integer Value) to Player's lumber / gold.
i'll try dis thx =D

EDIT2:
um i dun know how to specify a matchin unit or picked unit....T_T

EDIT3:
i got an idea =D if i get it i'll say it

instead of only one building how to do dis:
i build "A"
den i build "B" - action will b kill/remove "A" or "C" if it was built
plzz n ty is a rlly kool map simple but kool
 
Last edited by a moderator:
  • Angry
Reactions: Rui
Level 18
Joined
Aug 23, 2008
Messages
2,319
Set the building to a variable (I think Unit Variable). If a new building is created, destroy the building set to the variable and set the newly building building to the variable.

EDIT: Here's the trigger. I had WE open anyway.

  • Building replacement
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Constructed structure) Equal to Building A
          • (Constructed structure) Equal to Building B
          • (Constructed structure) Equal to Building C
    • Actions
      • Unit - Kill MainBuilding
      • Set MainBuilding = (Constructed structure)
MainBuilding is a Unit variable that is set to the building that you may only have 1 of.
 
Status
Not open for further replies.
Top