Using dg_buildables



This tutorial assumes that you have basic knowledge of working with GTKRadiant and entities along with understanding of compiling, etc. If you have any issues with things you're unsure of please drop by the TRAM Design forums.

You'll need to download the Level Designer's Kit for the files included in this tutorial.


Introduction
Our plan originally was to make an entity that would make the generators possible, but after thinking about it we decided to take the much wiser path and make an entity generic enough to do it all. In turn we have the dg_buildable entity.

With the dg_buildable you have some serious flexibility and an endless range of possibilities. It allows you to do pretty much anything from having players fix broken switches that will allow them to operate doors, repair broken stairs so players can access a new area or possibly building defenses like bunkers. The best thing about the entity is that it's fairly simple and fun to use.

One of the most powerful features of the dg_buildable is that it's accompanied by new scripting events called heal, pain, attacked and captured. These events are linked to the health of the entity so that you can script what happens at every step as well as what happens when the entity is attacked by the enemy. Read on to find out how to use it.

NOTE: Before starting this tutorial you might want to load up a couple sample maps we've included called dg_buildable_switch and dg_buildable_door. Load them up in DeGeneration and test them out. You can find them with the rest of the Level Designer's Kit files.

Dg_buildable_switch - spawn as Axis engineer. Repair the switch with your pliers then when it's repaired, activate it to open the door. Switch to Allies engineer and dynamite the switch to make it unusable again.

Dg_buildable_door - spawn as Axis engineer, plant dynamite near the door to blow a hole in it. Then spawn as Allied engineer and repair the door with your pliers.


About the buildable
The first thing we need to do is to get to know the buildable and its related components. The two entities that are required to be involved are the dg_buildable and the dg_buildable_part.


DG_BUILDABLE
The dg_buildable is the entity that controls the main settings of the overall system. It declares what team owns it, whether it allows friendly fire and/or explosive damage only, dynamite damage only, if the entity is a generator or if you can rebuild it multiple times and this entity also controls the health settings of it all for both total and current levels.

Below are all of the available settings for the dg_buildable entity:

------ SPAWNFLAGS --------

AXIS_OBJECTIVE -- Set if owned by AXIS
ALLIED_OBJECTIVE -- Set if owned by ALLIES
GENERATOR -- Set to show the buildable on the compass as generator for the owning team
NOENGPARTS -- Set if engineer does not require parts to repair the buildable
BUILDMULTIPLE -- Set if allowed to build multiple times,
by default any targeting func_invisible_user are removed when buildable reaches 0 health
NOSERVERCONTROL -- Set to disallow server control of damage types etc

-------- KEYS ------------

"target" Name of the entity for targeting purposes
"targetname" Can be targeted for show/hide/alertentity/wm_set_objective_status <num> <targetname>
(See scripting definitions for details)
"scriptname" script section associated with this entity
"health" Starting health value
"healthtotal" Total Health the buildable can have
"healthcapture" Health must be below this value to be capturable, default -1 (disabled)
"delay" Minimum seconds between "attacked" script events
0 = never, defaults to 30 seconds
"damageflags" Add together damage values for types allowed, default = 21, shown as "*" on the list

1 *EXPLOSIVE
2 AIRSTRIKE
4 *DYNAMITE
8 FLAMETHROWER
16 *BULLET
32 FRIENDLYFIRE

----- SCRIPT EVENTS ------

pain <health> damaged down to <health>
heal <health> healed up to <health>
attacked Use for sounds etc from script to alert players to attacks
captured <team> The <team> has just captured this buildable. It now belongs to them


DG_BUILDABLE_PART
The dg_buildable_part is what does the work for the dg_buildable. If you're building a door, parts of the door would be dg_buildable_part entities. If you're building stairs then possibly each step would be a dg_buildable_part.

Here are the available settings for this entity.

------ SPAWNFLAGS --------

STARTINVIS -- Set to start invisible, use alert/show/hideentity script commands change it's state
OWNPOSITION -- Set if this part is targeted to a buildable entity and should use it's own positioning,
By default the part is positioned at the origin of the targeted entity at the start of the game

-------- KEYS ------------

