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

Basic and Advanced Build Icons

Level 12
Joined
May 20, 2009
Messages
822
A small group of developers, known as ZanManagement, may have or may have not been the first to discover this. Either way, I found this out by looking through their mod WarCraft Vs StarCraft.

Here is a map template if you need additional help: Map <- Updated

First, we need to know of a few files in the War3.MPQ archive.

CommandStrings.txt, HumanAbilityFunc.txt, UndeadAbilityFunc.txt, OrcAbilityFunc.txt, and NightElfAbilityFunc.txt.

Extract these using an MPQ program, I suggest Ladik's MPQ Editor. You can find these files in the Units\ directory.

These files contain the first part of the necessary data to do this. Once you're done editing these, you can simply import them into any map you want.

Now, as we all know in the normal WC3 Map Editor, (And even in some modded editors,) you cannot edit the Build Ability.

These files, however, contain the necessary data needed to modify to do so!


I'm going to use Humans as an example:

This Ability is in HumanAbilityFunc.txt

[AHbu]
Art=ReplaceableTextures\CommandButtons\BTNBlank.blp
Buttonpos=2,1
Order=humanbuild
Also, be sure to change the button positions of other abilities, such as Call to Arms or Unsummon Building. They will be in the way of the Advanced Build Button.

The way I have it set up in the Map Template is how I suggest you should set it up, the abilities being shifted over one. (Detonate is at 2,2 , Unsummon is at 3,2 , Sacrafice is at 2,2 , Etc)

[Just as a little flavor note, the A stands for Ability, H stands for Human, and BU stands for Build.]

Please note the Button Position, and the Button Art itself. These are important.
The Button Position needs to be in a position on the worker for the exact race, meaning if you make another Worker for the Human Race it will use this same button position for it's Build Ability.

The Button being blank is so it isn't visible.


This is in CommandStrings.txt

[CmdBuildHuman]
Tip=
Ubertip=
Hotkey=Z

You can change the Hotkey to whatever you want. I suggest a far-off Hotkey that you will never use for any of your Hotkeys. When you decide on your Hotkey, MAKE SURE YOU MAKE IT CAPITAL! I''ve made that mistake before and it drove me insane.

All the other ones are, [CmdBuildOrc], [CmdBuildUndead], and [CmdBuildNightElf].

Notice that Tip and Ubertip are not blank, they have a single space after them, this is so when the icon is hovered over it doesn't show any text.

Now just import these into your map and you're done with the Hard/Easy part (Whichever you think)

The next thing you need to do is make a copy of the Mana Shield and Wind Walk abilities, since these are the easiest abilities to modify that do not target a unit, and have an Order String.


Remove all the buffs, effects, set all the data values to 0, (Such as Damage absorbed for Mana Shield, Speed Increase for Wind Walk, etc) and that should be good to go. Alternatively, a Channel ability with the order you are using in question should also be sufficient.

