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

Preventing one barrack from training a unit but not the other?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
Lets say a player has 2 Barracks. One of them can train two different types of units, A and B. However the other can only train unit A. How would you go about limiting Barrack 2 from building unit B?

One way is to make barrack 2 a different unit from Barrack 1. But that would be tedious and become more and more difficult the more options there are...

Ideas?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
It depends on why you are looking for another solution.Is your barracks built by a worker?
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
It depends on why you are looking for another solution.Is your barracks built by a worker?

Structures are built by a dummy undead worker.

I want it so that only one "Barrack type" produces all the units. But additional buildings are used (Archery range, Stable and Barracks) to upgrade the local unit production of the "barrack".

Each city builds its own infrastructure so to speak.

Pretty much what edo494 said.

Though you can try to do a work around.
When the player select one of the buildings
  • Player - Make Footman Available for training/construction by Player 1 (Red)
Throw in whatever conditions you want.
Fx. if selected unit type is of some building do the above.

Problem with this is that units might be in training already and if you group barracks from two cities where footmen can be built in one place and not the other; what happens then? Still gonna test it and see what happens though.
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
Why don't you just add Techtree requirements then?

Because they are global? If I have upgraded one city to be able to make all units and then build a barrack in a city with no upgrades I don't want the last built barrack to have all units available.

One way to do it would be to cancel units that can't be trained; but that would look really retarded...

Another way would be creating different barracks and just replacing them when a upgrade is completed.

Barrack 1: Infantry
Barack 2: Infantry, Archers
Barack 3: Infantry, Archers, Cavalry
Barack 4: Archers
Barack 5: Archers Cavalry
Barrack 6: Cavalry

But this would be so dumb I might just keep the barracks separated (one for infantry, one for archery, one for cavalry).

Maybe if I made it spawn based or something... hmm...
 
Last edited:
Level 15
Joined
Nov 30, 2007
Messages
1,202
Why not make the units buyable like a mercenary camp and modify the available units?

I like the training and canceling of units, but that would be a solution. Or make bought mercenary units spawn at the end of the turn or something. I have a similar problem for building-tech tree, but that could be solved by creating and destroying dummy tech-tree units (to make available/unavailable).
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
Replace Units....

Tech_LEVEL_1
Unit-type 1: Infantry 1
Unit-type 2: Infantry 1, Archer 1,
Unit-type 3: Infantry 1, Archer 1, Cavalry 1,
Unit-type 4: Archer 1, Cavalry 1,
Unit-type 5: Archer 1,
Unit-type 6: Cavalry 1,


A issue here is that if i queue up 7 infantry units and they lose a tech option, say archers, it would be replaced and do nothing. If there was a way to detect what unit-type was in that queue....

Another option would be to just remove trained units or interrupt training of units. But I can't seem to find Remove from training in the editor. A alternative of this would be to remove the unit and give resources back to the player. But....

http://www.hiveworkshop.com/forums/...v-0-9-a-248978/?prev=search=train&d=list&r=20
 
Last edited:

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You could also create a dummy barrack instead. If so, in object editor you would have 2 barrack-type units defined, and one of them can and the other can not produce certain type of units.

Now, whenever you need to prevent barrack from training specific unit-type or rather make that type unavailable for that barrack to be trained, replace temporarily given unit with the second barrack-type unit.
 
Status
Not open for further replies.
Top