Make units fly

From AgeofWiki

image:medal.gifThis article was rated Article of the month in January of 2006!

Table of contents

Introduction

Since the early days of AOM, designers seemed to be fascinated with perching units up on anything that would support them. Walls, buildings and towers were favorites. Yet the process used up to now, that is creating a small hill using the elevation tool and hiding the hill with a model has severe limitations, and during levels, often when the building that's hiding the hill was destroyed, you were left with an unsightly hill that gave away the illusion. Also in AOE3, since there's no impassable terrains, it is hard to get units to stay put atop their little hill perches.

The Secret is the Flying Units

I first got the idea while playing AOM, and observing the flying units like the Nidhogg and Pegasus. Although I didn't try the technique until AOE3, I couldn't wait to try it as soon as I saw the hot air balloons. Notice that all flying units maintain a certain distance from the ground. The next question was, what exactly determines a flying unit?

The Magical Proto File

This technique requires modding the proto.xml file so if you undertake this process you'll have to learn a bit about modding this file. I won't cover it here but suffice it to say you should back up your original proto for safety, and restore the original proto file if you plan on playing on-line or watching replays. Otherwise you'll get OSS errors.

If we look at any land based unit's proto definition we see one line that defines it as a land based unit:

<MovementType>land</MovementType>

Alternatively if we look at a flying unit, we see these lines:

<MovementType>air</MovementType>
<Flag>FlyingUnit</Flag>

And those two lines are the key. You'll first select what unit you want to "fly". In my case I chose the SPC Buccaneer since they look good perched up on ship's rigging. With a text editor open up the proto.xml file, its found in the Program Files/Microsoft Games/AOE3/data folder. The entry starts and ends with these lines respectively:

<Unit id ='549' name ='SPCBuccaneer'>
</Unit>

Paste that proto entry between the last line of the last proto entry and the very last line of the proto file. If you haven't modded your proto, the last entry will be the Moon Bass and where the XXXXX is below is where you'll insert the proto entry for the new flying buccaneer.

<Unit id ='620' name ='FishMoonBass'>
.....
.....
</Unit>

XXXXX

</Proto>

Once you've pasted the buccaneer's proto entry in that space, make sure to use a new ID number, which would be 621 if your proto hasn't been altered before. I like to rename the new unit something else although you don't have to since new proto entries get a symbol put in front of them automatically in the editor object list. I called my "SpecialBuccaneer". I also like to change these two lines:

<DisplayNameID>35253</DisplayNameID>
<EditorNameID>35254</EditorNameID>

and replace the numbers with the name "Special Buccaneer" without the quotes.

Next alter this line of the buccaneer's proto:

<MovementType>land</MovementType>

to

<MovementType>air</MovementType>

and add this line:

<Flag>FlyingUnit</Flag>

where you see other entries that start with the <Flag> argument. As far as I can see, it doesn't matter if this entry is first, last, or in the middle, but I put in with the other entries that start with the <flag> argument.

And that's it, we're ready to test our flying buccaneer! Just make sure not to disturb any other code in the proto file. Save as an UTF-8 encoded file with the name proto.xml in the folder defined above.

Final Touches in the Editor

Fire up AOE3, open the editor, and open the place units tool. Select the Special Buccaneer off the list and place him on the map. You'll notice he floats about 15 units above the ground, and that's higher than anything in the game - save other flying units. You'll also notice he follows the terrain just like the balloon does - that is the height is constant so if he walks over a hill, he goes up.

The ICG Galleon model is great for placing flying units on since the model's origin is well away from most of the crow's nests and rigging. Slide the buccaneer into position near the crow's nest for example, then use the elevation tool with the smallest brush setting, and elevate the ground down underneath the buccaneer to bring him level with the surface you want him to rest on. The nice thing is, the buccaneer is free to move around as long as the ground directly beneath him is low and level. This is a vast improvement over the old method. If you can see his decal on the ground, all the easier to select the tile to lower.

Conclusion

And there it is! I hope you agree this technique is more refined than the old way and gives a better end result.