Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time of day Y U NO WORK?
#1
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
Reply

#2
(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
Reply

#3
(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.
Reply

#4
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);
Reply

#5
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!
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#6
(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
[Image: azuw.jpg]
Reply

#7
Thanks, but that did not work for me. It even kept the dvars I previously set.
Reply

#8
(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.
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Permissions DOESNT work Hallla 2 3,070 08-18-2013, 11:28
Last Post: hillbilly
Information [Request] Need Time Plugin and Server Msg Plugin sylvester123 14 9,464 07-26-2013, 08:07
Last Post: sylvester123
  why permissions dont work. ? ExoGamer* 4 3,313 07-21-2013, 13:46
Last Post: X-Track
  4D1 Extend Feeding Time Tacticalicious 1 2,614 07-02-2013, 20:59
Last Post: surtek
  Bunker Plugin Won't work OBJAY 4 4,521 06-03-2013, 15:48
Last Post: X-Track
  Help prefix doesnt work with shop koro35 2 2,904 05-18-2013, 10:51
Last Post: koro35
Tongue What are you doing in free time? Nekochan 16 8,944 05-05-2013, 08:25
Last Post: Pozzuh
  Help Perks do not work (( x1412 6 4,425 04-06-2013, 18:09
Last Post: x1412
  liberation dont work? puistis 7 7,824 02-18-2013, 09:17
Last Post: JariZ
  Weapon dont work?? Erik The Born 3 2,876 02-05-2013, 19:53
Last Post: Yamato

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.