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

How to make breakable glass (hexen format) in Doom Builder.

Recommended Posts

if anyone ends up googling "how do i make breakable glass in doom hexen format doom builder" I would like to help you.

here is how it is done. (this isnt as long as it looks, im just a long winded idiot).


HERES THE CODE. like pow!

script 1 (void)
{
		Setlineblocking(107,OFF); //this line here removes all line specials.  
		int var0; //i dont know, but enjay put it in there and he is your god so it stays.
		thingsound(80, "glass", 127); //this plays the sound of the glass breaking.  (change this to whatever you glass sound is)
		var0 = 20; //i dont know, but enjay.
		while(var0 > 0) //while its doing some shit, this plays this part of the shit.
		{
		 var0--;
		 SpawnProjectile (80, "NJGlassShard", random(0, 255), random(10, 40), random(5, 20), 1, 0); //this spawns your particles.  (rename to whatever you use.
		}
		setlinetexture (107, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh01"); //this loads the breaking glass frames. all four of em.  if youre confused, find enjays glass breaking demo, and all of it is contained inside his resource.  its good shit too.
		delay(10);
		setlinetexture (107, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh02");
		delay(10);
		setlinetexture (107, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh03");
		delay(10);
		setlinetexture (107, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh04");
		delay(10);
		setlinetexture (107, SIDE_FRONT, TEXTURE_MIDDLE, "-");		
}


script 2 OPEN //this is what sets your line up for translucency and makes it await sweet sweet breakage.
{
TranslucentLine(107,40); //what makes it translucent.
SetLineSpecial (107,ACS_Execute,1); //what makes it call on the first part of the script to initiate smash-age.  
}


okay, so this was taken from enjays resource...i had to edit it, because when a projectile was hitting the line...nothing effing happened and i was freaking out. so i had to make script 2 call on script 1.


now when you see "107" that is referring to the linedef. (if you dont know what that is get out of here...or just google.)
when you see ACS_EXECUTE, that means "play the damn script" in this case its script 1. (script is a fancy way of saying code...play the code contained in section 1)
when you see the number 80 it is referring to the mapspot that you place to spawn breaking glass.

lets get this out of the way.
MAP SPOTS. theyre in doom builder, and you just drop them into the map, you then highlight them and with the scroll of a mouse change their height. they are imperative for this to work...in a radical way. if you want things to break properly...and effectively and cool like...and you want particles, you will need to define them. included is enjays link (at the bottom) with a killer glass breaking particle. i took the liberty of editing them slightly so that they laid on the ground for a while and flew out with less of a "am i in space!?" look. i think its tight, youll think its tight. the code is here.
Spoiler

//this was taken from enjays glass breaking demo called smashUDMF. if you use it, credit him. i (cortlong50) simply edited it.

ACTOR NJGlassShard : GlassShard
{
Radius 5
Mass 5
Projectile
-ACTIVATEPCROSS
-ACTIVATEIMPACT
+DOOMBOUNCE
+FLOORCLIP
BounceFactor 0.5
BounceCount 4
Renderstyle Translucent
Alpha 0.4
Scale 0.4
Speed 100.0
Gravity 4
States
{
Spawn:
NJGL ABCDE 4
Loop
Death:
NJGL E 500
LCPJ A 0 A_Jump (256, "Vanish")
Loop
Vanish:
TNT1 A 0
Stop
}

}

okay...so heres how it is done.

draw a line, give it lineID (editor code 121) and leave the arguments blank you little effer. then assign that line a tag..whatever you want...call it 69 if you want, i dont know what youre into (i would give them 107 if you want to just drag and drop this script). now set the line so that it blocks everything and is double sided and is activated when a projectile hits or crosses over it. this is where i got stuck. BE SURE TO DO WHAT I JUST SAID OR YOULL BE ELBOWING YOUR COMPUTER IN PURE UNADULTERATED ANGER AND YOUR WIFE WILL LEAVE YOU AND YOU WILL GET ADDICTED TO CRACK.
now set the middle texture ON ONE SIDE to "ZRIONGLS".
then place mapspots along the line (i run them facing different directions so that it shoots shit all over the place). this is important...assign these mapspots all the same tag. (give them 80 for this demo).

now...did you set your line to 107? good! did you set your mapspots to 80? perfect.

that way when a projectile hits this line, it sends the glass into an animated state (does a breaking glass animation) and shoots shit all over the place and makes your map the coolest thing anyone has ever seen because you just a 20 year old game and gave it an interactive world.

and you learned some ACS along the way. and when you get it done youll feel like the man and youll think women will want you. they wont but its still a pretty good feeling.
if you have any questions just ask.



here is also the link to the wad version of enjays resource...look at his work in a map editor and see how it is done if you have any questions. you can also email me anytime.
i think its time i contribute to this community instead of just asking it stupid questions. so here you go. i hope i can help someone because all the information i got was cryptic or wrong. i know its alienating...but copy and paste this and use your brain and youll be impressing all the doomers with your super sweet coding skills in no time. earning you doom credits...which expire immediately and nobody treats them like real currency.

(this is a link to the wad that contains his resources, they were in pk3 format and i have dumbed them down for you, thank me later. http://www.mediafire.com/download/r53dv589xn4mcro/smashhexen.wad

(this is the forum post that he made) http://forum.zdoom.org/viewtopic.php?f=3&t=21885&p=809641#p809641


A FEW THINGS TO NOTE.
1. you need the resources in your wad, get em, copy and paste em into the wad, then copy and paste the decorate into your decorate lump. if you dont know what im talking about take a big step back and reevaluate your life. you can still turn away from dooming now, if you learn how to use slade and decorate...youre screwed. thats the bottom line. but seriously...do what i just said. its simple and if you dont know what im saying or it sounds hard you need to either google..or wiki, or just put the computer down. im basically handing you everything.

2. you need the textures and the sprites in your wad. (place the sprites between an S_start and S_end markers. put the textures between a tx_start and tx_end markers). important.

3. the way into script editor is in doombuilder/gzdoombuilder, and what youll do is click on view and on the bottom there is a thing called "script editor" click on it. like duh. then copy and paste the code supplied into there, then click the button on the top furthest to the right (compile). from there do what i said and youll be golden.

4. if you get confused, i have commented nearly every line of the script to help you understand what the hell youre doing. be sure to pay attention.

5. this will absolutely not work in any other format (map format...remember when you did that...on your map when you started?) than HEXEN format. if you want to know UDMF format breaking glass, the forum post from enjay i included goes over it. its just slightly different, but you can dissect that all you want. THIS IS FOR HEXEN MAP FORMAT ONLY FOOL.

Share this post


Link to post

Nice post, I laughed a little, cried one manly tear, and just might have learned something in the process.

Personally, I've always preferred Hexen format, but I'm just a hermit sticking his head out into a city of traffic. This will be useful to me at some point, I'm sure.

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
×