Well, I have coded a time of day script, but it just does not work for some reason. If I had the slightest idea why, I would say.
under init() I put:
this is under onPlayerConnect, just above onPlayerSpawned
the code itself
any idea what the issue is? I am confused. the script does not set any of the setDvar functions, they just remain the same.
thanks
under init() I put:
Code:
level thread timeOfDay();
this is under onPlayerConnect, just above onPlayerSpawned
Code:
player thread timeOfDayUpdate();
the code itself
Code:
timeOfDay()
{
level.tod.time = 299;
while(1)
{
level.tod.time += 1;
if(level.tod.time >= 1440) level.tod.time = 0;
if((level.tod.time > 1200) || (level.tod.time < 300)) {
level.tod.lightred = 0.2;
level.tod.lightgreen = 0.4;
level.tod.lightblue = 0.7;
level.tod.darkred = 0.1;
level.tod.darkgreen = 0.2;
level.tod.darkblue = 0.3;
level.tod.diffusescale = 0.75;
level.tod.specularscale = 8;
} else if(level.tod.time < 400) {
level.tod.lightred += 0.008;
level.tod.lightgreen += 0.007;
level.tod.lightblue += 0.006;
level.tod.darkred += 0.007;
level.tod.darkgreen += 0.008;
level.tod.darkblue += 0.01;
level.tod.diffusescale += 0.0075;
level.tod.specularscale -= 0.04;
} else if(level.tod.time < 720) {
level.tod.lightred += 0;
level.tod.lightgreen -= 0.0003125;
level.tod.lightblue -= 0.0009375;
level.tod.darkred += 0.001875;
level.tod.darkgreen += 0.00125;
level.tod.darkblue -= 0.0009375;
level.tod.diffusescale = 1.5;
level.tod.specularscale = 4;
} else if(level.tod.time < 1120) {
level.tod.lightred += 0;
level.tod.lightgreen += 0.00025;
level.tod.lightblue += 0.00075;
level.tod.darkred -= 0.0015;
level.tod.darkgreen -= 0.001;
level.tod.darkblue += 0.00075;
level.tod.diffusescale = 1.5;
level.tod.specularscale = 4;
} else if(level.tod.time < 1200) {
level.tod.lightred -= 0.01;
level.tod.lightgreen -= 0.00875;
level.tod.lightblue -= 0.0075;
level.tod.darkred -= 0.00875;
level.tod.darkgreen -= 0.01;
level.tod.darkblue -= 0.0125;
level.tod.diffusescale -= 0.0075;
level.tod.specularscale += 0.04;
}
setDvar("r_filmTweakLightTint",(level.tod.lightred + " " + level.tod.lightgreen + " " + level.tod.lightblue));
setDvar("r_filmTweakDarkTint",(level.tod.darkred + " " + level.tod.darkgreen + " " + level.tod.darkblue));
setDvar("r_diffuseColorScale",level.tod.diffusescale);
setDvar("r_specularColorScale",level.tod.specularscale);
wait 0.125;
}
}
timeOfDayUpdate()
{
self endon("disconnect");
while(1)
{
self setClientDvar("r_filmTweakDarkTint",getDvar("r_filmTweakDarkTint"));
self setClientDvar("r_filmTweakLightTint",getDvar("r_filmTweakLightTint"));
self setClientDvar("r_diffuseColorScale",getDvar("r_diffuseColorScale"));
self setClientDvar("r_specularColorScale",getDvar("r_specularColorScale"));
self VisionSetNakedForPlayer("mp_carentan", 0.5);
self setClientDvar("r_glowtweakbloomintensity0",0.3);
wait 0.05;
}
}
any idea what the issue is? I am confused. the script does not set any of the setDvar functions, they just remain the same.
thanks