Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Cyrez

Breakable glass trouble

Recommended Posts

Is there an way to do breakable glass without having to script each one? I have 300 plus windows to setup and i realy don't wan't to script each one :/

Share this post


Link to post

You can probably use the breakable glass out of Eternal Doom, I am fairly sure it is part of their retres.wad and can be extracted and used if you give them credit. It is based on a switch that when shot changes to the broken frame, not sure if it makes a sound too.

teamtnt.com

The return resources.
Look for retres.wad, or the retres.zip, it is something like 5 meg.

Share this post


Link to post

It shouldn't be hard to make one script work for every one. Let's try this:

script 1 (int arg0, int arg1)
{
    int var0;

    Floor_LowerInstant(arg0, 0, 16); // I'm assuming that the windows are 128 units in height
    do
    {
        Thing_ProjectileGravity(arg1, TID of the glass, random(0, 255), random(5, 40), random(0, 10);
        var0++;
    }   until(var0 == 20);
    var0 = 0;
}
arg0 is the sector tag number and arg1 is the mapspot where the glass comes from. Now then, in your trigger lines, add these two arguments to the triggers. For instance:

A line trigger with ACS_Execute(1, 0, 3, 6, 0) would activate script 1, but will lower the sector 3 window and spawn glass at mapspot 6.
Another line trigger with ACS_Execute(1, 0, 5, 8, 0) would activate the same script, but will lower a different sector and spawn glass somewhere else. This way, one script could be used for as many windows as you want.

Share this post


Link to post

good idea but it won't work for me. mine is like this

//Glass Scripts
script 6 OPEN
{
Setlineblocking(100,BLOCK_EVERYTHING);
TranslucentLine(100,100);
SetLineSpecial (100,80,100,0,0,0,0);
}

script 100 (void)
{
thingsound(100, "GLASS", 127);
SetLineSpecial (100,0,0,0,0,0,0);
Setlineblocking(100,off);
ACS_Execute(3,1);
setlinetexture(100, SIDE_FRONT, TEXTURE_MIDDLE, "CZGLS2");
setlinetexture(100, SIDE_BACK, TEXTURE_MIDDLE, "CZGLS2");
delay (const: 4);
setlinetexture(100, SIDE_FRONT, TEXTURE_MIDDLE, "CZGLS3");
setlinetexture(100, SIDE_BACK, TEXTURE_MIDDLE, "CZGLS3");
delay (const: 4);
setlinetexture(100, SIDE_FRONT, TEXTURE_MIDDLE, "CZGLS4");
setlinetexture(100, SIDE_BACK, TEXTURE_MIDDLE, "CZGLS4");
delay (const: 4);
setlinetexture(100, SIDE_FRONT, TEXTURE_MIDDLE, "CZGLS5");
setlinetexture(100, SIDE_BACK, TEXTURE_MIDDLE, "CZGLS5");
delay (const: 4);
setlinetexture(100, SIDE_FRONT, TEXTURE_MIDDLE, "CZGLS6");
setlinetexture(100, SIDE_BACK, TEXTURE_MIDDLE, "CZGLS6");
}

Share this post


Link to post

You could also make a transparent door (with glass texture) which opens when shot.
This'll work in vanilla doom.

Share this post


Link to post

Hehe, you want each pane of glass to break separately when they're all referenced exactly the same? It ain't gonna happen. You're going to have to differentiate the lines somehow from every other line and set up a generic script that takes a line number input etc.

Share this post


Link to post

Here's what I use. 2 scripts. 1 to set up the lines, another to break them. I make each breakable line a type 121 and give it an id number, then I put a map spot by the line to spawn the glass shards at. The map spot gets a tid that is the same as the line it is beside. I use one of the Hexen glass shard items, a sound called "glass" and a texture called "GLASS2" as the broken glass.

The examples quoted below are from a level that has the lines identified as 100 to 117

// script 1 set up glass

script 1 OPEN
{

int i;

for (i = 100; i <= 117; i++)
{
Setlineblocking(i,BLOCK_EVERYTHING); //Blocks the windows
TranslucentLine(i,128); //Makes them translucent
SetLineSpecial(i, 80,150,0,i,0,0); //makes them run script 150
}
}


//Script 150 smash the windows

script 150 (int id)
{
int var0;
SetLineSpecial(id,0,0,0,0,0); //Remove the special
thingsound(id, "glass", 127); //Make a sound
Setlineblocking(id,off); //Unblock
setlinetexture(id, SIDE_FRONT, TEXTURE_MIDDLE, "GLASS2"); //Make it look right
setlinetexture(id, SIDE_BACK, TEXTURE_MIDDLE, "GLASS2"); //Make it look right

delay(const:1);
var0 = 20;
while(var0 > 0)
{
var0--;
Thing_ProjectileGravity(id, 54, random(0, 255), random(10, 40), random(5, 20)); //Spawn shards (thing 54)
}
}


And I claim no credit for this, it's based on a script Randy sent me to improve my train level.

Share this post


Link to post
Scientist said:

You could also make a transparent door (with glass texture) which opens when shot.
This'll work in vanilla doom.

those usually don't look very good :P

Share this post


Link to post
Scientist said:

You could also make a transparent door (with glass texture) which opens when shot.
This'll work in vanilla doom.


Or with ZDoom, make a window that changes the texture from unbroken glass to broken glass, unblocks the line and makes a noise when shot. (a bit like the vents and consoles that you can smash in LTSD)

Share this post


Link to post
Ultimate DooMer said:

Or with ZDoom, make a window that changes the texture from unbroken glass to broken glass, unblocks the line and makes a noise when shot.

I believe that Cyrez is already planning to implement what you suggest. He really wants to know how to make hundreds of breakable windows without having to write hundreds of corresponding scripts.

Share this post


Link to post

Thanks all for the help. Enjays script works great so i have it working now. again thanks for the help :)

Share this post


Link to post
Ichor said:

(cool scripting stuff involving arg0 and arg1)


So that's what the special args are for. I could use that for my own breakable stuff (assuming special args can be used for lineid's as well).

Share this post


Link to post

Yes it can. In fact, I originally wanted to include that in this script, but I figured he didn't need that.

Share this post


Link to post
Rotting Corpse said:

I wonder of you can use the hexen stain glass?

Enjay said:

I use one of the Hexen glass shard items

:-)

You can use a number of Hexen special effect items - all you need to include are the graphics and you can spawn them into a doom game. Specifically they are...

Rocks are spawn numbers (41-43)
dirt (44-49)
stained glass (54-63)

Share this post


Link to post

*me puts the hexen stain glass windows in "The church of pain".*

Now that level looks like a church.Funny I didnt think of it before.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×