How to make a Respawning Breakable Glass Window

In this tutorial I will show you how to make a Respawning Breakable Window


Step 1:First make a simple room with a light and an info player start then add a gun to have something to break the window with.Then make a window frame like this:


Step 2:Make a window in the frame and texture it with the bright glass texture.Tie to the window to entity func_button.
To make the glass transparent set:

rendermode
texture
fx amount
50


Ok to make the button do what we want,set:

angle
up So the window slides up into the wall
speed
5000 We want it to go up instantly
targeted object
br1 We'll get to this in a minute
health
50 We want the button to activate if shot
lip
-10 We want it to move all the way into the wall
delay before reset
30 We want it to respawn after 30 seconds to test.In a game maybe 1 or 2 minutes.



Step 3:ok now add 4 env shooters spaced out around the window.This is what will make the breaking glass and sound.Like this:

With these properties:

name
br1 these are the targeted objects of the button.When the button is triggered it will pop up and these will shoot broken glass
number of gibs
10 we want to shoot enough glass to make it seem like the window broke
gib life
20 We want them to disappear just a couple seconds before the glass pops back down
render mode
texture we want to make the gibs glass
fx amount
100 If we make them 50 you wont really be able to see them
model
models/glassgibs.mdl glass gibs model from the pak file
material sound
glass we want to have the breaking glass sound

In the flags be sure and check repeatable so we can reuse them.you should have a map that looks like this:


Additional Notes

When you compile it there will be a wall with a respawning breakable glass window.One thing that you might take into consideration is that the lighting will stay as if the glass is still there.So you may want to make the lighting the same on both sides of the wall.

EXAMPLE MAP

-9