"targetname" Name of this entity for scripting and alerting purposes
"target" targeting to a another entity of this name, usually a dg_buildable
"model2" path to optional model associated with this entity
"model3" path to model for optional alternate model, can be used for low detail etc
Use "setentitymodel" script action to change between index 2 and 3
"modelscale" set to scale the model in all xyz, default = 1,0, eg 0.5 would be half size
"modelscale_vec" per axis scaling, overrides "modelscale" if both set, default = 1.0 1.0 1.0
"angles" per axis angles, <pitch> <yaw> <roll>
"scriptname" script section associated with this entity


Getting Started
So what do you want to build? To be honest that's the hardest part about the dg_buildable entity. I find myself thinking of a good idea of something to build. Let's just make it something easy shall we? How about we build a furnace? We could make a damaged valve that's in need of repair and until it is the furnace will be offline. Yeah so it's not that great of an idea, but it'll work for the tutorial. Plus the Axis are cold anyway.

NOTE: If you need a map to start with for this tutorial I've included buildable_tutorial_1a.map for you to use. It's a room with a fairly boring furnace for us to start with. If you want to build it yourself just make any type of machinery looking setup with a couple pipes coming from it. Then place a valve somewhere in the setup at a height that players can get to.

Let's add a dg_buildable to your map.

1. Right click in GTKRadiant and select dg, then dg_buildable. You can put this entity anywhere in the map.
2. With the dg_buildable entity selected press "N" to bring up the properties window and let's give this entity some settings.
3. Check off the following spawnflags - axis_objective, noengparts and buildmultiple.

This is going to give us a buildable that can only be repaired by the Axis team, it doesn't require that the engineer has parts to build it and it can be built over and over.

4. Give the entity a key of targetname with a value of furnace_buildable
5. Give the entity a key of scriptname with a value of furnace_buildable
6. Set a key of health for 0 value and set a healthtotal key of 600

This of course sets the targetname and scriptname for us. A starting health value of 0 means that the dg_buildable is going to start in the destroyed state. A value of 600 for healthtotal means that it will take roughly one dynamite to destroy. 600 is the health the furnace will have when it's functional. (based on server setting of g_buildableExplosiveDamageScale "1.15")

It's simple so far right?


Let's now focus on the dg_buildable_part.

1. Highlight each of the parts like in the picture below in the sample map included:



2. Press "N" to bring up the property window, select dg_buildable_part and double click it. Now you have a dg_buildable_part entity in your map.
3. Check off the spawnflags for startinvis and ownposition.

What this means is that it will start invisible when the map starts. This way we can control when it's visible in the script by using the hide/showentity commands that we'll go over later. Checking off ownposition means that the dg_buildable_part will show where the brushes are located instead of where the dg_buildable entity is located. If you wanted you could leave this unchecked and set your own origin brush, but using the ownposition setting is surely much easier.

4. Give it a targetname of furnace_buildablepart1.
5. Then give it a target of furnace_buildable so that it targets the dg_buildable entity.

Just one last thing and then we're on to the scripting. We need to tell the map where engineers will be allowed to build it. We need to add the trigger.

1. Draw a brush around the valve, big enough so that it covers the value and extends a bit away from the value.
2. Texture it with common\trigger.
3. Make that brush a func_invisible_user by selecting it, press "N" and then double clicking the func_invisible_user entity in the list.
4. Now give the new trigger a target key with a value of the dg_buildable's targetname, Furnace_buildable. You should then see new target/targetname lines going from the trigger to the buildable entity.

NOTE: This brush is what controls the area in which the engineer can build the buildable. You might find that you'll want to adjust this later on for optimal building.


Here's how it looks:

Now we have finished the entity setup of the buildable. Wasn't that easy? Granted this won't work without a script, but the script is simple to make this work.

NOTE: The sample map included in the tutorial called buildable_tutorial_1b.map will take you right to this point if you haven't built your own map and/or are having issues.


Scripting the Buildable
The buildable entities work with a couple of new scripting events called heal, pain, attacked and capture. They're quite simple actually. Heal and pain both work with health values.

For instance if you placed an event in your buildable's script for heal 500 then that means anything in that section will be executed when the buildable reaches 500 health. It's nice because if you use it properly it will give the player the feeling that they are actually doing something. If you put an event in your map for pain 500 that will trigger whatever is in that section when the buildable goes below 500 health.

