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

Breakable glass

Recommended Posts

How do I create destroyable glass in ZDoom? I tried using the GlassBreak action, but that didn't seem to do anything. Do I need to define a custom actor in the WAD?

Share this post


Link to post

Most if not all Breakable Glass (unless are decorate props) are ran via a script. This is one I used for my wad:

**NOTE** There are only two different Tags being used. For my example, 95 is the Thing that produces the glass breaking sound and the random glass shards while 106 is the linedef that's blocking the player and showing the middle glass texture

Setlineblocking(106, OFF); //NOTE Enables the player to walk through the linedef
int var1;
thingsound (95, "PILRGLSB", 127); //NOTE Used a 'MapSpot' Thing to play this custom breaking glass sound added via Slade 3
var0 = 20;
while(var0 > 0)
{
var0--;
SpawnProjectile (95, "PillarGlassShard", random(0, 255), random(10, 40), random(5, 20), 1, 0); //NOTE Custom Glass Shard added via Slade 3
}
setlinetexture (106, SIDE_FRONT, TEXTURE_MIDDLE, "-"); //NOTE Disables the texture, rendering the linedef seethrough
setlinetexture (106, SIDE_BACK, TEXTURE_MIDDLE, "-");
delay(10);
setlinetexture (106, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture (106, SIDE_BACK, TEXTURE_MIDDLE, "-");
delay(10);
setlinetexture (106, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture (106, SIDE_BACK, TEXTURE_MIDDLE, "-");
delay(10);
setlinetexture (106, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture (106, SIDE_BACK, TEXTURE_MIDDLE, "-");
delay(10);
setlinetexture (106, SIDE_FRONT, TEXTURE_MIDDLE, "-");
setlinetexture (106, SIDE_BACK, TEXTURE_MIDDLE, "-");


Instructions
1. You will need to create a linedef that you wish to be a breakable glass window
2. Only give the linedef a middle texture (best to have a window like texture)
3. Flag linedef as 'Transparent (25% opacity)', 'Block Players' and 'Doublesided'
4. For Activation tick 'When projectile crosses' and 'On Projectile Impact'
5. In action use number 80 'Script Execute'. Under Script Number put whatever number the script it
6. Compile the script and give it a shot. But you need to find custom glass breaking sounds and a glass shard sprite to add in your wad via Slade 3. Mine are called "PillarGlassShard" and "PILRGLSB" I got from a breakable pillar prop.

There are probably more efficient methods utilizing the ZDoom "Breakable Glass" function but I'm not sure how to use it.

Play Map09 - The Boss part in Map 09 of my Wad to see it in action. Needs Brutal Doom running with either GZDoom or Zandronum

http://www.mediafire.com/download/3ndkp3zm6rj8x8c/Op_UAC_GZDoom_Friendly.wad

Then dissect the scripts and see more examples.

Share this post


Link to post

All Breakable glass does is change linedefs impassible flag into non-impassable when the line is activated.

I use breakable glass quite a lot to create vent grates that can shot and it breaks. In order to change the grate from unbroken state to a broken state I use a custom switch texture.

http://zdoom.org/wiki/ANIMDEFS

Share this post


Link to post

Why haven't broken windows become simplified yet? They did it with portals, so why not with breakable windows?

Share this post


Link to post
illuknisaa said:

Script and and tag free linedef action is not simple enough?

It's way too advanced of a script for me to do.

Share this post


Link to post
Sgt Ender said:

Why haven't broken windows become simplified yet?

Possibly because only few mappers want to use them, possibly because nobody can think of a way how to properly simplify them.

Share this post


Link to post
Sgt Ender said:

It's way too advanced of a script for me to do.


"breakable glass" line action doesn't use any scripts. All you need to do is to make the line impassible, slap correct activation method and make glass switch texture.

Share this post


Link to post
illuknisaa said:

"breakable glass" line action doesn't use any scripts. All you need to do is to make the line impassible, slap correct activation method and make glass switch texture.

I mean with the shards.

Share this post


Link to post

Well I think chezza's method can be simplified if you use glass switch texture.

Something like

script xxx (void)

{
setlineblocking (...)
spawnprojectile (....)
}

should work.

Share this post


Link to post
illuknisaa said:

Well I think chezza's method can be simplified if you use glass switch texture.

Something like

script xxx (void)

{
setlineblocking (...)
spawnprojectile (....)
}

should work.

Still didn't work, here's the script.

#include "zcommon.acs"

script "glassbreak1" (void)
{
SetLineBlocking(1,BLOCK_NOTHING);
spawnprojectile(1,"GlassShardSpawner",0,0,0,0,0);
}

script "glassbreak2" (void)
{
SetLineBlocking(2,BLOCK_NOTHING);
spawnprojectile(2,"GlassShardSpawner",0,0,0,0,0);
}

All this did was make the wall unblocking. I made a switch definition and everything. I even made the script and new actors.

Share this post


Link to post

What is your animdef?
What is your decorate?
Do you have all the textures and sprites?

Wanna post your wad?

I just did it myself and it works like I expected.

Spoiler

animdef

switch GLASS on sound GlassBreak pic GLASSB tics 5 pic empty tics 2
decorate
ACTOR GlassShardPiece
{
  Radius 1
  Height 1
  Speed 15
  PROJECTILE
  -NOGRAVITY
  +THRUACTORS
  +MOVEWITHSECTOR
  Gravity 0.6
  RenderStyle Add
  Alpha 0.6
  Scale 1.3
  DeathSound "GlassShardImpact"
  States
  {
  Spawn:
     TNT1 A 0
     TNT1 A 0 A_Jump(255,"Standard") //Randomly selects a glass shard size.
  Standard:	
     PGSD ABCD 1
	 Loop 
  Death:
     TNT1 A 0 A_SetTranslucent(0.3)
     PGSD E 125
     Stop
  }
}

Share this post


Link to post

For the sake of people in the future searching the forums for the same question, please tell us the easier way you found.

Share this post


Link to post
Sgt Ender said:

spawnprojectile


That spawns a projectile from a THING with your given tid. In other words, it requires a mapspot thing as a point of origin to spawn your desired glass shards at.

Share this post


Link to post

HacX has a Cacodemon replacement for glass. And there's more realism in it to upon shooting it


You could make that thing a seperate thing, save it in a WAD, then load it as resources.

Or maybe something more simple, a shootable linedef that changes from an intact glass texture to a broken glass texture, while at the same time the linedef changes from impassible to passible. GoingDown used this trick.

No decorate required. Maybe dehacked.

On a different topic-what about the MAPINFO thing I PMed about?

Share this post


Link to post



Always go vanilla.

The triangle in the middle, highlighted in green should be raised up from the floor all the way up to the ceiling, creating a wall in the window frame. Both triangles highlighted in green have to be joined/merged together using Doombuilder. The triangle on the left not highlighted in green should have the floor and ceiling be the desired floor height, in this case it is 0. These are called "Control Sectors"

Linedef Type 24 will instantly lower the floor to 0 when shot, hiding the glass texture underground and allowing you to walk through the window frame. This is a trick used in most vanilla wads such as Eternal Doom and Epic 2 for destructable walls.

When the window is shot, the triangle will instantly lower to the ground. The red "broken glass texture" will be exposed giving the illusion of glass you destroyed. The flatter the triangle, the better the illusion will be.

Share this post


Link to post
40oz said:

Always go vanilla.


Unless you're already committed to using a source port that allows better options :)

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
×