Please help with breaking glass script

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
martinezz123
Posts: 103
Joined: Wed Jan 22, 2020 5:04 am

Please help with breaking glass script

Post by martinezz123 »

Hi. I know there is a Brutal Doom thing which places Breakable windows, but they are small and I needed a larger "glass wall" in my map so I did it the following way:

1. I coped a script from Layzgamer (from you tube). Here is the script:

Code: Select all

script 1 (int LineID)
{
 Setlineblocking(LineID,OFF);
 int var0;
 thingsound(LineID+1, "glass", 127);

 //GlassShards gets flying
 var0 = 4; //Sets how many shards that will spawn
 while(var0 > 0)
 {
  var0--;
  SpawnProjectile (LineID+1, "NJGlassShard", random(0, 255), random(10, 80), random(20, 40), 36, 99);
 }
 SetActorProperty(99, APROP_Damage, 1); //Sets dealing damage for shards

 //Texture cicle
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh01");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh01");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh02");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh02");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh03");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh03");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh04");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh04");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "-");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "-");
}
2. I made a line and put 9001 map spot there.
3. Set map spot Tag to 101 as in the picture below.
4. Set Script Execute to Script 1 and LineID 100, as in the screen below.
5. Placed textures and their deffinitions in my pk3 as in the picture below.

I can't figure out why the glass does not break.
Attachments
4line.jpg
3item.jpg
2slade.jpg
martinezz123
Posts: 103
Joined: Wed Jan 22, 2020 5:04 am

Re: Please help with breaking glass script

Post by martinezz123 »

I made a test map for the breaking glass script.
Can anyone halp me what's wrong?
Attachments
testglass.pk3
(34.51 KiB) Downloaded 43 times
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Please help with breaking glass script

Post by Enjay »

Basically, your script wasn't compiled. It had a couple of minor errors.

You hadn't included #include "zcommon.acs" at the start and you had an additional trailing } at the end.

Fixing those allows the script to compile and run and it works in your test map.

There were also two unclosed sectors in the map, the map spots need to be raised up a bit to look good and the TEXTURES lump isn't needed (deleting it gets rid of error messages seen at the console.

But the main stumbling block was the script. Here's what I used in the map to make it work:

Code: Select all

#include "zcommon.acs"

script 1 (int LineID)
{
 Setlineblocking(LineID,OFF);
 int var0;
 thingsound(LineID+1, "glass", 127);

 //GlassShards gets flying
 var0 = 4; //Sets how many shards that will spawn
 while(var0 > 0)
 {
  var0--;
  SpawnProjectile (LineID+1, "NJGlassShard", random(0, 255), random(10, 80), random(20, 40), 36, 99);
 }
 SetActorProperty(99, APROP_Damage, 1); //Sets dealing damage for shards

 //Texture cicle
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh01");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh01");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh02");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh02");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh03");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh03");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "njsmsh04");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "njsmsh04");
 delay(4);
 setlinetexture (LineID, SIDE_FRONT, TEXTURE_MIDDLE, "-");
 setlinetexture (LineID, SIDE_BACK, TEXTURE_MIDDLE, "-");
}
Heh, the names of those textures and glass shards look familiar. :lol:
martinezz123
Posts: 103
Joined: Wed Jan 22, 2020 5:04 am

Re: Please help with breaking glass script

Post by martinezz123 »

Thank you
Post Reply

Return to “Mapping”