The attacked event is simply what will be done when the buildable is attacked. Your imagination is the limit here. You could make it do anything. The delay is 30 seconds by default, but you can change this in the dg_buildable entity by setting a delay key. You could use it to simply set an alarm or maybe if your buildable was a crash test dummy you could make stars spin around his head hehe

During this section we're also going to use two new DeGeneration scripting commands called hideentity and showentity. These are very simple and all they do is show and hide entities based on their targetname. While these commands don't work on every single entity they work on a good majority of them.

Let's start with a framework of a script. Copy and paste the section below into a script with the same name as your map.
 

furnace_buildable
{
    spawn
    {
        wait 500
    }

    death
    {
    }

    attacked
    {
    }

    heal 100
    {
    }

    heal 200
    {
    }

    heal 300
    {
    }

    heal 400
    {
    }

    heal 500
    {
    }


    heal 600
    {
    }

}
 

At the moment this script doesn't do much for us, but notice that it has a section for the dg_buildable using the scriptname we gave it earlier. The dg_buildable section furnace_buildable has a bunch of sections.

The first part of the furnace_buildable allows the entity to spawn. After the initial section you have many others. There is death, attacked, heal 100, heal 200, heal 300, heal 400, heal 500, and heal 600.

NOTE: Remember that we set the healthtotal to 600 so that's why it doesn't go higher. If we set the healthtotal to 700 then we would have a section for heal 700. Keep in mind though that this doesn't mean we couldn't have a heal section for 350 or 425 or even 276 if we wanted. The events get called by the entity's health level.

Death is of course what the buildable will do when it's destroyed, attacked as we said would trigger something to happen when the buildable is attacked and the heal (health) sections will determine what the entity will do when it reaches the health level specified.

NOTE: As we talked about earlier we could add pain events to the script and we'll do that later, but for now we're going to keep it simple.


Setting the State
In this case we're going to set the initial state to destroyed. If you remember from earlier we set the health to start with 0. If you wanted to make it start constructed then you'd set health to 600.

Initially being at 0 health and the valve being the buildable, we're going to want the valve not be shown. The way we're going to control this is by using the hideentity script command. Change the beginning of your script to look like the one below.

