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

Lights flickering in time with scripted sparking?

Recommended Posts

I've been working on a theme map lately, mostly just to force myself to learn new things - no enemies at all, just a very moody map. I've got a computer console that has an ACS scripted random spark particle generator. It works like a champ and here's the code for it:

    #Include "ZCommon.ACS"

    Script 1 OPEN
    {
	Thing_Activate(1);
	Delay(Random(5, 70));
	Restart;
    }
It's a strictly copy-paste snippet that I'm pretty sure I found on the ZDoom wiki.

What I'd like to do, and what I can't seem to get working, is have the lights in the sector that the console is made up of flicker on and off in time with the random sparking. I've tried various iterations of the following code with no luck at all:
    #Include "ZCommon.ACS"

    Script 1 OPEN
    {
	Thing_Activate(1);
	Light_ChangeToValue(2, 192);
	Delay(Random(5, 70));
	Light_ChangeToValue(2, 32);
	Restart;
    }
As anybody can probably tell, I'm not a programmer in the least, so what I'm trying do here (while making sense in my own mind) probably seems pretty damn retarded.

Can anybody tell me what I'm doing wrong here, or at least point me in the right direction to figure it out?

Edit: Oh yeah, and am I completely out of luck with getting the ACS compiler to run under 64-bit Vista? It'd be a shame if I have to do all my mapping by running back and forth between my desktop and a 5 year old notebook :\

Edit 2: And I should probably mention that the console sector is tagged as #2, so that's not what it isn't working, heh.

Share this post


Link to post

Use something more like this:

 #Include "ZCommon.ACS"

    Script 1 OPEN
    {
	Thing_Activate(1);
	Light_ChangeToValue(2, 192);
	delay(3) //how long you want the light to stay lit
	Light_ChangeToValue(2, 32);
        Delay(Random(5, 70));
	Restart;
    }
edit: light 32 is rather dark for a level. Myself personal now never go below 96. Depends on the map and how you use it though.

edit 2: I'm not sure how restart works in open scripts. You might have make it a normal script and call it from the open script.

Share this post


Link to post

That works perfectly - thanks a ton! I guess I wasn't too far off with my original guesstimation.

Looks so much better now that the lighting is timed with the sparks - and you were right, 32 was too dark. 96 is much better.

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
×