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

how to...transparent window breakable ?

Recommended Posts

Okay , I have a very good time whith the leaf trick :D thx enjay+cyb.
Now ,I know transparent breakable window can be made using zdoom via scripting..But don't know how...Can someone help?

Share this post


Link to post

I thought I can understand the script,but I failed :/.
I replaced the "brokenwindow" tex by another one using wintex,
But I can go trhough the window...So I changed to impassable..
but you can't destroy the window....
I suspect I miss tag lines, but don't know exactly seems, heh i am a newbi :D

Share this post


Link to post

Dont set it "impassible", instead, set the flag "blocks everything".
Plus, you must set the line to trigger this script when a "projectile hits line". How to set that depends on the editor you are using (always handy to be familiar with the programs you use ;).

Share this post


Link to post

gherkin, using Wadauthor, I have no "blocks everything" flag,
I got "block ennemies" or "block sound"

Share this post


Link to post

You have to give the line a special


(Shoot once) Set LineID (x, 0, 0, 0, 0)

where x is a tag number. This is the only way to put a tag on a line. If you need both a tag and a special you have to define the special in a script.

Now you have do declare an OPEN script with the following commands

setlineblocking(x, BLOCK_EVERYTHING);
setlinespecial(x, 226 /*ACS_EXECUTEALWAYS*/, y, 0,x,0,0);
y is the number of the script that handles the broken window. x is the same number as set above. Note the use of ACS_ExecuteAlways, not ACS_Execute. If you have two smashable windows close to each other it is possible with ACS_Execute that only one is smashed although both are hit.

Your main script should look like the one The Ultimate Doomer posted.
Note that the line's id (tag) is passed as a parameter so this one script can be used for any smashable window in the map (as long as the same texture is used). You just have to add the abobe 2 commands to the open script for every line you want to use it on.

Share this post


Link to post

Graf Zahl, thanks now I got a breakable windows,
but there is not transparency...And since the line
is set as "special line set ID" I can't put it on "special transparency"-Well ,it seems this transaprency can be activated by script...But don't know how to do that.

Share this post


Link to post

setlinespecial(x, 208, trans);
special 208 is translucentline(), x is the line id number

trans is the amount of translucency from 0 - 255, 255 being not translucent (opaque), 0 being nearly invisible. I usually use 64 or 128 depending on the window texture

Share this post


Link to post

Hummm transparency is not working....Dunno why..
I post the code I have:

script 101 (int arg0)
{
setlineblocking (arg0, off);
setlinetexture (arg0, SIDE_FRONT, TEXTURE_MIDDLE, "AG128_1");
sectorsound ("smashsound", 127);
}



script 105 OPEN
{
setlineblocking(105, BLOCK_EVERYTHING);
setlinespecial(105, 226 /*ACS_EXECUTEALWAYS*/, 101, 0,105,0,0);
}


script 106 OPEN
{
setlinespecial(105, 208, 128);
}

Share this post


Link to post
cactus said:

Hummm transparency is not working....Dunno why..
I post the code I have:

script 101 (int arg0)
{
setlineblocking (arg0, off);
setlinetexture (arg0, SIDE_FRONT, TEXTURE_MIDDLE, "AG128_1");
sectorsound ("smashsound", 127);
}



script 105 OPEN
{
setlineblocking(105, BLOCK_EVERYTHING);
setlinespecial(105, 226 /*ACS_EXECUTEALWAYS*/, 101, 0,105,0,0);
}


script 106 OPEN
{
setlinespecial(105, 208, 128);
}



That won't work.
You have to do it as follows:

script 105 OPEN
{
setlineblocking(105, BLOCK_EVERYTHING);
setlinespecial(105, 226 /*ACS_EXECUTEALWAYS*/, 101, 0,105,0,0);
translucentline(105,128, 0);
}
128 means 50% translucency (255 is opaque, 0 is invisible).
The second parameter specifies the translucency mode.
There are 0 ('normal' translucency) and 1 (additive). For a windows you should use 0.

The code you have written tries to set two specials on the same line which doesn't work. One will always override the other. Plus, the translucency special cannot be put on a line after the map has started. It is executed only on startup of the level if on a line. If you want to change translucency during the level you have to use a script.

Share this post


Link to post

Hey ,now that s working i want more,
I want littles piece of glasses when you break the window,
Enjay made it on some of his maps.....
Any clue of how it works anyone?

Share this post


Link to post

Yes, I know. :-)



The Hexen glass shards, dirt clumps and rock pieces can all be spawned into a Doom game. All you need to do is provide the graphics. Then you just spawn them as projectiles. I made my own graphics to replace one of the hexen glass shard pieces, and only spawned the one I made, not the full range. Then I used an adaptation of the script in hexen.wad

Here's what I did:

