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

Lesson 15

Topics

Making a constructible MG42
 
Making the constructible MG42 nest
Including the script
Back to main menu
Making the constructible MG42 nest [Top]
Generally speaking, making all the components for a constructible item is too much hassle to do from scratch each time.  So I use the Blue Peter method: "Here's one I made earlier".

By that I mean for things like constructible MG42s, Command Posts and Health & Ammo Cabinets, you just use a prefab made before, tweak it a bit to get the placement and names right, and away you go.  Saves tons of time.

So I will provide you a link to the MG42 map elements for you to import, which includes the script chunk you need to make it work.  The rest of the lesson will be devoted to explaining what the components are and what their settings mean, so you can reproduce them in your map as you need them.

Download the zip file, and unzip the script file to your maps folder, and the map file to your prefabs folder.  The script file is complete with the game_manager section too, so it can replace the previous tutorial.script file.

We'll deal with the import of the MG42 into the tutorial map first.

Run Radiant, open the map, and import the prefab_axis_constructible_mg42 - I saved this in the right place so that when you import it, it will already be placed on the roof of the house.  If your house is not the same dimensions, you'll need to drag the whole selection into place yourself.

Let's go through the components so you understand what you've got.

Shift+alt+click the large trigger cube.  This will select the large cube and a small cube within it.  The one within is the origin brush, which tells ET where the "middle" of the trigger is, regardless of the odd shape that a trigger brush can be.

Press N to see the details of the trigger.

This trigger is not a trigger_hurt, it is a trigger_objective_toi (Trigger Objective Info), which means it is used to determine when a friendly engineer will see the pliers hint.

This is an axis constructible MG42 we are making, so the axis_objective box is ticked.

The shortname is what gets displayed on the Command map.

The spawnflags is a number which represents the set of tick box settings you've chosen.

The target is the targetname of the entity to be constructed.  When the pliers-waving is done, this is the name of the procedure in the script that will get executed.

The track is the text that gets shown when a player enters the trigger volume, as in "You are near...".

The targetname is the name given to this toi.

You will see that axisconstruct_house_mg42 gets used as the common naming thread to join all the components together.

Close the entity window and press H to hide the trigger.  By successively selecting components and hiding them, you can be sure you have seen everything.

Press shift+M to filter out the models, making it easier to select the clip brushes of the crates.

Shift+alt+click the crate brushes.  If this doesn't select the brushes, keep doing it until it does.  You can see they will stop bullets with a wooden sound.

Press shift+M again to see the models again, and press N.

A script_mover entity has been used here, but in this instance this is a bit misleading, because the crates don't move.  The choice of a script_mover entity was simply a convenience and other entity types would have done.  This example for first taken from Goldrush and there's been no point in changing it.

What matters is that this is just a clip brush so that the players don't run through the crate models - remember models don't impede player or missile movement.

The solid box is ticked because this is a script_mover which by default also doesn't impede player movement.

The targetname and scriptname are both axisconstruct_house_mg42_clip.  Convention has it that if an entity is going to have a script (ie a procedure appear in the script file) then you make the procedure name (scriptname) the same as the entity name (targetname).  But just because an entity has a scriptname, it does not mean you necessarily have to have a script procedure for it.  In other words, no harm done by having a scriptname.

Close the entity window and press H to hide the clip.

Now shift+alt+click the crates model and press N.

This is the model of the crate boxes.  A skin ie a texture, is applied to the crates model to make them axis crates.

Models are not rotated in the map in the same way as brushes.  That is, if you try to rotate a model it won't do anything.  To adjust the angle of a model, you use the "angle" key and a value in degrees.  If angle is not specified, 0 (East) is assumed.  These boxes have been rotated 270 degrees.

The classname is misc_gamemodel rather than misc_model.

Use misc_model for any sundry model, no matter how big or small, that will just sit there and do nothing, like trees.
Use misc_gamemodel if the model needs to be referred to in the script.  There is an exception to this which will be covered later.

Close the window and press H.

Shift+alt+click the flag.  Press N.

This model is animated: the flag flaps in the breeze.  Hence the start_animate and frames settings.

The 360 degree angle seems pointless, but hey, that's how it is in Goldrush so I've left it alone.

Close the window and press H.

Ok, that's dealt with the crates side of the MG42.  Now select the red box which is the MG42, and press N.

I have given the MG42 a horizontal arc of 180 degrees, which allows it to spin completely round.  Normally the default arc is ok so harc is not specified

I wanted the built MG42 to face north, so I gave it an angle of 90 degrees.

Close the window and press H.

Shift+alt+click the clip brush that envelopes the sandbag models.

Press N.

The clip brush is a func_constructible, ie the subject of a toi trigger.

The MG42 + sandbags are to be built by axis, so the axis_constructible box is ticked.

The track in this instance is used by ET to tell it to consider anything else with the same track value to be part of the constructible.  So when the clip gets built, the models with the same track value undergo the construction with it.

Close the window and press H.  You are left with just 4 models.  Shift+click any of them.

You know enough now from previous explanations to be able to interpret the settings shown.

Press shift+H to reveal everything again.  Save your work and compile it.  Don't test it yet.

Including the script [Top]
When your script gets large, you would just copy/paste the axisconstruct_house_mg42 portion of the script supplied into your own script file.  For now I have supplied the whole script file for convenience.

Open the script file in Wordpad or similar.

You will see the MG42 script procedure.  I have commented what's going on throughout the procedure to help you start to understand scripting, but this is the gist of what happens:

  • At game start, the various MG42 components are set to their initial required state, eg the MG42 wants to start invisible.
  • The func_constructible can be destroyed by a satchel or dynamite (class = 2).  Class 3 would be dynamite only.
  • Once an engineer has waved his pliers long enough, the built final procedure gets executed, to bring the MG42 into being.
  • If the engineer started waving but doesn't finish in time, the decayed final procedure gets executed.
  • Finally if the MG42 is destroyed, the death procedure gets executed.

With your script complete, you are ready to test the map: make sure you can construct it as Axis, and destroy it as an Allied cov ops.

Next lesson