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

ACS: 49:Glassbreak

Recommended Posts

How exactly does it work? I'm trying to make a pane of glass that shatters when shot, kind of like the ones seen in Hexen.

I've looked at the article about it in the ZDoom wiki but it wasn't much help.

So can someone who's gotten this action special to work, please explain what the did?

Share this post


Link to post

It seems pretty clear to me.

The GlassBreak special is used to create glass that breaks when the line is activated.

This is a special. So, you're wrong to think it's ACS. It can be used in ACS, sure, but it can as well be placed directly on a line. Just set that line's special to be 49 and there you go.

Normally you should set the line's activation type to projectile hits and the flags to impassible."

Even tells you the recommended settings. If you want it to shatter when shot, then use the "projectile hits" activation type so that this special is triggered when the line is shot. Seems obvious enough.

When this special is activated three things happen:

  • The line's switch texture state is changed (from on to off or vice versa) and the switch sound is played
  • The line's flags are changed to be non-blocking
  • If the passed parameter is 0 seven GlassJunk actors are spawned at the line's center (at the side the line is facing to)


The line is changed into non-blocking so that you can go through once it has shattered. Texture change (from glass to unbroken glass) is handled by making it a switch, so you need to define that in ANIMDEFS. Good thing you can also set the sound in ANIMDEFS, too, because you want it to sound like breaking glass. Finally, it'll spawn glass shards, so you need to look at what sprites the GlassJunk actor uses and provide them. That means three little sprites named from SHARD0 to SHARF0.



Really, it's not more complicated than that, and any explanation is just going to paraphrase what's in the wiki already. To be honest, threads like this are making me seriously wonder if "I've looked at the wiki but didn't understand it" aren't codeword for "I've been too lazy to look it up in the wiki but I'll pretend I have because I don't want to be told to RTFW"... :/

Share this post


Link to post

It seems I've extremely overcomplicated this one, thank you. I was under the impression that it was done through ACS scripting, but apparently I had it all backwards-ass.

Share this post


Link to post

In Hexen, they used ACS for that. The glassbreak special actually comes from Strife.

If you want to know, the Hexen method of making breakable glass is a bit cheat that involves instantly lowering or raising a sector. The broken glass texture is the mid texture, and the intact glass texture is the upper or lower texture. A drawback of the Hexen approach, other than it being more complicated, is that you cannot make the window translucent.

Share this post


Link to post
Gez said:

In Hexen, they used ACS for that. The glassbreak special actually comes from Strife.

If you want to know, the Hexen method of making breakable glass is a bit cheat that involves instantly lowering or raising a sector. The broken glass texture is the mid texture, and the intact glass texture is the upper or lower texture. A drawback of the Hexen approach, other than it being more complicated, is that you cannot make the window translucent.

Yeah and I have no idea why they did that either, considering ACS has everything you need to change the blocking and texture properties of a line anyway >_> Maybe they couldn't be arsed to allow 2S lines to block projectiles?

Share this post


Link to post

And perhaps so that those areas are hidden in the automap until the glass breaks? In my opinion, Raven began map creation long before ACS was ready.

Share this post


Link to post
DaniJ said:

And perhaps so that those areas are hidden in the automap until the glass breaks? In my opinion, Raven began map creation long before ACS was ready.


Even that could have been done by other means.

Share this post


Link to post

If ACS wasn't complete and the map designers needed to get on with their own jobs, I can totally understand the glass break being implemented the way it is.

Share this post


Link to post

Ok, I got the glass to break in the sense that it switches to a broken glass texture as intended, but I cannot get the glass shards to spawn.
I imagine it's something to do with the decorate code I used for the glass shards (see below)

ACTOR GlassJunk
{
	Height 16
	Radius 12
	Mass 5
	+NOCLIP
	+NOBLOCKMAP
	RenderStyle Translucent
	Alpha 0.4
	Health 1
	States
	{
		Spawn:
			SHRD A 128
			Goto Death
		Death:
			SHDD A 1 A_Fadeout (0.03)
			Wait
	}
}

I've looked at a couple different ones to see what they did, and it still won't work.

Right now I'm using a script that I adapted from the one found on this page

Share this post


Link to post

"GlassJunk" is an actor that is already defined in ZDoom. This means that you have to give your actor a different name - for example "MyGlassJunk". To have your new actor spawned instead of the already defined one, you must specify that by using "replaces GlassJunk".

Fixed DECORATE:

ACTOR MyGlassJunk replaces GlassJunk
{
	Height 16
	Radius 12
	Mass 5
	+NOCLIP
	+NOBLOCKMAP
	RenderStyle Translucent
	Alpha 0.4
	Health 1
	States
	{
		Spawn:
			SHRD A 128
			Goto Death
		Death:
			SHDD A 1 A_Fadeout (0.03)
			Wait
	}
}
I hope this fixes your problem.

Share this post


Link to post

Do you have appropriately-named glass shard sprites?

Share this post


Link to post
Xtroose said:

