Breakable Boarded Door

Tutorial collection, comprehensive listings on main site.

Breakable Boarded Door

Postby Tutorial on Wed Jan 03, 2007 8:42 pm

category
General Half-Life 2/Entities

description
Learn how to create a barricaded door that will open when the wooden boards are broken.

keywords
breakable, break, board, boarded, door, doors.

Introduction

This will be divided into 10 sections:

1. The Room, 2. The Wall, 3. The Door, 4. The Boards, 5. The Math, 6. Back to the boards, 7. Finishing, and 8. How and Why it all works 9. Notes 10. Have Fun!

I wrote this to be a very simple, baby step tutorial for semi-newbs to introduce the math_counter entity and to create a cool effect that will annoy the player. It also explains the clip tool. There are lots of pictures.

Tutorial
In alot of games you will find the evil loop: you start in one room, pass a locked door or other obstacle, play for about fifteen minutes and then realize your on the other side of that door. Alot of people find this frustrating "why couldn't I just open that door!" That's why I use it.

We are going to make a door that is all boarded up. As soon as you break the boards, the door will be unblocked and openable. First, we need

1. The Room
I'm not going to tell you how to make a room, it's easy, and if your thinking about making this effect you know how already, but here's a picture just for kicks.

Image

Next up...

2. The Wall
Click the brose textures button and find the one called dev_measuredoor01. Use this texture as a guide to make a door frame, just make a block with it and use the dimensions on the texture to make an upside down U and set the frame into a wall. Make sure to make the door frame a func_detail.

Image

3. The Door
Create a prop_door_rotating click World Model on the left and then Browse on the right. Select the model door_01left.mdl, click the Skins tab on the right and select an appropriate skin, I used the first one. Click Ok on the Model Browser and then apply on the prop_door_rotating dialog.

Image

Give the prop_door_rotating a name, as an example I'll use blockeddoor. Click Flags and check Starts Locked.

Image Image

Now position the door in the frame, it fits perfectly.

Image

4. The Boards
Make a block 128 high by 128 wide by 2 thick textured with woodfloor008a. Make sure the brush is selected, and open the Face Edit Sheet under Justify click C. This is the result:

Image

Now, click change grid size buttons until the brush is 8 grids high by 8 grids wide as shown above in the bottom left view. This means that each grid represents 16 units, which is the width of each board represented by the texture (8 total). Use the clip tool to clip along each horizontal line, making sure that the outlines stay white before clipping, so nothing is delted. If any part of the outline is red click the clip tool button until the outline is all white. This is what it should look like when your done and each piece is selected:

Image

Now, tie each piece to its own INDIVIDUAL func_breakable entity. Give each func_breakble the wood property under Material Type:

Image

You should notice that because we started with a larger properly aligned texture, each func_breakable looks different. Here comes the fun part! Copy one of the breakables and resize it, but don't make it any taller or it will look like too different boards. Shorter in both dimensions is good, or you can leave it as is either way its fine. Move the func_breakable in the Top View over the door frame. Notice how in the picture below the door frame is wider than the door, and the wall is wider than the frame, each by either 2 or 3 units? This is on purpose. Shorten the func_breakable so that it lines up with the inside of the door frame, move it so that it touches the door model, and move it up or down relative to the ground into a spot you like. The picture helps alot:

Image

Now, keep repeating this proccess until your door is covered (but not completely!) in boards. Try rotating them too, but make sure that the wide side stays flat againt either the door, the frame, or the wall, and that it doesnt penetrate any of these. If the board is too long or short after you rotate it, please undo your rotation before lengthening or shortening it, then rotate again. I used four layers of boards, one inside the frame, one inside the walls, one on top of the last layer (inside the walls) and one against the walls. Don't worry about the outside layer not touching the layer between the walls, it's only one unit and because of perspective you won't be able to tell in game. Also notice how each board has a different look, this is because I used different func_breakables for each:

Image

Experiment until you find a look you like!

5. The math
Ok, now to make it all work together. Create a math_counter entity, it can be anywhere in the map, but I put it close to the door so it's easy to find if I need to make changes. Now give the counter a name, and set the Maximum Legal Value to the number of boards you used on the door. I made ten boards so I put 10 there

Image Image

Then click the Outputs tab and Add a new output named "OnHitMax". Use the little eyedropper to select the door for Target Entities Named, and then set Via this Input to Unlock.

Image

6. Back to the boards
Now, select all the boards covering the door and click the Output tab click Add. Set My output named to Break, then using the eyedropper select the math_counter to use its name in the Target entities named property, set Via This Input to Add, and set With a parameter overide of to 1.

Image

7. Finishing
Set you door properties, move sound, speed, etc. whatever you want, just dont uncheck that starts locked flag! Also I put each object/group of object (door, boards, room, etc.) into it's on VisGroup so I can toggle on and off whether I see it in Hammer, you don't have to if you don't want to but it really helps in big and complex maps. Oh, and don't forget to put in an info_player_start entity with a weapon_crowbar entity going right through his midsection. Now, it won't impale him ;-) , but it will make the player start this little example level with a crowbar so he can smash his heart out.

8. How and Why it all works
Every time you smash one of the boards it triggers it's break output and adds 1 onto the math_counters value. Since the math_counter starts at 0 (although it can be set to other numbers) once all boards are borken it will have a value equal to the number of boards. The OnHitMax output is automatically triggered once the Maximum Legal Value is reached, which, since it is set to the number of boards, occurs when all boards are broken. The OnHitMax output triggers the door to unlock, allowing it to be opened thus, when all boards are broken, the door can be opened!

9. Notes Instead of func_breakables you can set the boards to func_physbox entities and use constraints to keep them in place, so that you can use the gravity gun can pick them up as well as being able to smash them, it's more complicated any hey, the boards are nailed down right, so how could you pick them up? Also, you can make a nailhead decal to put on the boards, it will dissappear when they break. If you want the door to open automatically when the last board breaks, add another output to the math_counter: Named: OnHitMax, Target: the door, Via Input: OpenAwayFrom

Example Map can be downloaded here

10. Have Fun!
Have fun!

-Mr Happy
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby Rasirez on Sat Feb 10, 2007 11:25 pm

Nice man, just learned some valuable info right here - could even be used for a generator, like break the three columns and it self-destructs for example.

Sweet!

-Rasirez
Rasirez
Regular
Regular
 
Joined: Tue Nov 28, 2006 6:19 pm
Location: Voyager

Postby Simon on Sun May 20, 2007 12:51 pm

Thanks for the tutorial.
Simon
Pheropod
Pheropod
 
Joined: Wed Jul 20, 2005 11:00 am
Location: Belgium

Postby Sauce on Tue May 22, 2007 10:29 am

a few spelling errors but it definitely conforms to my style of tutorial writing :D

Nice work, it's good to see people putting lots of effort into these things so that newcomers can learn things easily.
Image
Blink wrote:Do you watch porn and decide you don't need to have sex because you've seen the ending? :-D

zombie@computer wrote:what retarded countries measure in stones anyway?
or feet? or inches? Your dick is a lot longer in cms
User avatar
Sauce
Senior Member
Senior Member
 
Joined: Sat Nov 26, 2005 4:36 am
Location: Australia

Postby daap on Tue May 22, 2007 11:27 am

great and usefull info!
thanx
Image
a fR0n is A smiLe up-sIde d0wn...
User avatar
daap
Been Here A While
Been Here A While
 
Joined: Mon Apr 16, 2007 12:49 pm
Location: Leeuwarden / Terschelling. Holland

Return to Tutorials

Who is online

Users browsing this forum: No registered users

cron