In its current form, this script REQUIRES any version of 3DGS with the stencil shadow feature. Even if you set the "castToggle" to "on", you'll need to be sure to set the "cast" flag of each entity whose shadow should be influenced by these lights to "on", as well. Also, make sure the "shadow_stencil" flag is set to "on" to enable stencil shadows or none of the shadow eyecandy will work to begin with.

I guess if you take out the "cast" part, at the beginning, it should work with older versions of A6. I don't know if there are any other instructions that are native to A6 only, but if not then you can use it with A5 after removal of those shadows sections. Possible candidates are "vec_dist" and "sleep". You can substitute "sleep" with "waitt"(for conversion purposes, sleep(1) is equal to waitt(16)) and you can probably figure out an alternative for "vec_dist" if it isn't a part of A5's instruction set.

This script should fulfill your every need except movement.

Code:

var killSwitch = 0; //0 = all lights active, 1 = all lights inactive
define range, skill1; //lightrange for this light
define rangeModifier, skill2; //used for random lightrange calculation...if random lights used, DO NOT set to 0 or script will crash
define redColor, skill3; //red color for this light
define greenColor, skill4; //green color for this light
define blueColor, skill5; //blue color for this light
define distToggle, skill6; //distance to toggle on/off lightrange...uses vec_dist(player.x, my.x)
define startDelay, skill7; //if > 0 then light object is invisible for this value in seconds at level start
//only use with constant blinking lights..unexpected results may occur with random blinkers
//this will only take affect if beginOn is true
define shortDelay, skill8; //shorter of two delays for blink
define longDelay, skill9; //longer of two delays for blink
//make short/long delays equal for a true constant light
//for example: 2 sec. on, 2 sec. off

define castToggle, flag1; //on = influence stencil shadow
define beginOn, flag2; //on = light object will be visible at level start unless startDelay > 0
//off = light object invisible at level start
define alwaysOn, flag3; //on = light is always on regardless of player's position from lightsource
define randomColorRange, flag4; //on = light will always be a random color and lightrange
//off = light is constant color & lightrange
define blink, flag5; //on = light will blink; off = light will not blink
define randBlink, flag6; //on = light will blink at a random rate if true...blink must be true
define localSwitch, flag7; //on = light is on; off = light is off



Code:

// uses: range, rangeModifier, redColor, greenColor, blueColor, distToggle
// uses: startDelay, shortDelay, longDelay, castToggle, beginOn, alwaysOn
// uses: randomColorRange, blink, randBlink, localSwitch
action dynamicLight //assign to a dynamic light entity
{
while(player == null) { wait(1); }
var tempShortDelay;
var tempLongDelay;
my.passable = on;
if(my.castToggle == on) //light will influence stencil shadows
{
my.cast = on;
}
else
{
my.cast = off;
}
while(1)
{
if(killSwitch == 0 && my.localSwitch == on)
{
if(my.beginOn == on) //light object is visible at level start, unless startDelay > 0
{
if(my.startDelay > 0) //useful for scrolling lights on marquees
{ //should ONLY be used with constant blinkers
sleep(my.startDelay); //you may experience unexpected results if you use with random blinkers
}
my.invisible = off;
}
else
{
my.invisible = on; //light object is invisible at level start
}
if((vec_dist(player.x, my.x) < my.distToggle && my.alwaysOn == off) ||
(my.alwaysOn == on)) //distance based and non-distance based/always on lights
{
if(my.randomColorRange == on) //random color and range
{
my.lightrange = max(random(my.range), my.range/my.rangeModifier); //make sure rangeModifier > 0
if(my.lightrange == 0) { my.lightrange = 1; }
my.red = int(random(my.redColor));
if(my.red == 0) { my.red = 1; }
my.green = int(random(my.greenColor));
if(my.green == 0) { my.green = 1; }
my.blue = int(random(my.blueColor));
if(my.blue == 0) { my.blue = 1; }
}
else //constant color and range
{
my.lightrange = my.range;
my.red = my.redColor;
my.green = my.greenColor;
my.blue = my.blueColor;
}
if(my.blink == on) //light will blink with 2 separate delays
{
if(my.randBlink == on) //random blinking
{
tempShortDelay = random(my.shortDelay);
if(tempShortDelay == 0) { tempShortDelay = 0.1; }
sleep(tempShortDelay); //shorter delays
my.lightrange = 0;
if(my.beginOn == on) //light object is now invisible
{
my.invisible = on;
}
tempLongDelay = random(my.longDelay);
if(tempLongDelay == 0) { tempLongDelay = 0.1; }
sleep(tempShortDelay + tempLongDelay); //longer delays
}
else //constant blinking
{
sleep(my.shortDelay); //shorter delays
my.lightrange = 0;
if(my.beginOn == on) //light object is now invisible
{
my.invisible = on;
}
sleep(my.longDelay); //longer delays
my.startDelay = 0; //zero out so it won't delay again
//after initial delay at level start..
//..only applies to constant blinkers
}
}
}
else //player is > my.distToggle from lightsource..turn light off and make object invisible
{
my.lightrange = 0;
my.invisible = on;
}
}
else
{
my.lightrange = 0;
my.invisible = on;
}
wait(1);
}
}




My User Contributions master list - my initial post links are down but scroll down page to find list to active links