[resource] ACS - universal horizontal crusher script

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
ramon.dexter
Posts: 1519
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

[resource] ACS - universal horizontal crusher script

Post by ramon.dexter »

Hi, I mashed up universal script, that controlls moving walls. Something exactly like in Hexen Map 01, when you smash the stained glass window.
Use is pretty simple.
The only thing to notice is that you have to follow a simple rule during design - use polyobject mirroring, because this script controls only one line of polyobjects - the opposing line is mirrored.

So, polyobject numbering:

For the N-S script, follow this rule:


5 - 6 - 7 - 8 - mirrored line
1 - 2 - 3 - 4 - script controlled line

The same is for the E-W script
1 5
2 6
3 7
4 8

So, how the integers work?
"beginPoly" is the number of the first polyobject in the lower/left line. Only the first polyobject is required.
"nrSegments" is the amount of polyobjects in the lower/left line. Since the upper/right line is mirrored, nothing else is needed, the math does the rest.


Code: Select all

//universal horizontal crusher scripts
//==------------------------------------------------
bool crusherOpen[999];
script "CrusherN-S" (int beginPoly, int nrSegments)
{

	while(true)
	{
		while(crusheropen[beginPoly] == false)
		{
			for (int i = 0; i < nrSegments; i++)
			{
				Polyobj_OR_Move(beginPoly+i, 16, 192, 64);
				Polywait(beginPoly+i);
				
			}

			crusherOpen[beginPoly] = true;
			Delay(1);//Mandatory
		}
		while(crusherOpen[beginPoly] == true)
		{
			for (int y = 0; y < nrSegments; y++)
			{
				Polyobj_OR_Move(beginPoly+y, 16, 64, 64);
				Polywait(beginPoly+y);
			}
			crusherOpen[beginPoly] = false;
			delay(1);
		}
		delay(1);
	}
}

script "crusherE-W" (int beginPoly, int nrSegments)
{
	while(true)
	{
		while(crusheropen[beginPoly] == false)
		{
			for (int i = 0; i < nrSegments; i++)
			{
				Polyobj_OR_Move(beginPoly+i, 16, 128, 64);
				Polywait(beginPoly+i);
				
			}

			crusherOpen[beginPoly] = true;
			Delay(1);//Mandatory
		}
		while(crusherOpen[beginPoly] == true)
		{
			for (int y = 0; y < nrSegments; y++)
			{
				Polyobj_OR_Move(beginPoly+y, 16, 0, 64);
				Polywait(beginPoly+y);
			}
			crusherOpen[beginPoly] = false;
			delay(1);
		}
		delay(1);
	}
}

//==------------------------------------------------
DnB-Freak
Posts: 304
Joined: Sun May 19, 2013 12:09 pm

Re: [resource] ACS - universal horizontal crusher script

Post by DnB-Freak »

Neat! Are they unstoppable btw(player cannot run towards them and prevent them from moving ahead?)
User avatar
ramon.dexter
Posts: 1519
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: [resource] ACS - universal horizontal crusher script

Post by ramon.dexter »

Well, as I tested it, it seems to be ustoppable.
DnB-Freak
Posts: 304
Joined: Sun May 19, 2013 12:09 pm

Re: [resource] ACS - universal horizontal crusher script

Post by DnB-Freak »

nice :D, i'll try your acs and give credit.
EDIT:

I've tested it with one single polyobj, but it didn't work for me unfortunately.
The Crushing polyobjects can still be stopped I'm afraid, gotta check out what ZScript can do with it.
Post Reply

Return to “Script Library”