Multiple construction stages for func_constructible made easy


(mapperMango) #1

Making a multi-staged construction isn’t as hard as what some tutorials make it out to be. Here is how you do it:

Step 1: Draw the entire finished item out of brushes and texture them as you normally would with any other brushwork item. If it is a bridge then make the whole bridge. Models don’t work well for this as you would need the model in different stages of construction.

Step 2: Copy some of the item’s brushes to make the constages and desstages.

Step 3: Select the brushes that you copied to make the constages, right click, and select func_brushmodel.
Give it a scriptname and value, a targetname and value. These values are what the func_constructible uses for the constages and desstages. I think you can make as many stages as you want but I’m only doing two.

Here are the entries from the map file:


"classname" "func_brushmodel"
"scriptname" "bridge1" // no ; in these entries
"targetname" "bridge1"

Step 4: Select all the brushes that make up the finished item, right click, and select func_constructible. This is the “final” stage of the constructible.

Give it a scriptname and value, a targetname and value, track key and its value (“track” “the Bridge”).
The constages would be the scriptname from the func_brushmodel and make sure to put a “;” at then end of the value in the entity window.

Here are the entries from the map file:


"classname" "func_constructible"
"spawnflags" "8"  // this is an allied construct
"track" "the Bridge"
"constages" "bridge1;"  // notice the ; at the end of the name and notice it is only the one stage
"desstages" "bridge1;"  // the final is always the finished entity
"scriptname" "thebridge"
"targetname" "thebridge"

Step 5: Make 2 brushes and texture one as trigger and the other as origin, then select both and right click to make the trigger_objective_info. This goes around some sort of model or script_mover brushes where the engineer uses their pliers

Here are the entries from the map file:


"classname" "trigger_objective_info"
"target" "thebridge"  // this targets the func_contructible
"targetname" "thebridge_toi"
"scriptname" "thebridge_toi"
"shortname" "The Bridge"
"infoAllied" "The Bridge"
"infoAxis" "The Bridge"
"track" "the Bridge"
"spawnflags" "1"

Step 6: Finally, make some sort of item so the engineer knows where the trigger_objective_info is. It’s typical to use the crates and sandbags and they are in directory etmain\models\mapobjects\cmarker. I called mine bridgematerials_stage1 and bridgematerials_stage2. You’ll see those in the script.

Step 7: Here is the only scripting you need. You’ll need to tailor it to your own map with accums that would hold something like a tank or truck from passing, or maybe hold another area up in the map until its complete:


//***************************
// Bridge Construction
//***************************
thebridge    // this is the scriptname of the func_constructible
{
      spawn
      {
            wait 500   // wait a moment until all the items are loaded

            constructible_class 3  // the construct will take dynamite to destroy, 2 is grenade, 1 is anything
      }
 
      //-----------------------------------------------------------------------
      // Stage 1 is STARTING
      //-----------------------------------------------------------------------
      buildstart stage1
      {
            wm_announce "Allied are constructing the bridge!" // let everyone know the construction started
      }
 
      //-----------------------------------------------------------------------
      // Stage 1 is BUILT
      //-----------------------------------------------------------------------
      built stage1
      {
            setstate bridgematerials_stage1 invisible  // its built so make the sandbags invisible
            wm_announce "Bridge complete!  Reinforce it now!"  
      }
 
      //-----------------------------------------------------------------------
      // Stage 1 is DECAYED
      //-----------------------------------------------------------------------
      decayed stage1
      {
            setstate bridgematerials_stage1 default  // the engineer didn't finish the stage
            setstate thebridge_toi default
 
            wm_announce "Allied didn't complete the bridge!"
      }
 
      //-----------------------------------------------------------------------
      // Stage 1 is DESTROYED
      //-----------------------------------------------------------------------
      death
      {
            setstate bridgematerials_stage1 default  // someone destroyed the bridge
            setstate thebridge_toi default
 
            wm_announce "Bridge destroyed!"
      }
 
      //-----------------------------------------------------------------------
      // Stage 2 is STARTING
      //-----------------------------------------------------------------------
      buildstart final
      {
            wm_announce "Allied are reinforcing the bridge!"   // the final "whole" construction item is started
      }
 
      //-----------------------------------------------------------------------
      // Stage 2 is BUILT
      //-----------------------------------------------------------------------
      built final
      {
            setstate bridgematerials_stage2 invisible  // construction finished so remove the crates
            setstate thebridge_toi invisible
 
            wm_announce "Bridge Reinforced!"
      }
 
      //-----------------------------------------------------------------------
      // Stage 2 is DECAYED, go back to stage 1
      //-----------------------------------------------------------------------
      decayed final
      {
            setstate bridgematerials_stage2 default  // engineer didn't finish stage 2
            setstate thebridge_toi default
 
            wm_announce "Bridge not reinforced!"
      }
 
      //-----------------------------------------------------------------------
      // Stage 2 is DESTROYED, go back to stage 1
      //-----------------------------------------------------------------------
      destroyed
      {
            setstate bridgematerials_stage2 default  // someone destroyed the finished construction
            setstate thebridge_toi default
 
            wm_announce "Bridge damaged!"
      }
}

Just keep in mind that you draw the whole object first and then copy parts of it to make up the other construction stages. I hope this helps all of you that are struggling with a multi-stage construction.


(Crytiqal) #2

I would like to point out that for the decayed and destroyed stages you would/could need to create some rubble brushes too, right?

stage1 decayed rubble may differ (less decayed material) from the final destroyed rubble (whole bridge destroyed)

Also, wouldn’t the wm_announce differ per team? The enemy team wouldn’t make any sense to “Reinforce the bridge!”.

I don’t see in your script where you call the different stage brushes to become (in)visible?

You could add in the script that the stage1 can be destroyed as well, reversing the progress back to buildstart stage1


(mapperMango) #3

This is just the minimum to get two stages to work. If you want to put more into it such as rubble piles that is up to you. Just attach a script_mover to rubble looking piles and set it as needed. And then yes you would need to put the rubble piles in the script.


rubblePile
{
	trigger hide
	{
		setstate rubblePile invisible
	}

	trigger show
	{
		setstate rubblePile default
	}
}

“I don’t see in your script where you call the different stage brushes to become (in)visible?”

The game engine handles the transparency of the structure and what stage is what with constages and final. The materials that the engineer stands near to build the structure is in the script.


setstate bridgematerials_stage1 invisible  // its built so make the sandbags invisible

trigger rubblePile hide

I don’t think anything else needs to be said so good luck with your mapping!


(Mateos) #4

http://wiki.splashdamage.com/index.php/Construction_System#Multiple_Stages