"GlassJunk" is an actor that is already defined in ZDoom. This means that you have to give your actor a different name - for example "MyGlassJunk". To have your new actor spawned instead of the already defined one, you must specify that by using "replaces GlassJunk".

Fixed DECORATE:

ACTOR MyGlassJunk replaces GlassJunk
{
	Height 16
	Radius 12
	Mass 5
	+NOCLIP
	+NOBLOCKMAP
	RenderStyle Translucent
	Alpha 0.4
	Health 1
	States
	{
		Spawn:
			SHRD A 128
			Goto Death
		Death:
			SHDD A 1 A_Fadeout (0.03)
			Wait
	}
}
I hope this fixes your problem.




I tried that but it just returns

Unable to find the DECORATE class 'GlassJunk' to replace, while parsing 'MyGlassJunk'


I've also tried naming it something entirely different like "GlassShard" thinking it would just use that, unless it's specifically looking for "GlassJunk".

But I wouldn't think adding a new actor would be that difficult. I've done it before with a crappy monster mod that I made about a year back.

@Gez: Do you mean in the file name itself or just what I name it in XWE? In XWE I renamed the file from SHARDA1 to SHRD, to stay within the 4 character limit. This didn't work, so I change the file name itself to SHRD as well and re-inserted it as a new sprite. This didn't work either.

Now that I think of it, is it possible that the reason it's not working is because it can't seem to find the orginal GlasssJunk Decorate script? Or does it not matter sense I'm basically making a new one anyway?

Share this post


Link to post

Which ZDoom version are you using? GlassJunk is an internally defined class so it has to be there if everything is installed correctly.

Also, what is giving you that error? ZDoom wouldn't even start if an invalid replacement is made - and the error would look something like:

Script error, "decorate.txt:DECORATE" line 1:
Replaced type 'blubb' not found in blah

Share this post


Link to post
Shadow Dweller said:

@Gez: Do you mean in the file name itself or just what I name it in XWE? In XWE I renamed the file from SHARDA1 to SHRD, to stay within the 4 character limit. This didn't work, so I change the file name itself to SHRD as well and re-inserted it as a new sprite. This didn't work either.

What.

SHARDA1 is indeed too long. But SHRD is too short; it should be SHRDA1. (Or SHRDA0 rather, since presumably nobody would bother making rotations for such sprites.)

Share this post


Link to post
Graf Zahl said:

Which ZDoom version are you using? GlassJunk is an internally defined class so it has to be there if everything is installed correctly.

Also, what is giving you that error? ZDoom wouldn't even start if an invalid replacement is made - and the error would look something like:

Script error, "decorate.txt:DECORATE" line 1:
Replaced type 'blubb' not found in blah


I was just using skulltag version 98d. But, my zdoom version is 2.1.5, I don't remember when I last updated it as I never really use it.

It pops up the error in doom builder 2 when I open the map.


@Gez : I'll try renaming it, and see what happens.

EDIT: upon testing the map in doombuilder skulltag returns an error saying "Script error, "VCTEX.wad:DECORATE" line 14:
Sprite names must be exactly 4 characters"

Share this post


Link to post

The sprite name. Not the lump name.


The lump name of a sprite is divided like this:

Sprite name: four alphanumeric characters
Sprite frame: one alphabetic character, or a either [, \ or ].
Sprite angle: one numeric character
[Optionally:
Mirrored frame: one alphabetic character
Mirrored angle: one numeric character]

So the lump name is 6 or 8 characters total, and the sprite name is 4 characters.

In your DECORATE code, you'll put something like SHRD A 5. That'll mean "five tics on the A frame of the SHRD sprite." In the lump manager, you'll have a lump named SHRDA0. That'll mean "sprite SHRD, frame A, all rotations".

Do not confuse sprite name and lump names, you don't use them in the same place! And you don't use them in the same way either; I've seen some people who assumed the DECORATE code should read "BLAH A 0" since their sprite was the BLAHA0 lump... No.

Share this post


Link to post

Bump.

Newbie question, but where do I input the parameter 0 to make shards appear? I still can't figure this out. Everything else is in working order but no shards. I haven't at least conciously put the parameter 0 anywhere.

    * The line's switch texture state is changed (from on to off or vice versa) and the switch sound is played
    * The line's flags are changed to be non-blocking
    * If the passed parameter is 0 seven GlassJunk actors are spawned at the line's center (at the side the line is facing to) 

Share this post


Link to post

The parameter it's looking for is in the Argument 1 field there, and it's already set to zero. I'd imagine that you don't have any shard sprites available to display, but that's just a wild guess.

Share this post


Link to post

The parameter thing is if you call it from ACS. It corresponds to the first argument.

The reason you don't see shards isn't because you failed to use properly the line special. The reason is because you messed up another of the steps that are already explained above in this very thread, namely providing glass shard sprites.

Share this post


Link to post

Got it to work, I thought Zdoom provided the Glassjunk sprites but after adding some sprites of my own it started working. Also, I copied the Zdoomwiki Glassjunk page and used the first three sprite names that apparently aren't used with the special. After renaming the sprites it worked like a charm.

Just in case other people have pondered with this with no results.

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
×