Multi-Part Buildables
Home > Multi-Part Buildables
This is a guide to creating multi-part buildable objects. These are the kinds of objects that are built in stages, for example an upgradeable bunker, or a tower that gets taller as more sections are built. This guide only covers brush-based buildables, though the principle would remain the same for model-based ones.
Before you begin, I would recommend reading the basic tutorial, covering single-part buildables.
Editing the FGD
You should be familiar with the concept of entities, and how they can have attributes, inputs and outputs. What you may not know is that all the entities available to you in the Hammer editor are defined in a text file, with the extension ".fgd". It is necessary for us to first make some changes to this file, in order to grant us access to some features that are not present in the default Empires install.
The feature that we're most interested in is the onKill output of the emp_eng_map_brush entity. Details on how to add this can be found here.
Once you have your "empires.fgd" set up correctly, you can launch hammer and start putting your object together.
Creating the Object
In this tutorial, I will be creating a tower that is to be built in three stages.
- Firstly, create the brushwork that will form the base for your first stage. In my case, this would be the lowest section of my tower.
- Select all parts of your first stage, and press Ctrl-T to tie them to an emp_eng_map_brush.
- Now, create your second stage. You do not need to duplicate the brushwork that forms your first stage, just create the parts that extend it.
- Select it, and tie it to another emp_eng_map_brush, as you did with your first stage.
- Repeat the process for your third and final stage. Now you should have three separate entities, each of which form one stage of your completed object.
- Give each stage a meaningful name. Mine are called "tower_bottom", "tower_middle" and "tower_top".
- For the moment, my tower is owned exclusively by the Northern Faction (team changes will be covered later on). So set the bottom section's "Initial Owner" to "Northern Faction".
- Because I only want the bottom section to be buildable from the beginning, the upper sections must start disabled. To do this, set their "Initial Owner" to "No Owner (Disabled)".
- The other properties, such as "Initial Health", "Max Health" and "Raise Object On Build", can all be set as you wish.
Making it Work
Here is the principal on which my tower operates:
- When the bottom is built, I enable the middle.
- When the middle is built, I enable the top.
- When the top is built, I don't do anything!
- When the top is destroyed, I don't do anything.
- When the middle is destroyed, I destroy the top.
- When the bottom is destroyed, I destroy the middle and the top.
Now that we've established these rules, we quite simply translate them into a format that Hammer's I/O system can understand.
- For tower_bottom, add the output OnNFBuilt to target tower_middle with InputNFEnable.
- For tower_bottom, add the output OnKill to target tower_middle with InputDisable.
- For tower_bottom, add the output OnKill to target tower_top with InputDisable.
- For tower_middle, add the output OnNFBuilt to target tower_top with InputNFEnable.
- For tower_middle, add the output OnKill to target tower_top with InputDisable.
And that's it! Your structure is now complete. You can compile your level at this stage, and you should be able to see it in action. What follows is an explanation of how to deal with your structure changing teams in co-ordination with the ownership of a flag.