Announcement

Collapse
No announcement yet.

Day and Night Cycles (Tutorial)

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Day and Night Cycles (Tutorial)

    So have you ever wanted to have day and night cycles while going along your business in quake? Sure you have! And now it will be possible! Surprise, this is another tutorial that requires dpextensions.qc and DP or FTE.


    So lets open up progs.src and place this in it:

    Code:
    items.qc
    weapons.qc
    [COLOR="Lime"]nightday.qc[/COLOR] Here is fine :) 
    world.qc
    client.qc
    Now lets make nightday.qc

    In it place this:

    Code:
    [COLOR="lime"]// Night and Day Cycle Fields[/COLOR]
    entity		nightdaychanger;
    .float		daynightlightlevel;
    .string		nightdaylightstring;
    .float		lightchange;
    float		min_lightlevel;
    float		max_lightlevel;
    
    [COLOR="lime"]//Autocvar for time between day and night changes (Can be set in autoexec.cfg or default.cfg)[/COLOR]
    var float autocvar_nightdayinterval = 20;
    
    [COLOR="Lime"]// This function will change the time of day, basically every 20 seconds it will lower the lightlevel by 1 until it reaches the minimum light level and will start over again in reverse. [/COLOR]
    
    void() NightDayLightThink =
    { 
            [COLOR="lime"]// If its time to be daylight again start increasing light[/COLOR]
    	if(self.lightchange)
    	{ 
    		self.daynightlightlevel++;
                   [COLOR="lime"] // If the light level gets too high its full daytime start getting darker soon[/COLOR]
    		if(self.daynightlightlevel > max_lightlevel)
    		{
    			self.daynightlightlevel = max_lightlevel - 1;
    			self.lightchange = FALSE;
    		}
    	}
          [COLOR="lime"]  // Is it me or is it getting dark around here? [/COLOR]
    	else
    	{
    		self.daynightlightlevel = self.daynightlightlevel - 1;
    		
    		if(self.daynightlightlevel < min_lightlevel)
    		{ 
                            [COLOR="lime"]//Make sure light level stays at min_lightlevel and restart[/COLOR]
    			self.daynightlightlevel = min_lightlevel;
    			self.lightchange = TRUE;
    		}
    	}
     [COLOR="lime"]       // This changes all lights in the level except torches, etc or any lights that use on and off flags lightstyles 32+[/COLOR]
    	lightstyle(0, substring(self.nightdaylightstring, self.daynightlightlevel, 1) );
    	self.nextthink = time + autocvar_nightdayinterval; // Repeat in 20 seconds
    };
    
    [COLOR="lime"]// This will create our entity and start the cycle[/COLOR]
    void() NightDayLightChanger =
    { 
    	if(autocvar_nightdayinterval > 0)
    	{
                    [COLOR="Lime"]// Set up our light value min and max[/COLOR]
    		max_lightlevel = 15;
    		min_lightlevel = 1.5;
                    [COLOR="lime"]//If we don't have a sun make one![/COLOR]
    		if(!nightdaychanger)
    		{
    			nightdaychanger = spawn();
                            [COLOR="Lime"]// No need to send this to the client[/COLOR]
    			nightdaychanger.effects = EF_NODRAW;
    			nightdaychanger.think = NightDayLightThink;
                            [COLOR="lime"]// Start it daylight because nighttime is scary[/COLOR]
    			nightdaychanger.daynightlightlevel = max_lightlevel;
    [COLOR="Lime"]                       // We want the light to change gradually	[/COLOR]		
                            nightdaychanger.nightdaylightstring = "abcdefghijklmnopqrstuvwxyz";
                            [COLOR="lime"]// Lets get started[/COLOR]
    			nightdaychanger.nextthink = time + 0.5;
    		}
    	}
    };
    This beauty will spawn an entity and will start the cycle. It will gradually change the lighting level of all world lights to the minimum light level of 1.5 and back to the max level of 15. It gives you a simulated night and day cycle. If you want it to be longer simply set a higher number for the autocvar nightdayinterval. 20 is a pretty good cycle. But if you want to change it just place set nightdayinterval 30 or whatever you want the cycle to be in an autoexec.cfg or similar. You can also change it from the console but you will need to restart for the changes to make effect.

    So now we need to open up world.qc and scroll down to worldspawn() at the top place this:
    Code:
    void() worldspawn =
    {
    	lastspawn = world;
    	InitBodyQue ();
    [COLOR="lime"]// Here is fine :) [/COLOR]
    NightDayLightChanger();
    Ok that's it. Compile and you have night and day cycles! You may want to make some skyboxes to match for night time but otherwise its pretty cool effect. Have fun!
    Last edited by PrimalLove; 11-13-2014, 03:42 PM.

  • #2
    first SMC, and now ripping QC out of kleshik-mod too?
    really?

    .

    PS i cant prove this, but it surely sounds like a feature you ripped from kleshik.
    and seeing you just ripped a feature out of SMC and made a broken tutorial about that
    i wouldnt be suprised if you actually did rip this code right out of kleshik as well
    .
    are you curious about what all there is out there in terms of HD content for quake?
    > then make sure to check out my 'definitive' HD replacement content thread! <
    everything that is out there for quake and both mission-packs, compiled into one massive thread

    Comment


    • #3
      You sicken me.

      Originally posted by talisa View Post
      first SMC, and now ripping QC out of kleshik-mod too?
      really?

      Comment


      • #4
        I have enjoyed reading your postings about QC. i wish more things would be posted like this. (pokes rook) most things you can do in QC have been done at one time or another. if your posting QC that is used in another mod give credit to authors and your inspirations. just becouse something is in a mod dose not mean some one simple like me can see it. the QC tuts at i3d are mostly old its nice to see new ones. a lot of the ones at i3d are pulled from other mods too not all compile or work 100% as they are posted from what i have found but they are still good. i hope we can find away for post like this to still show up and a way for authors to feel credited. one thing about the smc is a lot of the tricks are over at i3d but seven adds a twist to it making it better and making it "his". i think a cool add to this would be to have a sun and moon spawn at day and night or something like that. i always like qc post even if i dont understand them 100% each time i read one i learn a little bit more

        Comment


        • #5
          Originally posted by xaGe View Post
          You sicken me.
          Why? talisas words are true.

          Comment


          • #6
            hey you can rip Demo version - Blood Omnicide,
            they have sun and moon day/night feature, just for the case you dont know......

            Now I will wait for your tut....



            Last edited by webangel; 11-15-2014, 08:05 PM.

            Comment


            • #7
              Damn, I heard this place was dead recently, so why dafuq are you posting your sarcastic, overreacted drama laden bs here then?
              Last edited by damage_inc; 11-15-2014, 04:48 PM.
              Name's damage_inc, and killing is my business. Don't worry though, it's nothing personal! Oh wait... maybe it is

              Comment


              • #8
                Originally posted by damage_inc View Post
                Damn, I heard this place was dead recently, so why dafuq are you posting your sarcastic, overreacted drama laden bs here then?
                Because I know my friends!
                Anything else? Is this damage_inc a second account, or a third? What you have to do with this?
                Why you are refering to my other posts? I know what I write..... In other posts - what the hell. Or "why dafuq " ....
                Last edited by webangel; 11-15-2014, 08:10 PM.

                Comment


                • #9
                  Originally posted by webangel View Post
                  Because I know my friends!
                  Anything else? Is this damage_inc a second account, or a third? What you have to do with this?
                  Why you are refering to my other posts? I know what I write..... In other posts - what the hell. Or "why dafuq " ....
                  Yeah Einstein, I whipped up this "second" account and an instantaneous 386 prior posts before I replied to your useless drivel, damn you figured it out! Genius.

                  BTW, I had nothing to do with it, same as you. Oh wait, no... you wanted just to add to the already unnecessary drama, that's right. Good job, great contribution to a site you could care less about cause it's dead Brilliant.
                  Last edited by damage_inc; 11-15-2014, 11:19 PM.
                  Name's damage_inc, and killing is my business. Don't worry though, it's nothing personal! Oh wait... maybe it is

                  Comment


                  • #10
                    I know I didnt do a important job here, but I dont rip someone else work and make a tutorial without giving credits and say HERE is MY work, like PrimalLove does!

                    End of discussion <<<<<<<<<<<!

                    dafuq!

                    Im too old for this kind of shit

                    Originally posted by damage_inc View Post
                    Yeah Einstein, I whipped up this "second" account and an instantaneous 386 prior posts before I replied to your useless drivel, damn you figured it out! Genius.

                    BTW, I had nothing to do with it, same as you. Oh wait, no... you wanted just to add to the already unnecessary drama, that's right. Good job, great contribution to a site your could care less about cause it's dead Brilliant.
                    Last edited by webangel; 11-15-2014, 08:57 PM.

                    Comment


                    • #11
                      Still dont see where it says this is his work. Its a tutorial. I guess you could say that you think its a rip from Kleshik, but all the mods the code is being said is being ripped from are publicly available. I thought the people who write the code understand once its been made public the skies the limit to what can be done to it. If it really is from Kleshik the author of that mod ought to be doing the complaining, but even if he did, hes posted the code publicly so to be upset dont seem to make sense. If you are the person who wrote the ' alleged ' code , then you can take it up with the topic starter, but really all anyone can do is ask politely either they say this code also may be present in other mods , but if we mention seven Dresk or Frika-C or Lord Havoc every time we post code that they have worked with in the past the post would have to have a HUGE credit list going all the way back to the original ID team who made Q. Even back further, you can say they _stole_ "QUAKE" from a dungeons and dragons module that TSR actually owns. No one else that far back is upset we are messing with the game and code, so why would anyone take this so personally?
                      Last edited by Cobalt; 11-15-2014, 10:08 PM. Reason: typo

                      Comment


                      • #12
                        Originally posted by Cobalt View Post
                        Still dont see where it says this is his work. Its a tutorial. I guess you could say that you think its a rip from Kleshik, but all the mods the code is being said is being ripped from are publicly available. I thought the people who write the code understand once its been made public the skies the limit to what can be done to it. If it really is from Kleshik the author of that mod ought to be doing the complaining, but even if he did, hes posted the code publicly so to be upset dont seem to make sense. If you are the person who wrote the ' alleged ' code , then you can take it up with the topic starter, but really all anyone can do is ask politely either they say this code also may be present in other mods , but if we mention seven Dresk or Frika-C or Lord Havoc every time we post code that they have worked with in the past the post would have to have a HUGE credit list going all the way back to the original ID team who made Q. Even back further, you can say they _stole_ "QUAKE" from a dungeons and dragons module that TSR actually owns. No one else that far back is upset we are messing with the game and code, so why would anyone take this so personally?
                        Yes, I know that my english is too bad.
                        I understand your point cobalt. Im too tired to talk about this.
                        Even in a tutorial, he can say he doesnt made it himself... Just my two cents.
                        Sorry for bitching around.

                        Comment


                        • #13
                          Someone made QuakeC.

                          someone made code.

                          someone explained it,
                          www.quakeone.com/qrack | www.quakeone.com/cax| http://en.twitch.tv/sputnikutah

                          Comment


                          • #14
                            Stop bullshit about credits!! Kleshik is GPL!!! Do you know about gpl licences ?? Creative commons and credits for free work sucks!
                            the invasion has begun! hide your children, grab the guns, and pack sandwiches.

                            syluxman2803

                            Comment


                            • #15
                              Fok all the haters PrimalLove and party on.

                              Kid Cudi - Day 'N' Nite: Kid Cudi - Day 'N' Nite - YouTube

                              I like this version better
                              Kid Cudi vs. Crookers - Day 'n' Night: Kid Cudi vs. Crookers - Day 'n' Night - YouTube
                              Last edited by wicked_lord; 11-16-2014, 04:02 AM.

                              Comment

                              Working...
                              X