Wintermute Engine Forum

Wintermute Engine => Scripts, plugins, utilities, goodies => Topic started by: Lomeg83 on January 16, 2010, 12:58:14 PM

Title: Fading Ambient Light to Region's Color
Post by: Lomeg83 on January 16, 2010, 12:58:14 PM
//Add this script to your Region////

var rscolor = GetRValue(Scene.GetLightColor("Lampe"));
var gscolor = GetGValue(Scene.GetLightColor("Lampe"));
var bscolor = GetBValue(Scene.GetLightColor("Lampe"));

var rrcolor = GetRValue(this.AlphaColor);
var grcolor = GetGValue(this.AlphaColor);
var brcolor = GetBValue(this.AlphaColor);

var rncolor = GetRValue(Scene.GetLightColor("Lampe"));
var gncolor = GetGValue(Scene.GetLightColor("Lampe"));
var bncolor = GetBValue(Scene.GetLightColor("Lampe"));

////////////////////////////////////////////////////////////////////////////////
on "ActorEntry"
{
while(rncolor != rrcolor && gncolor != grcolor && bncolor != brcolor)
{
if(rncolor > rrcolor){rncolor = rncolor - 1;}
if(rncolor < rrcolor){rncolor = rncolor + 1;}
if(gncolor > grcolor){gncolor = gncolor - 1;}
if(gncolor < grcolor){gncolor = gncolor + 1;}
if(bncolor > brcolor){bncolor = bncolor - 1;}
if(bncolor < brcolor){bncolor = bncolor + 1;}
Scene.SetLightColor("<Name of default Omni Light in the Scene>",MakeRGBA(rncolor,gncolor,bncolor));
///You can add a <Sleep(1....);> for slower fading////
}


on "ActorLeave"
{
while(rncolor != rscolor && gncolor != gscolor && bncolor != bscolor)
{
if(rncolor > rscolor){rncolor = rncolor - 1;}
if(rncolor < rscolor){rncolor = rncolor + 1;}
if(gncolor > gscolor){gncolor = gncolor - 1;}
if(gncolor < gscolor){gncolor = gncolor + 1;}
if(bncolor > bscolor){bncolor = bncolor - 1;}
if(bncolor < bscolor){bncolor = bncolor + 1;}
Scene.SetLightColor("<Name of default Omni Light in the Scene>",MakeRGBA(rncolor,gncolor,bncolor));
///You can add a <Sleep(1....);> for slower fading////
}
}