Now, we move on to the Triggers.

  • Human Build Advanced Build
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Villager
      • -------- Checks for units issued an order with no target, than to make sure it's your worker -------
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
      • -------- This checks for Advanced Build --------
        • Then - Actions
          • -------- Upgraded Construction --------
          • Player - Make Weaponry Encampment Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Villa Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Keep Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Settlement Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Farm Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Draft Camp Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Altar of Lost Souls Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Long House Unavailable for training/construction by (Owner of (Ordered unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
        • -------- This checks for Basic Build --------
          • Then - Actions
            • -------- Normal Build --------
            • Player - Make Weaponry Encampment Unavailable for training/construction by (Owner of (Ordered unit))
            • Player - Make Keep Unavailable for training/construction by (Owner of (Ordered unit))
            • Player - Make Villa Unavailable for training/construction by (Owner of (Ordered unit))
            • Player - Make Settlement Available for training/construction by (Owner of (Ordered unit))
            • Player - Make Farm Available for training/construction by (Owner of (Ordered unit))
            • Player - Make Draft Camp Available for training/construction by (Owner of (Ordered unit))
            • Player - Make Altar of Lost Souls Available for training/construction by (Owner of (Ordered unit))
            • Player - Make Long House Available for training/construction by (Owner of (Ordered unit))
            • -------- FORCE "BUILD" KEY --------
            • Game - Force (Owner of (Ordered unit)) to press the key Z
          • Else - Actions
If you did this right, than what will happen is:

You click or press the Hotkey for the Basic Build icon, and it will disable certain buildings and enable others, than force the Hotkey for the REAL build icon to be pressed.

This is my first tutorial, so go easy. Also, if you already know this than please don't be too mean. ^^

I will let you know now, that this MAY or MAY NOT cause lag in Multiplayer, I don't know for sure since I never tested.

There are a few side effects to doing this.

-The Original Build icon is still clickable, and will show you the buildings that are currently enabled.
-You get two annoying click sounds instead of one.

-Acolytes won't be able to sacrifice properly.
-Build commands will be reset if Advanced Build is clicked before
But other than that, it is FULLY functional.


EDIT:

Also in my example here, I show how this can be used to make a unique mechanic. The way I was setting this up was there are several buildings that can be upgraded into an improved counter-part.
However, if you already have the improved counterpart on the field you can build it straight-up without having to build the original building.

This made this race slow to tech at the start, but able to keep up with production later on. They are meant to be a more macro-oriented race, instead of micro. Lots of cheap units, with lower stats, most having abilities that spawn more units.


If you have any suggestions on how to make it simpler for beginners to read, please let me know in this Thread or PM if you want.

Credits go to the ZanManagement Team, which is who I learned this off of. Go check out their website or other projects. =p

For an alternative implementation, you may want to check this out: Basic and Advanced Build Icons
 
Last edited:
Level 12
Joined
May 20, 2009
Messages
822
Just use channel as base spell rather than mana shield or windwalk...

You need two separate Order Strings for this to work. Mana Shield and Wind Walk are the easiest candidates for that.

Edit: Order Strings that don't have a target. Maybe they're aren't the easiest. I'm just using them because that's what ZanManagement used. Why fix what ain't broke?
 
Last edited:
Level 13
Joined
Jul 2, 2008
Messages
1,182
There is a bug which i also had when i tried to create an advanced building system with making buildings available/unavailable.
If you build several normal buildings with the shift key and afterwards select a second worker and build an advanced building all normal building orders will be canceled.
Maybe you could use replace unit (having a second worker with other building set) instead ?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Another idea that does not kill the localization:

You can integrate abilities into the build menu by creating a spellbook with the same order ("humanbuild" for human building), giving this ability to the unit and afterwards deactivating the spellbook ability for the player. If you disable the shared cooldown flag of the spellbook, it won't close when casting an ability from it. Then proceed with the order trigger like above. Disable the initially unwanted structures at map init.

@Adiktuz: Windwalk, Mana Shield and the like are better for this task because they are immediately and parallel castable. Channel does not provide that option.

I also want to remark that giving the build menu some black button does not hide it. If the button was hidden, the hotkey would not work either.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
? It's the normal build method and you select the structures like above with the "Player - Set Training/Construction Availability Of Unit"-action. Just in this case, you enter the build menu by itself and there is a switch button inside. It's also safer than the Key Press emulation above because the unit might not even be selected/have another unit as primary selection/have another ability with the same hotkey (you also have to account for a user's custom keys), so this might trigger something else.
 
Level 13
Joined
Jul 2, 2008
Messages
1,182
I really hope someone could solve that problem :(

BTW an other ´way would be to replace the worker with a second worker and give him different available building. I tried that and it worked so far, but i had a problem. If the player presses ESC to abort the build order
its still the "second" worker with advanced buildings. But when i tried it i didnt know about the possibility to change the position and hotkey for the build ability. I will try it that way again.
 
Level 13
Joined
Jul 2, 2008
Messages
1,182
I created a second peasant and triggered this. Now it is possible to build with several workers without breaking the order, but now the problem is that the worker using the ability stops every action ordered before.

  • Human Build Icons
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions

Tried to improve it. Now i can add more build orders of the same type (basic or advanced) without stopping the previous build orders.

#1

  • Human Build Icons Copy
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions
#2

  • Human Build Icons
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions
 
Level 12
Joined
May 20, 2009
Messages
822
Yeah, I forgot about that.

ZanManagement didn't run into that issue yet because they only had Zerg recreated. So it was a lot harder for that issue to occur.

I'll try and come up with something.

Also, this system wasn't entirely finished when they released the map. I do believe they said this was something that they were only using temporarily, that they needed to make a better system for.

I'll see what I can come up with, but my knowledge of Triggers is still fairly limited. I'm very new to Triggers, so I practice with stuff other people made.

Edit: Woah. While I was typing this, it was still one page. o_o
 
Level 12
Joined
May 20, 2009
Messages
822
blub

edit: Yes, your described problem appears. Maybe this can be solved via just in time set-changing because once the structure is there, it's good to go. For example catch when a unit comes within building range.

The whole reason this system does what it does is to emulate Basic and Advanced Build from WarCraft II, StarCraft, StarCraft II, etc.

The way you have it set up doesn't do that at all.

It's also a bit harder to navigate, because you have to worry about the switch ability not having the same hotkey as any of the buildings. Whereas the other way you just have to worry about it not mixing with the other Worker Commands.

I created a second peasant and triggered this. Now it is possible to build with several workers without breaking the order, but now the problem is that the worker using the ability stops every action ordered before.

  • Human Build Icons
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions

Tried to improve it. Now i can add more build orders of the same type (basic or advanced) without stopping the previous build orders.

#1

  • Human Build Icons Copy
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions
#2

  • Human Build Icons
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions

This would work if there was a similar system in SC2 that allows different units to act like they were the same unit. But unfortanetely this will cause there to be 2 different units that you'll have to switch back and forth by pressing the Tab key.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
It's also a bit harder to navigate, because you have to worry about the switch ability not having the same hotkey as any of the buildings. Whereas the other way you just have to worry about it not mixing with the other Worker Commands.

The total set of objects in the build menu is static (and there are always only max 10 buildings at a time) whereas outside the unit may gain new abilities.

@TaShadan: Replacing the unit kills a lot, like all the buffs on the unit, the order, the animation, any runtime-set characteristic. At least use passive morphing then.
 
Level 12
Joined
May 20, 2009
Messages
822
There's unfortanetely no other way for this to be done, unless something in JASS can help us.

Enable/Disable Unit is the only thing that can remove the button. Which is all we really need to do, so if there is a way in JASS to remove the button without actually disabling the tech than we'd be good to go.
 
Level 13
Joined
Jul 2, 2008
Messages
1,182
The total set of objects in the build menu is static (and there are always only max 10 buildings at a time) whereas outside the unit may gain new abilities.

@TaShadan: Replacing the unit kills a lot, like all the buffs on the unit, the order, the animation, any runtime-set characteristic. At least use passive morphing then.

Which morph do you suggest? I tried unbearform and bearform but iam not able to do it :(

UPDATE: ok i did it

I created a new ability based on bear form and changed the morph time to 0.1 and the alternative and normal form to the 2 peasants.

  • Human Build Icons
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(bearform))
        • Then - Actions
          • -------- Advanced Construction --------
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions
  • Human Build Icons Copy
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Peasant 2
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key Z
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unbearform))
            • Then - Actions
              • -------- Basic Construction --------
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key Z
            • Else - Actions
 
Level 13
Joined
Jul 2, 2008
Messages
1,182
Now i have something strange. The advanced worker cant build anything. He walks the the ordered position but nothing happens.....

I also realized a problem with all the solutions. If you use hotkeys to build, for example B + F to build a farm, if you are too fast nothing happens and you have to press f again. Oh Blizzard why didnt you implement that hardcoded....

And no, it's not restricted to heroes.

Sorry iam not stupid... every ability can be changed to unit.
 
Last edited:
The way I did it is much cleaner and more efficient imo:

First, make sure all basic and advanced buildings are added to your worker's Structures Built.

I made two copies of the Channel ability and changed the following:
-Hero Ability: False
-Levels: 1
-All other Data/Stats: 0/False
-Base Order ID/Order String: militia for Advanced Build and militiaoff for Basic Build (change it to something else if you're using the Militia ability, like manashieldon/off)
-Options: Visible

These can be used for any number of races (unless you want different icons).

Next, I defined a few variables:
-BuildAdvanced[]: Unit-Type Array (one for every race); Advanced Buildings Preset
-BuildBasic[]: Unit-Type Array (one for every race); Basic Buildings Preset
-BuildCount[]: Integer Array (Default: 0); Keeps track of number of Buildings per Set
-BuildCurrent[]: Ability Array; Keeps track of active Build Set
-Set TempAbility[]: Current ability being cast, per build set
-Set TempPlayer[]: Owner of currently switching worker, per build set

Finally, three triggers (per race):

-Build Set: Here we set the presets for available buildings
  • Build Set
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- BASIC (Index: 0) --------
      • -------- Building Type 1 --------
      • Set BuildBasic[BuildCount[0]] = Building Type 1
      • Set BuildCount[0] = (BuildCount[0] + 1)
      • -------- Building Type 2 --------
      • Set BuildBasic[BuildCount[0]] = Building Type 2
      • Set BuildCount[0] = (BuildCount[0] + 1)
      • -------- ADVANCED (Index: 1) --------
      • -------- Building Type 3 --------
      • Set BuildAdvanced[BuildCount[1]] = Building Type 3
      • Set BuildCount[1] = (BuildCount[1] + 1)
      • -------- Building Type 4 --------
      • Set BuildAdvanced[BuildCount[1]] = Building Type 4
      • Set BuildCount[1] = (BuildCount[1] + 1)
-Build Basic: This is where we enable basic buildings and disable advanced buildings
  • Build Basic
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Build Basic
      • (Unit-type of (Triggering unit)) Equal to (==) Peasant
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off Build Advanced <gen>
      • Set TempAbility[0] = (Ability being cast)
      • Set TempPlayer[0] = (Triggering player)
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • -------- If Build Set is already active, skip Build Set change --------
          • BuildCurrent[(Player number of (TempPlayer[0])] Not equal to (!=) TempAbility[0]
        • Then - Actions
          • -------- Activate Basic Build Set --------
          • Do ActionFor each (Integer A) from 0 to (BuildCount[0] - 1), do (Player - Make BuildBasic[(Integer A)] Available for training/construction by (TempPlayer[0])
          • -------- Deactivate Advanced Build Set --------
          • Do ActionFor each (Integer A) from 0 to (BuildCount[1] - 1), do (Player - Make BuildAdvanced[(Integer A)] Unavailable for training/construction by (TempPlayer[0])
          • -------- Update Current Build Set --------
          • Set BuildCurrent[(Player number of TempPlayer[0])] = TempAbility[0]
        • Else - Actions
          • Do nothing
      • Unit - Order (Triggering unit) to Build
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on Build Advanced <gen>
-Build Advanced: Enable advanced buildings and disable basic buildings
  • Build Advanced
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Build Advanced
      • (Unit-type of (Triggering unit)) Equal to (==) Peasant
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off Build Basic <gen>
      • Set TempAbility[1] = (Ability being cast)
      • Set TempPlayer[1] = (Triggering player)
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • -------- If Build Set is already active, skip Build Set change --------
          • BuildCurrent[(Player number of TempPlayer[1])] Not equal to (!=) TempAbility[1]
        • Then - Actions
          • -------- Activate Advanced Build Set --------
            • Do ActionFor each (Integer A) from 0 to (BuildCount[1] - 1), do (Player - Make BuildAdvanced[(Integer A)] Available for training/construction by (TempPlayer[1])
          • -------- Deactivate Basic Build Set --------
            • Do ActionFor each (Integer A) from 0 to (BuildCount[0] - 1), do (Player - Make BuildBasic[(Integer A)] Unavailable for training/construction by (TempPlayer[1])
          • -------- Update Current Build Set --------
          • Set BuildCurrent[(Player number of (TempPlayer[1])] = TempAbility[1]
        • Else - Actions
          • Do nothing
      • Unit - Order (Triggering unit) to Build
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on Build Basic <gen>
Two major flaws:
-Builder's orders are cancelled whenever either Build button is pushed (still better than forcing UI key imo, since that's unreliable and adds a second click sound)
-Scenario-specific buildings Tech-Tree becomes obsolete (also the case in OP tutorial)
+Probably the Acolyte thing mentioned in OP, not tested


Other than that, as far as I can tell, it works flawlessly, and should function just as well in multiplayer games (MP not tested).


If there is a way to detect the Build Menu and/or a Spell Book being opened, the first flaw would be fixed. I don't think it's possible though, they don't respond to any ability/order event.

A much better solution would be morphing the worker to one with different Buildings Constructed, but when you do that, the morphed worker won't be able to build the new buildings for some reason.
 

Attachments

  • Advanced Build Test.w3x
    21.9 KB · Views: 263
Last edited:
Yeah, neither is exactly ideal. I really wish there was a way to catch build menu/spell book open events. Or to morph a worker and the available structures actually working :(

Here's a test map.

Edit: I had the idea of keeping track of the orders worker units are given, in array with the unit ID as the index, but I can't figure out a way to get the ordered unit's ID :(

I updated the post with the triggers, improved efficiency a bit, also updated test map
 
Last edited:
Level 12
Joined
May 20, 2009
Messages
822
I am still working on this to get it fully MUI compatible and I feel like I'm coming very close.


EDIT: This CAN be made MUI compatible, but it requires Spellbooks. Which are glitchy as fuck and you won't see a Gold/Lumber cost unless you manually put it in the description of the building. But it CAN be made completely functional, and Humans and Orcs and Night Elves WILL build normally.

I'll post a new tutorial or update this one with a second method if anyone requests it.

For those that'll know what to do, though:

You need to hide the normal build icon via the text files->Then make all the appropriate spells->When the spell fires, issue a build order to the worker.

Ex:

JASS:
function Trig_Test_Copy_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetOrderedUnit()) == 'hpea' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Test_Copy_Func002C takes nothing returns boolean
    if ( not ( GetIssuedOrderIdBJ() == 1751674741 ) ) then //This is the order of the spell that will go out for "Build Tiny" spells. It'll be a random jumble of numbers. THIS particular one is actually the normal order that goes out when a Peasant is told to build a Farm.
        return false
    endif
    return true
endfunction

function Trig_Test_Copy_Actions takes nothing returns nothing
    if ( Trig_Test_Copy_Func002C() ) then
        call DisplayTextToForce( bj_FORCE_PLAYER[0], "TRIGSTR_058" )
        call IssueImmediateOrderBJ( GetTriggerUnit(), "stop" )
        call IssueBuildOrderById(GetTriggerUnit(), 'BUILDING', GetOrderPointX(), GetOrderPointY())
    else
    endif
endfunction

//===========================================================================
function InitTrig_Test_Copy takes nothing returns nothing
    set gg_trg_Test_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Test_Copy, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Test_Copy, Condition( function Trig_Test_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Test_Copy, function Trig_Test_Copy_Actions )
endfunction

(Big thanks goes to IceManBo for helping me)

This will also be GREATLY helpful, though I forgot who made it. I DID NOT MAKE IT:

JASS:
function Trig_orders_Actions takes nothing returns nothing
    local integer order = GetIssuedOrderId()
    call BJDebugMsg(GetUnitName(GetOrderedUnit()) + " has been ordered " + OrderId2String(order)+ " ("+I2S(order)+")")
endfunction

function InitTrig_orders takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddAction(t, function Trig_orders_Actions)
endfunction

Make a new trigger->Name it "orders" (No quotes) and convert it to text then paste that.
 
Last edited:
Level 3
Joined
Feb 21, 2014
Messages
28
So I extract the files from the .MPQ and then just leave them outside or I put them back on the MPQ after I edit them?
 
Level 3
Joined
Feb 21, 2014
Messages
28
I've followed all the steps and it is awesome! Thanks, but I have three build abilities, the normal one, the basic and the advanced, and I don't know how to delete or hide the normal one...
(I was using the more efficent and cleaner way)
 
Level 3
Joined
Feb 21, 2014
Messages
28
But... guys... Is there a way to hide the original Build (race) spell from the worker? I have 3 build spells on the Peasant... The original one, the basic and the advanced, in the demo the original one has the yellow cross icon and it is in another position, how do I make this?
 
Last edited:
Level 16
Joined
May 25, 2004
Messages
1,170
But... guys... Is there a way to hide the original Build (race) spell from the worker? I have 3 build spells on the Peasant... The original one, the basic and the advanced, in the demo the original one has the yellow cross icon and it is in another position, how do I make this?
you got to download the map, and use the imported files the map gives you. It's pretty easy to do.
Read post #1 again, but fully this time. You probably missed it.
 
Level 3
Joined
Feb 21, 2014
Messages
28
Hmm, everything was working okay till i made the build basic and advanced for two races and not only one ('don't know how to explain myself), it is maybe because I used two different spells? I mean...
Build Basic (Human)
Build Advanced (Human)
Build Basic (Illidan's Forces)
Build Advanced (Illidan's Forces)
I am using the cleaner and more efficent way given by loktar. I wanted to make two spells for each race so they all can have different icons instead of only one.

EDIT: I tried using the same spell I used for the humans but it keeps not working... It shows all the buildings instead of only some of them, like, you press Basic Structures and it shows you the basic and advanced one.

EDIT... Again: SHIT, DON'T WORRY. I already solved it, I forgot adding "Map initialization" in the Build Set of the Illidan's Forces.
 
Level 3
Joined
Dec 4, 2008
Messages
24
hi everyone hmmm i recently tested loktar's method and its fine but when i try it in multiplayer if only one player casts the build abilities it affects all the players who has the same builder type (ex: P1 Peasant casts Build but it also activates for P2 Peasant) can anyone confirmed this??
 
Top