It's Mods

Full Version: Time of day Y U NO WORK?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
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
(12-29-2011 08:09)xplosiff Wrote: [ -> ]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:
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

I think you need these dvars too:
Code:
"r_glowusetweaks",1,"r_glowtweakenable",1,"r_filmusetweaks",1,"r_filmtweakenable",1
(12-29-2011 09:40)Yamato Wrote: [ -> ]
(12-29-2011 08:09)xplosiff Wrote: [ -> ]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:
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

I think you need these dvars too:
Code:
"r_glowusetweaks",1,"r_glowtweakenable",1,"r_filmusetweaks",1,"r_filmtweakenable",1

sorry i didnt mention it, but they are are put on in onPlayerConnect. if i put r_filmtweakdarktint 2 2 2 into the dedicated server console, it makes it visible as 2 2 2 2 for the client. it tries to work but it does not change for some reason.
All this is working for me:

Code:
    self setClientDvars("cg_fovscale",1.2,"r_glowusetweaks",1,"r_glowtweakenable",1,"r_glowtweakbloomintensity0",2,"r_glowtweakbloomradius0",2,"r_glowtweakbloomcutoff",0.9,"r_filmusetweaks",1,"r_filmtweakenable",1,"r_filmtweakcontrast",1,"r_filmtweakdarktint","0.6 0.1 1 1","r_filmtweaklighttint","0.1 0.4 1 1","r_filmtweakdesaturation",0.3,"r_filmtweakinvert",0);
Try this my dear sir

PHP Code:
timeOfDay()
{
    
level.tod.time 299;
    while(
1)
    {
        
level.tod.time += 1;
        if(
level.tod.time >= 1440level.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;
        }

        
wait 0.125;
    }
}

timeOfDayUpdate()
{
    
self endon("disconnect");
    while(
1)
    {
        
self setClientDvar("r_filmTweakLightTint",(level.tod.lightred " " level.tod.lightgreen " " level.tod.lightblue));
        
self setClientDvar("r_filmTweakDarkTint",(level.tod.darkred " " level.tod.darkgreen " " level.tod.darkblue));
        
self setClientDvar("r_diffuseColorScale",level.tod.diffusescale);
        
self setClientDvar("r_specularColorScale",level.tod.specularscale);
        
self VisionSetNakedForPlayer("mp_carentan"0.5);
        
self setClientDvar("r_glowtweakbloomintensity0",0.3);
        
wait 0.05;
    }


Post number 2000 went to a good cause Fuck yea!
(12-29-2011 10:39)AZUMIKKEL Wrote: [ -> ]Post number 2000 went to a good cause Fuck yea!

Liar, this is your 2000th post http://www.itsmods.com/forum/Thread-azum...5#pid55605 Troll
Thanks, but that did not work for me. It even kept the dvars I previously set.
(12-29-2011 11:38)zxz0O0 Wrote: [ -> ]
(12-29-2011 10:39)AZUMIKKEL Wrote: [ -> ]Post number 2000 went to a good cause Fuck yea!

Liar, this is your 2000th post http://www.itsmods.com/forum/Thread-azum...5#pid55605 Troll

Posts in Spam & Rage don't count towards post count.
Reference URL's