Ok here is a description of what to do to create a single stage construction from scratch. This description would be better if it had screenshots and a sample map but maybe someone else will do that …
This description assumes you have setup the editor, unpacked the pak0.pk3 file, know how the editor works, can pat your head and rub your tummy at the same time!
The map editor.
- Create a misc_gamemodel entity which will be the construction crates. Give the entity the following keys:
classname, misc_gamemodel
skin, models/mapobjects/cmarker/allied_crates.skin
model, models/mapobjects/cmarker/cmarker_crates.md3
targetname, construction_materials
- Create a misc_gamemodel entity which will be the flag. Give the entity the following keys:
classname, misc_gamemodel
skin, models/mapobjects/cmarker/allied_cflag.skin
model, models/mapobjects/cmarker/cmarker_flag.md3
targetname, construction_materials
angle, 180 (Facing direction)
modescale, 0.4
spawnflags, 2 (Animated)
frames, 190 (Total frames)
- Create a rough set of clip brushes for the construction crates and turn them into a “script_mover” entity. Remember to include an origin brush as well. All “script_mover” entities require a scriptname key to be defined regardless if used or not.
classname, script_mover
targetname, construction_materials
scriptname, construction_materials
spawnflags, 2 (This makes the script_mover solid)
- Create a Trigger_objective_info brush around the crates. This is the zone where the engineer has to wave his pliers about. Remember to include an origin brush as well.
classname, trigger_objective_info
targetname, construction_toi
scriptname, construction_toi
target, construction_target (Points to the func_constructible)
shortname, Construction MG (Command map name)
track, the Construction MG
spawnflags, 1 (This is constructible by Allied)
- Create your MG42 entity in the right location.
classname, misc_mg42
targetname, construction_mg42 (Needs to be different because of the repairmg42 command)
track, construction_track (This links all the extra stuff together)
accuracy, 0.5
angle, 90
- Create 2 sandbag models around the MG42 nest.
classname, misc_gamemodel
targetname, construction_extra
track, construction_track (This links all the extra stuff together)
model, models/mapobjects/miltary_trim/sandbag1_45s.md3
angle, 215
classname, misc_gamemodel
targetname, construction_extra
track, construction_track (This links all the extra stuff together)
model, models/mapobjects/miltary_trim/sandbag1_45s.md3
angle, 135
- Finally create the “func_constructible” brushwork entity. Usually this is the clip brushes around the sandbag models and some clipping around the front of the MG42 so people don’t fall into it. Remember to include an origin brush as well.
classname, func_constructible
targetname, construction_target
track, construction_track (This links all the extra stuff together)
scriptname, construction_script (The main script routine)
spawnflags, 8 (Allied construction)
Quick summary.
The func_constructible, sandbags and mg42 all have the same track key which lets the construction system know it all belongs together and needs to be constructed/destroyed together.
The mg42 entity needs a different targetname key because it is referenced directly in the script for the repairmg42 command. This command is needed so the mg42 is never built damaged.
The construction crates, flag, script_mover clip brushes all have the same targetname “construction_materials” so they can be treated as one entity in a manner of speaking. The script will treat all these components as one.
Finally the Trigger_objective_info entity is linked to the func_constructible.
The script.
construction_script
{
spawn
{
wait 200
constructible_class 2
trigger self startup
}
buildstart final
{
}
built final
{
setstate construction_extra default
setstate construction_mg42 default
setstate construction_materials invisible
// Some kind of UI pop-up to alert players
wm_announce "Allied team has built the construction!"
}
decayed final
{
trigger self startup
}
death
{
trigger self startup
// Some kind of UI pop-up to alert players
wm_announce "Axis team has destroyed the construction!"
}
trigger startup
{
setstate construction_extra invisible
setstate construction_mg42 invisible
setstate construction_materials default
repairmg42 construction_mg42
}
}
The code is an alternative way again of creating single staged constructions but instead of duplicating the same commands over and over again in each of the different functions. I use a single trigger function at the bottom of the routine which does the same stuff.
Sock
:moo: ing