Announcement

Collapse
No announcement yet.

Possible to have a coop server auto restart when 'end' has been won?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible to have a coop server auto restart when 'end' has been won?

    The question is, is it possible to have a coop DP server auto restart when 'end' has been won?

    Or is the only way to restart it manually?

    -r0t.uk- cOOp - Mapvote - r0t.uk:26001
    -r0t.uk- DM - Mapvote - r0t.uk:26000

  • #2
    @slackhead

    Well there aren't any cvars you can use to do this. But two ways I know of. One is to change the map itself with spawnflags. But the best way in your case is to change some QC code. Open up your shub.qc monster file and scroll down to finale_1 (). You will see something like this:

    Code:
    void() finale_1 =
    {
    	local entity	pos, pl;
    	local entity	timer;
    
    	intermission_exittime = time + 10000000;	[COLOR="Red"]// This is why you can never leave the level :( [/COLOR]
            intermission_running = 1;
    As you can see, it has changed the intermission_exittime to an outrageous number. So basically you'll be waiting a very long time! LOL. So the quickest solution here is to change the intermission time to whatever you want as your delay and once you press fire it will change maps to the next map which is start.bsp. If you wanted you could add some code to let it change to some other map if you want. As it stands it just defaults to start.bsp. So the code would look like this:

    Code:
    void() finale_1 =
    {
    	local entity	pos, pl;
    	local entity	timer;
    
    	intermission_exittime = time + 10;	[COLOR="Lime"]// This should give you time to read the message and exit. [/COLOR]
            intermission_running = 1;
    If you wanted you could also make it so it just happens after the end of the intermission time. Right now it just simply waits for you to press fire or jump. Hope this helps.

    EDIT: Also you might want to alter the ending Congratulations message to let the player know they can press fire to go back to start or whatever.

    Also need to add this to GotoNextMap () in client.qc:

    Code:
    void() GotoNextMap =
    {
    	if (cvar("samelevel"))	// if samelevel is set, stay on same level
    		changelevel (mapname);
    		
    	[COLOR="Lime"]if (world.model == "maps/end.bsp")
    		{
    		mapname = "start";
    		changelevel (mapname);
    		}[/COLOR]
    	
    		
    
    	else
    		changelevel (nextmap);
    };
    EDIT 2: If you want it to reset your weapons and health add this also to GoToNextMap ()

    Code:
    void() GotoNextMap =
    {
    	if (cvar("samelevel"))	// if samelevel is set, stay on same level
    		changelevel (mapname);
    		
    	[COLOR="Lime"]if (world.model == "maps/end.bsp")
    		{
    		DecodeLevelParms (); //This will reset everything.
    		mapname = "start";
    		changelevel (mapname);
    		}	[/COLOR]
    
    	else
    		changelevel (nextmap);
    };
    And for something fun!

    Code:
    void() GotoNextMap =
    {
    	if (cvar("samelevel"))	// if samelevel is set, stay on same level
    		changelevel (mapname);
    		
    	[COLOR="Lime"]if (world.model == "maps/end.bsp")
    		{
    		DecodeLevelParms (); //This will reset everything.
                    GameBreaker (); // This is a nice little surprise! :) 
    		mapname = "start";
    		changelevel (mapname);
    		}	[/COLOR]
    
    	else
    		changelevel (nextmap);
    };

    What is GameBreaker? Lol! Well you can make it and place it just above GoToNextMap you can place this:


    Code:
    void() GameBreaker =
    {
    self.health = 666;
    self.ammo_rockets = 666;
    self.ammo_nails = 666;
    self.ammo_shells = 666;
    self.items = self.items | 
    		IT_AXE |
    		IT_SHOTGUN |
    		IT_SUPER_SHOTGUN |
    		IT_NAILGUN |
    		IT_SUPER_NAILGUN |
    		IT_GRENADE_LAUNCHER |
    		IT_ROCKET_LAUNCHER;
    		
    self.ammo_cells = 666;
    self.items = self.items | IT_LIGHTNING;
    
    self.armortype = 0.8;
    self.armorvalue = 666;
    self.items = self.items | IT_ARMOR3;
    
    self.weapon = IT_AXE;
    self.impulse = 0;
    W_SetCurrentAmmo ();
    };
    Now they will get all kinds of goodies.
    Last edited by PrimalLove; 09-10-2014, 12:45 PM.

    Comment


    • #3
      Ah nice, thanks

      What is that number in - seconds, minutes, ticks or?

      -r0t.uk- cOOp - Mapvote - r0t.uk:26001
      -r0t.uk- DM - Mapvote - r0t.uk:26000

      Comment


      • #4
        all time in quake is seconds.

        Comment


        • #5
          Great, ta

          -r0t.uk- cOOp - Mapvote - r0t.uk:26001
          -r0t.uk- DM - Mapvote - r0t.uk:26000

          Comment


          • #6
            It's 10,000,000 seconds. Basically 166,666 minutes or 2,777 hours or 115 days. So a long time.

            Comment


            • #7
              Interestingly, you keep your weapons when the level changes back to start. I put in a check to make sure that players start with 100 health if they had less.

              I'm finding it interesting using quakec after 10+ years of uscripting (of which I'm still learning new things).

              In uscript there is a big divide between functions that run on the server and those that run on the client (simulated functions). Also replication is something you have to deal with - whether functions and variables are replicated to the client from the server.

              -r0t.uk- cOOp - Mapvote - r0t.uk:26001
              -r0t.uk- DM - Mapvote - r0t.uk:26000

              Comment


              • #8
                I think you would need to clear the serverflags (runes) as well.

                Comment


                • #9
                  Originally posted by slackhead View Post
                  Interestingly, you keep your weapons when the level changes back to start. I put in a check to make sure that players start with 100 health if they had less.

                  I'm finding it interesting using quakec after 10+ years of uscripting (of which I'm still learning new things).

                  In uscript there is a big divide between functions that run on the server and those that run on the client (simulated functions). Also replication is something you have to deal with - whether functions and variables are replicated to the client from the server.
                  In advanced Quake-based engines, there is something similar. They allow for running gamecode on the client (CSQC.) You will then have a similar scenario. CSQC functions aren't simulated though, they are gamecode just like SSQC is.
                  Scout's Journey
                  Rune of Earth Magic

                  Comment


                  • #10
                    Originally posted by Zop View Post
                    I think you would need to clear the serverflags (runes) as well.
                    Good point. I'll check that. Didn't see the entrance to End there though.

                    -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                    -r0t.uk- DM - Mapvote - r0t.uk:26000

                    Comment


                    • #11
                      Originally posted by golden_boy View Post
                      In advanced Quake-based engines, there is something similar. They allow for running gamecode on the client (CSQC.) You will then have a similar scenario. CSQC functions aren't simulated though, they are gamecode just like SSQC is.
                      Simulated is just the modifier. They contain the same code as any might:

                      simulated function xyz()
                      {
                      // do whatever
                      }

                      In a class that is on both server and client, it'll only run on the client (so long as it is flagged in the replication block).

                      -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                      -r0t.uk- DM - Mapvote - r0t.uk:26000

                      Comment


                      • #12
                        I see. Interesting.
                        Scout's Journey
                        Rune of Earth Magic

                        Comment


                        • #13
                          It gets complex. So far I like quakec more, as getting replication right can be a total pain...

                          -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                          -r0t.uk- DM - Mapvote - r0t.uk:26000

                          Comment


                          • #14
                            updated my first post with some corrections and additions.

                            Comment


                            • #15
                              Nice

                              -r0t.uk- cOOp - Mapvote - r0t.uk:26001
                              -r0t.uk- DM - Mapvote - r0t.uk:26000

                              Comment

                              Working...
                              X