Breakable Glass: Build It, Script it, Break It

!Important Update! Krag has pointed out that you shouldn't need to script a break.
I tested this; he's right but you must use Dirty Glass or a custom texture with the 'Breakable' flag on.
Some people have had problems without scripting (don't know the reason) so I have left the trigger information in  just in case you need  it.  If you want the other events to happen (like an alarm going off) you'll still need the trigger.  First try going directly to Step 2, test it, and if it doesn't work add the trigger.

This is a 3 page section that covers all you'll need to know to put in breaking glass.
    Step 1: Putting a trigger on the Portal
    Step 2: Enabling the force field (make the glass) in scripting.
    Step 3: Script the glass to break.

The only assumption I'm making is that have Dallas up and running and that you know how to put your script into the .mn3 file.  I've even included the exact same files created as I went through the steps.  Glasstut.zip includes the .d3l, .cpp, .dll, .msg, and the .mn3 (yes, a packed it up and tested it just to make sure).

I recommend that you download the zip but only install the the .d3l file (the trigger's already in it).  Create the scripts yourself by following along as I go.

First of all (if you didn't know yet) glass is a force field at a portal.  The faces on both sides of the portal should be textured as glass.  If you want it to break you have to use Dirty Glass. There is a way to make other glass such as Mesh Glass breakable but that involves customize the .gam file.  I'll write up a tut for that in the future.  Let's get started.

Step 1:  Putting a trigger on the Portal
To the left is the is example level.  It's made up of three rooms . 

In the bottom left, I pointed out the portal number.  It shows us the  current portal is #0 (shows up purple) and that the current room has a total of 2 portals. You 'll have to know this when it's time to script.  Hit P on your keyboard and you'll see it cycle through the portals of the current room. 

Make sure the textures on both sides of the portal are Dirty glass.

It is also important that you name room in Current Room Properties.  I've named it 'center'.


 
To break the glass we have to have a trigger.  Go up to WINDOWS-TRIGGER. You get the dialog the to left. 

With the face of the portal highlighted, pick Add Portal To Current Face.  The dialog above appears.  Name your trigger.  You'll reference this when scripting for the break.

By sure to set the Activators to Player Weapon.  Your Triggers dialog should look like mine below.

Save the level and move on to Step 2.

[Main] [Next]