script 2 OPEN
{
	int i;

	for (i = 201; i <= 211; i++)
	{
		Setlineblocking(i,BLOCK_EVERYTHING);
		TranslucentLine(i,128);
		SetLineSpecial(i,ACS_Execute,3,0,i,0,0);
	}
    	
}
This is a nice easy way to set up loads of windows using 1 script (Randy Heit showed me how to do it). It's the int i; stuff allows you to set up all your windows with one script. The numbers 201 - 211 tell the script to do things to lines with line ids of 201 to 211 and sets each line in that range up to block everything, be translucent and to run script 3. You could just as easily have done:
script 2 OPEN
	{
		Setlineblocking(201,BLOCK_EVERYTHING);
		TranslucentLine(201,128);
		SetLineSpecial(201,ACS_Execute,3,0,i,0,0);
	}
But then I would have to repeat the entries for lines 202-211

Anyway, you got that far - its the smashy glass pieces you wanted to know about.
script 3 (int id)
{
	int var0;
	SetLineSpecial(id,0,0,0,0,0);
	thingsound(id, "glass", 127);
	Setlineblocking(id,off);
	setlinetexture(id, SIDE_FRONT, TEXTURE_MIDDLE, "NJWIN3A");
	setlinetexture(id, SIDE_BACK, TEXTURE_MIDDLE, "NJWIN3A");
	delay(const:1);
	var0 = 20;
	while(var0 > 0)
	{
	 var0--;
	 Thing_ProjectileGravity(id, 54, random(0, 255), random(10, 40), random(5, 20));
    }
}
The 1st line sets up a script variable
The 2nd line switches the line special off - not necessary, but I like to use it
The 3rd line makes a predefined sound from my sndinfo at a map spot
The 4th makes the line non blocking
The 5th and 6th make the window look broken using texture njwin3a

Exactly how the next piece of jiggery pokery works I'm not sure. Essentially what I think it is doing is using a script variable (var0) set to 20 to repeat the process of spawning a glass shard. The variable is decreased by 1 (var0--;) and that section of the script repeats until the variable is 0 ( while(var0 > 0) ) Thereby instantly spawning 20 shards.

The projectile line spawns projectile type 54 (the shard) at a map spot at a random angle at random speed and random vertical speed (all within defined parameters). This line gets repeated 20 times (or whatever value you set var0 to) so 20 shards get spawned flying all over the place.


You'll notice the script uses "id" instead of actual numbers. This allows the line id number to be passed to the script and used as a parameter within the script. This is important because I set up all the lines with the single script above. I could have done a different script for each window and put the line id numbers into the script instead of the entries where you see the letters "id". You'll also notice I used "id" for the map spot tids too. Seeing as how I was already passing the line id to the script, it makes sense to use the same number for the map spot tids too. So, beside line 201, I used a map spot with a tid of 201, beside line 202, I used a map spot with a tid of 202 etc. Again, this could all have been done with a separate script for each window and putting individual tid numbers into the script.

Oh, and my apologies for not including the script in the marine assault wad. I meant to, but simply forgot.

Share this post


Link to post

Ok I place the script,and there is no errors,
but i still do not have shards...
This is due I do not have shard sprites.
how to change the projectile 54?I mean using wintex I can't see
such names ,or I don't think so.
Do I have to tag some thing to have shards like: -thing shard tag 54

Share this post


Link to post

The sprites for the glass shards I used are SGSAA0 - SGSAE0. Those are the ones required by projectile 54 (or spawn number 54). There are other shards in my WAD, but those were the ones I used for the breaking computers.

As for Wintex, I dunno, I never could work out that program. What I do know is you need the sprites I mentioned (feel free to pull them out of my WAD) and you need to include them in your WAD between sprite markers (either S_START and S_END or SS_START and SS_END) which you presumably already have if you got the leaves working. I don't know how wintex handles things it doesn't know about, or can't find in the IWAD. From memory that can cause problems or mean that you have to do some sort of trickery, but frankly I can't remember. As for finding projectile 54 in wintex, I don't actually know what you mean by that. I'm assuming wintex tries to be clever and tell you what the sprite belongs to or something, but I'd be surprised if it would have a name even remotely like "projectile 54". The 54 actually refers to a defined spawn number for use in Zdoom scripts.

If you are really stuck with this, I can easily pull out the sprites concerned and send them to you in a WAD of their own. Let me know.

In fact, I think I already have them uploaded somewhere...

Yes, go here http://members.lycos.co.uk/Enjay001/ and look for the smashable mirror demo file near the bottom of the page. (If you use Norton Internet Security, switch it off before DLing otherwise the site redirects you to another site complaining about remote linking).

That demo file may cover a lot of what you need, in a simpler form than what's in Marine Assault.

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
×