here's a more updated version of what electrk posted, i'm pretty sure it works from what i've tested
function getSunCount()
{
%ct=-1;
for(%i=0;%i<missiongroup.getcount();%i++)
{
%obj=missiongroup.getObject(%i);
if(%obj.getClassName()$="Sun"){%ct++;}
}
return %ct;
}
function getSun(%c)
{
%ct=-1;
for(%i=0;%i<missiongroup.getcount();%i++)
{
%obj=missiongroup.getObject(%i);
if(%obj.getClassName()$="Sun"){%ct++;}
if(%ct == %c){return %obj;}
}
}
function changeLighting(%d, %l, %p, %r, %s, %c, %am, %az, %e)
{
for(%i = 0; %i <= getSunCount(); %i++)
getSun(%i).delete();
new Sun(Sun)
{
color = %c;
ambient = %am;
azimuth = %az;
elevation = %e;
direction = %d;
locked = %l;
position = %p;
rotation = %r;
scale = %s;
};
missionGroup.add(Sun);
}
so you could just do something like this maybe
function changeAmbient(%sun, %a)
{
changeLighting(%sun.direction,
%sun.locked,
%sun.position,
%sun.rotation,
%sun.scale,
%sun.color,
%a,
%sun.azimuth,
%sun.elevation);
}
changeAmbient(getSun(0), whatever);
not tested but try it
also in case you bugger something up here's the default lighting for skylands
changeLighting("0.57735 0.57735 -0.57735", 1, "0 0 0", "1 0 0 0", "1 1 1", "0.6 0.6 0.6 1.0", "0.5 0.5 0.5 1.0", "238", 21);