Multi-Part Buildables: Difference between revisions

From Empires Wiki
Jump to navigation Jump to search
No edit summary
Line 55: Line 55:


==Team Changes==
==Team Changes==
===This is a work in progress tutorial, actively under development by Broccoli.===
===This section has not been written yet.===

Revision as of 23:50, 25 January 2007

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.

  1. First of all, we have to find the ".fgd" file. Now this will usually be in "Steam/SteamApps/SourceMods/Empires/mapsrc/fgd", and will be named "empires.fgd"
  2. Before making any changes, backup the file by creating a copy and naming it "empires.fgd.backup". Should anything go wrong, you can always revert to this file.
  3. Open the original file in notepad, and find the following line: "@SolidClass base(Targetname) = emp_eng_map_brush :". This is where the definition for the emp_eng_map_brush (the entity that we will be modifying) begins.
  4. Beneath this line, locate the output section, which should be a group of lines, each beginning with the word "output". There should exist one entry for the object being constructed by the Northern Faction team, and another for the Brenodi Empire.
  5. After these two lines, add the following: "output OnKill(void) : "Output for destruction of the object.". This will provide us with an output in hammer which fires when the object is destroyed. This output forms the cornerstone of the whole multi-part method.
  6. Save the file.

Now that you have your "empires.fgd" set up correctly, you can launch into hammer and start putting your object together.


Note
Re-installing or upgrading to a new version will most probably overwrite your fgd file. For this reason, it is advisable to check that this line is present after every change to your installation.

Creating the Object

In this tutorial, I will be creating a tower that is to be built in three stages.

  1. 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.
  2. Select all parts of your first stage, and press Ctrl-T to tie them to an emp_eng_map_brush.
  3. 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.
  4. Select it, and tie it to another emp_eng_map_brush, as you did with your first stage.
  5. 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.
  6. Give each stage a meaningful name. Mine are called "tower_bottom", "tower_middle" and "tower_top".
  7. 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".
  8. 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)".
  9. 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.

Team Changes

This section has not been written yet.