2Bit's Mapping Corner on www.PythonOnline.co.uk
ET Mapping Tutorial

Lesson 27

Topics

Making a constructible object
 
Preparation
Making the constructible
Writing the script
Back to main menu
Preparation [Top]
Constructibles are best included by importing one made earlier, rather than create all the components manually.  I've found the best way is to have a template map and script, edit them to yield the required names and then import them ready assembled straight into the map.

I have put an allied constructible template here for you to download.  Unzip it and put the 2 files into your maps/prefabs folder.  Don't amend these, just use them as the template to stamp out allied constructibles as you need them.

Make a copy of etmain/maps/prefabs/prefab_allied_constructible_template.map and call it etmain/maps/_temp.map.  By calling the copy "_temp" it will appear early in your list when you import it, and you know to chuck it away later on because it is "temp".

Edit _temp.map with Wordpad or similar.  Make these changes:

  • Replace all instances of "alliedconstruct_n" with "alliedconstruct_1" as this is the first allied construct to add to the map.  You could change the name to something more meaningful if you like, eg "allied_ramp", but I'm sure you get the principle.
  • Replace "Allied Item" with the name to appear on the Command Map, in this instance we'll make an assault ramp, so make it "Assault Ramp".
  • Replace "Allied Construction" with the words to appear next to "you are near...".  In this example, "the Assault Ramp".
  • Save and close the file.
Making the constructible [Top]
Run Radiant and open the map.

Import "_temp.map".

While it is still selected, drag it into some space in the map, as shown:  It should already be at about the right height, but in your own creations you'll need to make sure the crates and surrounding trigger are placed at the right height - the ramp we'll build where we want it, so the little box that is the template constructible can go anywhere at the moment.

Press ESC.  Let's make the ramp.  You could of course make anything you like as a constructible, but for this example we're going to make a very simple wooden ramp.

Draw a brush as shown.

In the 2D side view, make it a reasonable thickness for a wooden ramp.  I used grid size 4 and made it one notch thick.

We'll assume the ramp can be seen from all angles, so there will be no caulked surfaces.  Therefore, make the whole brush wooden by clicking on the wood_c01 texture in the textures window.

If the textures are aligned the wrong way, press S and rotate them by 90 degrees, and click Done.

Make the brush Detail and by now you should have something like this:

Now we'll angle it and put it against the wall.  Select the brush and click Selection/Rotate/Arbitrary Rotation, put "30" in the "Y" box and click OK.  Remember to use nice round degrees of rotation whenever possible - it gets very nasty trying to get other elements to line up if you don't.

Now slide the brush so that it rests against the wall and on the surface of the grass.  The following image has models filtered to make it easier to see.

Press ESC.  You'll see that the edges of the ramp now have misaligned textures.  Select the 2 affected faces, press S, enter "-30" in the Rotate Offset box and click done.

Press ESC.  We'll add an upright support.  Draw a brush:

Caulk it and position/resize it as shown so that it supports the ramp.

Press ESC then select the 4 visible faces and make them the same wooden texture.  You should now have a ramp like this, ready to be made into our constructible.

Select both ramp brushes, then select the constructible box brush.  Right-click in the 2D and select "Move into entity".  You have now made the ramp part of the constructible.  Press ESC.  Select the box brush and delete it.  This will reveal the origin brush inside it.  The origin brush tells ET roughly where the middle of the constructible is deemed to be.  Select the origin brush and move it to the middle of the ramp.

Press ESC.  Prove that the origin brush and both ramp brushes are now one entity by shift+alt+clicking one of the brushes in the 3D view - they should all be selected.

Press ESC.  Save and compile the map, but don't go into ET yet - we have to write the script to make it work.

Delete the "_temp.map" file, we don't want that any more.

Writing the script [Top]
Using Wordpad or similar, open the prefab_allied_constructible_template.script file.  Copy all the text, and paste it into the tutorial.script file, after the game_manager section and before the "axis construct" section.

Replace all 7 instances of alliedconstruct_n with alliedconstruct_1.

Where it says "Allied Team have built the box!" change it to "Assault Ramp constructed!" or whatever you want.  You can use the usual ET colouring convention if you want words in different colours, eg a prefix of "^3" would make the text yellow.

Where it says "Axis have destroyed the box" change it to "Assault Ramp destroyed!".

Later on we'll add some speech but we'll skip that for now.

As the ramp will be destroyable by a satchel, we can leave the constructible_class set to 2.

Save and close the script file.

Run ET and have fun making and breaking your assault ramp :)  In practice, you wouldn't place a constructible so close to a CP or other constructibles/destructibles.

I'll get some Axis templates together for you shortly.

Next lesson