furnace_buildable
{
    spawn
    {
        wait 500
        hideentity furnace_buildablepart1
    }

What this does is make our dg_buildable_part invisible when the buildable spawns at the map's start. We don't need to do this since we set startinvis on the dg_buildable_part entity, but it doesn't hurt and I just wanted to show you that you could do this.

We want it to be shown again when it reaches full health. Let's add two lines to the heal 600 event section.

heal 600
{
    showentity furnace_buildablepart1
    wm_announce "The Axis have repaired the valve!"
}

This says that when the buildable reaches 600 health to show the entity again and show a message on the screen to all players stating that the Axis have repaired the valve. One more thing though. That's building, but what about destroying. We need to add our death event commands.

death
{
    hideentity furnace_buildablepart1
    wm_announce "The Allies have destroyed the valve!"
}

That will make sure that when the buildable reaches 0 health that it will hide the valve and it will broadcast the message to all players that the Allies have destroyed it. Our complete script should look like this:
 


furnace_buildable
{
    spawn
    {
            wait 500
            hideentity furnace_buildablepart1
    }

    death
    {
            hideentity furnace_buildablepart1
            wm_announce "The Allies have destroyed the valve!"
    }

    attacked
    {
    }

    heal 100
    {
    }

    heal 200
    {
    }

    heal 300
    {
    }

    heal 400
    {
    }

    heal 500
    {
    }

    heal 600
    {
            showentity furnace_buildablepart1
            wm_announce "The Axis have repaired the valve!"
    }

}
 

Let's give it a test. Make sure your script name is the same as your map name and spawn as an Axis engineer since Axis was set to own the buildable.

NOTE: If you'd like you can use the samples that I've included called buildable_tutorial_1c.map and buildable_tutorial_1c.script.
 

Let's Expand
Now that we have it working, we need to give it some life. Obviously having a valve that can be destroyed and built will do more than just disappear and reappear magically.

NOTE: If you'd like you can just onto the same page as me if you want by using the samples that I've included called buildable_tutorial_1d.map and buildable_tutorial_1d.script.
 

What do we want to do? Let's do each of the following:

1. show steam when the valve is broken
2. steam sound when the value is broken
3. show a puddle on the floor under the valve when broken
4. make steam and sound stop when built
5. make puddle disappear when value is built
6. make the valve being repaired do something

 

Let's get going on this!

1. Select the func_invisible_user surrounding your valve setup and tap "H" to hide it. We don't want it in our way for now.
2. Right-click on the 2d grid and select target from the list and under that target_smoke. Let's position that so that the valve is in the center of the entity and give the target_smoke the following settings:

Spawnflags: white & smokeon
Wait: 25
Targetname: steam01

3. Let's add the steam sounds. Right-click again and select target, but this time select the target_speaker under that and give it the following settings:

Spawnflags: looped_on & no_pvs
Noise: sound/world/steam.wav
Radius: 256
Targetname: steamsound

4. Now let's add our stain on the ground. Make a square brush under the valve maybe about 64x64x16 and texture it all with common/nodraw. Then texture the top with decals/oil slick and have it sit with the textured side at the same level of the floor. This will give us our stain which will add a bit of realism to it.
5. Highlight your newly created oil slick stain and tap "N". Then pick func_static from the list and double click it. Now the oil slick is a func_static. We do this so that we can hide and unhide it through the script. Give it the following settings:

Targetname: oil01

Now we have the minimum of things to make it seem realistic. Let's go on to the script.


Scripting the Advanced Buildable
At the start the smoke is going to start on (because of the spawnflag starton) and the steam sound will be going too (because of the spawnflag looped_on) The oil slick will also show by default (because we didn't choose start_invis).

So with our initial state being broken we don't need to change anything in the script for the spawn section. However we do want to make sure that when the valve is destroyed we get the proper effects. Let's look at the death section of our script.

At the moment this is what we have:
 

death
{
        hideentity furnace_buildablepart1
        wm_announce "The Allies have destroyed the valve!"
}


That's good for before, but now we want to make sure we get some nice effects. Just hiding the valve and saying it's been destroyed is a bit boring.


Let's go ahead and change it to what I have below.

death
{
        hideentity furnace_buildablepart1
        showentity oil01
        showentity steam01
        showentity steamsound
        wm_announce "The Allies have destroyed the valve!"
}
 

All we've done was told it that on death we want to show the oil, steam and steam sound.

Now that that's ready to go, what about when it's built? Surely we don't want the steam to show, or the sound to play or the oil puddle on the ground. Let's take a look at our heal 600 section.

heal 600
{
        showentity furnace_buildablepart1
        wm_announce "The Axis have repaired the valve!"
}

As with the old death section it's good, functional, it'll work, but kinda boring. Make yours look like the one below.

heal 600
{
        showentity furnace_buildablepart1
        hideentity oil01
        hideentity steam01
        hideentity steamsound
        wm_announce "The Axis have repaired the valve!"
}
 


This is going to do the opposite of the death sequence. When the valve reaches it's full health it'll hide the steam and oil puddle as well as stop the sound.

Go ahead and save your files, compile the map and test it out. Ahhh nice! I just tested mine out. You've got to love the way the steam thins out when it's complete and the way it rushes back in when it's destroyed.


Let's go even further
We are going to be setting off dynamite here… it just destroys a tiny valve? I think not. Part of the depth of the buildable is that you can trigger things to happen at different stages throughout the building as well as through the destruction.

Let's destroy things a bit shall we?

1. The pipes are an easy hit. There are three of them and they're very easy to mess around with. One by one let's select them one at a time, make them each func_statics, select the spawnflag for start_invis and give them all a targetname. Let's use targetnames of:

Pipe01
Pipe02
Pipe03

2. Now take one of the pipes and make a copy of it (select + spacebar). Then hit "V" and drag it a bit to make it bent. Do this for each one so that it looks liked the pipes are mangled as if hit by an explosion.
3. When you're done we want to make sure that the targetnames are set. Let's use the following targetnames:

For the copy of pipe01 use pipe01bent
For the copy of pipe02 use pipe02bent
For the copy of pipe03 use pipe03bent

4. On each of the bent pipes turn off the spawnflag for start_invis since we want the destroyed look at the start.

 

Jump back to scripting
Now let's use the pipes to give the player some indication that he's building. Let's quickly add our pipes to the death sequence:

Here's how it will look:

death
{
        hideentity furnace_buildablepart1
        showentity pipe01bent
        showentity pipe02bent
        showentity pipe03bent
        hideentity pipe01
        hideentity pipe02
        hideentity pipe03
        showentity oil01
        showentity steam01
        showentity steamsound
        wm_announce "The Allies have destroyed the valve!"
}
 

What this says is that when the valve is destroyed the bent pipes will show and the normal pipes will be hidden.

Now let's focus on the heal stages and to be more specific let's focus on heal 100, heal 300 and heal 500. Change them to look like what we have below:

heal 100
{
    hideentity pipe01bent
    showentity pipe01
    playsound sound/weapons/artillery_piece/breech_locked.wav
}

heal 300
{
    hideentity pipe02bent
    showentity pipe02
    playsound sound/weapons/artillery_piece/breech_locked.wav
}

heal 500
{
    hideentity pipe03bent
    showentity pipe03
    playsound sound/weapons/artillery_piece/breech_locked.wav
}
 


What this is doing is simple if you look at it. In heal 100 it's going to swap the bent pipe01 for the fixed one and play a sound. In heal 300 the same thing will happen with the pipe02 and with heal 500 pipe03. This should give at least a mild effect of repairing the furnace.

Let's save the files and compile
 

NOTE: If you'd like you can jump onto the same page as me if you want by using the samples that I've included called buildable_tutorial_1e.map and buildable_tutorial_1e.script.
 

We were attacked?
Let's say we were protective of our furnace, I mean after all if it was the middle or winter in Germany you'd be an upset Axis soldier if the heat went out. We would want to put an alarm on our furnace if it was tampered with. Let's do it.

We're going to change some a few things before we start so that it'll give us the full effect. Let's change the following things:

1. Highlight the dg_buildable entity and change the healthtotal key value to 1200. Changing the health to 1200 means it will take two dynamites to destroy it fully (based on server setting of g_buildableExplosiveDamageScale "1.15")
 

Now we move to the script and make a couple changes there.

1. In your script take each heal section and double the numbers. For example heal 100 will be 200 and heal 600 will be 1200.
2. Now let's just remove the heal 400 and 800 from your script altogether.

NOTE: Make sure you remove the whole part of the heal section or you'll get errors. We can't leave a { or a } behind!
 

Now let's get back to the attacked section.

We could easily do what we did earlier with the steam sound and use the showentity command with a target_speaker, but that's not going to teach us anything new since we already did that. Let's use scripting to do this.

Our goal is to tell our script to play an alarm sound if attacked, but if the furnace is repaired to the next highest heal level we're going to stop the alarm from sounding because of that point it should be under control.

Let's change our script a bit.

1. Let's change the spawn section of our script since we want to make it so that the alarm is sounding when the map starts. After all, the furnace will be destroyed and the Axis soldiers will have cause for alarm. Change it to what I have below:

spawn
{
        wait 500
        playsound sound/world/klaxon.wav looping
        hideentity furnace_buildablepart1
}

2. Now let's add in the attacked section so that when the buildable is attacked it will sound the alarm. Make it look like what I have below:

attacked
{
        stopsound
        playsound sound/world/klaxon.wav looping
}

3. Now for each of the heal (health) sections we're going to want to add the stopsound command. This will stop the alarm from sounding when that level is hit. For example:

heal 200
{
        stopsound
        hideentity pipe01bent
        showentity pipe01
        playsound sound/weapons/artillery_piece/breech_locked.wav
}

Go ahead and compile your map and save your script to see how it works. You'll notice the alarm sounds on map start and then once you repair the valve to 200 health it will silence. Then switch teams and you'll find as soon as you toss a grenade at it the alarm will sound again.

NOTE: If you'd like you can jump onto the same page as me if you want by using the samples that I've included called buildable_tutorial_1f.map and buildable_tutorial_1f.script.
 

Feel the pain
Now let's add a new section and a buildable event that we haven't used called pain. Pain is the opposite of heal meaning that if you make a section called Pain 600 then when the buildable drops down below 600 you will trigger that section to happen.

Now what can we do with this?

Well surely we can let the Axis know that the Allies have damaged the valve with at least a message right? Do we want to also create some effect to make it look like it's been damaged? Let's see what we can come up with.

Let's make this thing look like it was damaged, but let me warn you this part I'm going to breeze through. I won't be as descriptive with how to make things as I'm assuming you're fairly experienced.

1. Add some fire coming out of the bottom of the furnace as if it's spewing out from underneath it. Do it however you want
2. Select the fire and tap "N", select func_static in the list and double click it. Give it the following settings:

Targetname - fire01

3. Add in a target_speaker near the fire and give it the following settings:

Spawnflags - looped_on & no_pvs
"noise" - sound/world/fireloud.wav
targetname - fire01

4. Let's draw a trigger brush around the fire and make it into a trigger_hurt but selecting it, hitting "N" and double clicking trigger_hurt in the list. Give it the following settings:

Spawnflags - no_protection & slow
Targetname - fire01

5. Select the furnace base and let's hollow it out by going to selection, csg, make hollow.

NOTE: You'll want to take each brush of the furnace and adjust it a bit since there will be some overlapping brushes.

6. Now select the brush on the side that the fire is on and let's use the clip tool (hit "X") to cut the brush so that we can manipulate the panel nearest the fire. We're going to make the panel look as if it was damaged.
7. Once you've made the cut let's make that into a func_static like we've done earlier before and let's give it the following settings:

Spawnflags - start_invis
Targetname - panel01good

8. Take the panel you created in step 7 and copy it by selecting it and hitting the spacebar.
9. We're going to use change the angle of it by using the angle rotate tool so that the bottom of it comes out just a little bit. Enough for fire to shoot out underneath it. Feel free to make that panel damaged however you see fit!
10. Let's change the settings of this copy just a bit, go ahead and hit "N" with it selected.

Spawnflags - uncheck start_invis
Targetname - panel01bad

Let's get crazy and add some explosions for our fire/panel sequence.

11. Let's add two target_effects, place them near the panel/fire setup and give them the following settings:

Spawnflags - explode, smoke & debris
Type - metal
Targetname - explode

12. Now let's add in a target_relay to trigger the explosions and give it the following settings:

Targetname - explode01
Target - explode

For now I think that's enough since you're going to get the idea after this. Let's get ourselves over to the script and add in our pain event.


Scripting the pain

First let's work with our pipes. We should really make them so that if the buildable drops just below the heal levels they go back to damaged.

Let's make the following sections between our attacked event and our first heal event:

pain 200
{
}

pain 600
{
}

pain 1000
{
}

pain 1200
{
}
 

These will offset each of our heal events. Now let's add in the pipe action.

pain 200
{
    showentity pipe01bent
    hideentity pipe01
}

pain 600
{
    showentity pipe02bent
    hideentity pipe02
    wm_announce "The Allies have damaged the valve!"
}

pain 1000
{
    showentity pipe03bent
    hideentity pipe03
}

pain 1200
{
    hideentity furnace_buildablepart1
    showentity oil01
    showentity steam01
    showentity steamsound
}
 


Notice what we have is a reversal of what we had before. For instance, before when the furnace was healed to 600 health the pipe would be fixed. Now when it goes below 600 health the pipe will be bent.

Now let's setup the fire/panel/explosion sequence. This will be fun. Since 600 is our midway point in the buildable we're going to use that pain event to handle our explosion. Make your pain 600 event section look like the one below:

pain 600
{
        showentity pipe02bent
        hideentity pipe02
        hideentity panel01good
        showentity panel01bad
        showentity fire01
        alertentity explode01
        wm_announce "The Allies have damaged the valve!"
}
 

That will show the broken panel as well as the fire and cause an explosion while hiding the panel that's in good shape. Let's go ahead and edit the spawn section of our script to look like what I have below:

spawn
{
        wait 500
        playsound sound/world/klaxon.wav looping
        hideentity furnace_buildablepart1
        hideentity panel01good
        showentity panel01bad
        showentity fire01
}
 


Then let's make it so that when the furnace is healed to 600 or halfway that the fire stops and the panel is repaired.

heal 600
{
        stopsound
        hideentity pipe02bent
        showentity pipe02
        showentity panel01good
        hideentity panel01bad
        hideentity fire01
        playsound sound/weapons/artillery_piece/breech_locked.wav
}
 

Compile and check it out!

NOTE: If you'd like you can my finished and tweaked buildable by looking at the buildable_tutorial_1g.map and buildable_tutorial_1g.script.
 


Testing your buildables
You can test your buildables manually by jumping in the map as an engineer and building and destroying it or you can run your map in devmap or use other quicker methods that we've built in to make things faster.

If you decide to set your buildable to require parts, a quick way for you to test manually is to use the either the "give all" console command or the "give parts" console command. Each will give you three gears.

The new scripting commands called BuildableDebugInc, BuildableDebugTarget, BuildableDebug & BuildableDebugHealth were created to make testing the buildable entity much easier and faster.

Script example:
The four scripts below will allow you to build the buildable effortlessly and quickly instead of having to go through the motions. If you add these to your configuration file this is what they'll do:

*F1 - toggles between the buildable going up in 100 health increments or down in 100 health increments. This is the best speed we've found, any higher builds too fast and could skip heal/pain events.
*F2 - toggles between two buildables. This was originally created to test the generators, but we've replaced the generator targetnames (generator_axis and generator_allies) with the buildable targetname from this tutorial named furnace_buildable. You can of course change it to match yours.
*F3/F4 - changes health value of the targeted buildable to something specific ranging from 0-10000. F4 changes health upwards and F3 downwards.
*F5 - starts the debugging of the buildable.

NOTE: Keep in mind for F5 to start debugging you're required to use F1 and F2 to set what you'll be debugging. Without those settings you can't debug.


//changes from +100/-100 increments
set gdbug+ "BuildableDebugInc 100; echo ^2+100 enabled; set gdbug vstr gdbug-"
set gdbug- "BuildableDebugInc -100; echo ^2-100 enabled; set gdbug vstr gdbug+"
set gdbug "vstr gdbug+"
bind F1 "vstr gdbug"

//toggles axis-allies buildable
set gdbug_axis "BuildableDebugTarget furnace_buildable; echo ^2Axis generator selected; set gdbug_team vstr gdbug_allies;"
set gdbug_allies "BuildableDebugTarget furnace_buildable; echo ^2Allies generator selected; set gdbug_team vstr gdbug_axis;"
set gdbug_team "vstr gdbug_axis"
bind F2 "vstr gdbug_team"

//start-stop debugging
set gd_start "BuildableDebug; set gd_state vstr gd_stop"
set gd_stop "BuildableDebug; set gd_state vstr gd_start"
set gd_state "vstr gd_start"
bind F5 "vstr gd_state"

//raise-lower generator health
bind f3 "vstr health30"
bind f4 "vstr health70"
set health00 "BuildableDebugHealth 0;echo ^2Gen @ 0%;bind f4 vstr health10"
set health10 "BuildableDebugHealth 1000;echo ^2Gen @ 10%;bind f3 vstr health00;bind f4 vstr health20"
set health20 "BuildableDebugHealth 2000;echo ^2Gen @ 20%;bind f3 vstr health10;bind f4 vstr health30"
set health30 "BuildableDebugHealth 3000;echo ^2Gen @ 30%;bind f3 vstr health20;bind f4 vstr health40"
set health40 "BuildableDebugHealth 4000;echo ^2Gen @ 40%;bind f3 vstr health30;bind f4 vstr health50"
set health50 "BuildableDebugHealth 5000;echo ^2Gen @ 50%;bind f3 vstr health40;bind f4 vstr health60"
set health60 "BuildableDebugHealth 6000;echo ^2Gen @ 60%;bind f3 vstr health50;bind f4 vstr health70"
set health70 "BuildableDebugHealth 7000;echo ^2Gen @ 70%;bind f3 vstr health60;bind f4 vstr health80"
set health80 "BuildableDebugHealth 8000;echo ^2Gen @ 80%;bind f3 vstr health70;bind f4 vstr health90"
set health90 "BuildableDebugHealth 9000;echo ^2Gen @ 90%;bind f3 vstr health80;bind f4 vstr health100"
set health100 "BuildableDebugHealth 10000;echo ^2Gen @ 100%;bind f3 vstr health90"

 

Conclusion
Hopefully this guide has made it easy for you to get started making buildables. If you have questions or issues please drop by TRAM Design ( www.tramdesign.net ) and/or the forums at http://www.tramdesign.net/cgi-bin/ultimatebb.cgi

You'll find that there are tons of things you can do with this entity. We've only covered the simplest of things. Make sure you take a look at the buildable tutorial maps and buildable samples to get an idea of what other things you can do. We hope you explore the possibilities.

Copyright © Tram design - All Rights Reserved Legal Notices