quakeworld start delay between maps (thunderwalker ctf mod)

Discuss programming in the QuakeC language.
Post Reply
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

quakeworld start delay between maps (thunderwalker ctf mod)

Post by Batman!]ZFA[ »

Anyone know about putting delay between maps?

So map changes, you have 1 minute and everyone respawns?

http://sourceforge.net/projects/thunderwalker/ source files.

we tried some code, but keeps crashing server when it goes to have people respawn
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

Is this where the match ends, new map loads, 1 minute timer, timer elapses, and then players are spawned?

If so, take a look at how TF does it. TF waits for team and class selection, instead of waiting, just initiate a 60 second timer, when the timer is done, flip a switch that spawns all who have selected a team on to their proper team, and anyone connecting from then on sees the switch is flipped, and thus does not encounter the 60 second timer, but merely selects their team and spawns.
...and all around me was the chaos of battle and the reek of running blood.... and for the first time in my life I knew true happiness.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

"a quick prewar mode" tested on MVDSV 0.28

First in world.qc
in the startframe function I changed:

Code: Select all

 if (time > prematch_time)//R00k        
        StartTimer(); // Doc start the game timer
o k now in
defs.qc

Code: Select all

float gametime; // countdown timer
float prematch_time = 120;//Number of seconds for prewar!    :R00k
client.qc

Code: Select all

void() CheckRules =
{
    local entity tent,e;
    local string stemp;
    if (gameover || pregameover) // someone else quit the game already
    return;

    if (time < prematch_time)//2 minutes
    {
        //Prewar no damage------
        tent = find(world,classname, "player");
        while (tent != world)
        {
            tent.takedamage == DAMAGE_NO;
            tent = find(tent,classname, "player");
        }

        if ((time > (prematch_time - 10)) && (time < prematch_time))//Between 110 - 120 seconds start count down display...
        {
            if ((rint ((prematch_time - time)) == 10))
            {                
                bprint (PRINT_HIGH, "Game starts in 10 seconds\n\n");
            }
            else
            {
                if ((rint ((prematch_time - time)) == 5))
                {
                    bprint (PRINT_HIGH, "[5]\n");
                }
                else
                {
                    if ((rint ((prematch_time - time)) == 4))
                    {
                        bprint (PRINT_HIGH, "[4]\n");
                    }
                    else
                    {
                        if ((rint ((prematch_time - time)) == 3))
                        {
                            bprint (PRINT_HIGH, "[3]\n");
                        }
                        else
                        {
                            if ((rint ((prematch_time - time)) == 2))
                            {
                                bprint (PRINT_HIGH, "[2]\n");
                            }
                            else
                            {
                                if ((rint ((prematch_time - time)) == 1))
                                {
                                    bprint (PRINT_HIGH, "[1]\n");
                                    tent = find(world,classname, "player");
                                    while (tent != world)
                                    {
                                        e = self;
                                        self = tent;
                                        respawn();
                                        self = e;
                                        tent = find(tent,classname, "player");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Then in items.qc all touch functions add this to the top

Code: Select all

if (time < prematch_time)
        return;
also in teamplay.qc add

Code: Select all

void() TeamCaptureFlagTouch =
{
    local entity p, escort;
    local float timmy;

    if (time < prematch_time)
        return;
This should allow a prewar of 120 seconds, you can lower it just change the value in defs2.qc. Players will spawn with shotguns and grapple but will not takedamage, and you cannot pick up items. So its just hook around.... Rook
-----------------------------------

The problem is:

it prints the seconds left to match start a tone of times in the console then when it gets to zero the server crashes with a bad movetype error.


idea:

Doc:

Okay the call to respawn(); is whats crashing the server if I do

T_Damage (self, self, self, 1000);

It will kill the player but won't automatically respawn players, you need to hit fire or jump to respawn.

I think when respawn is called it's called several times in rapid succession just as the bprints are called more than once this may be why it's crashing the server but I could be wrong on this.
Supa
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Post by Supa »

Try moving your prematch timer code from CheckRules to StartFrame? CheckRules is called by every client every frame in PlayerPreThink, so that would be why you're getting spammed with timer messages.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

Doc
I tried this same result server crashes when repsawn(); is called and it still spams the console with a ton of bprint messages.
Supa
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Post by Supa »

Okay, here's a revised version in the format of the original version.

Add to the bottom of defs.qc:

Code: Select all

float game_started;	// TRUE if out of warmup
float nextcountdown; // count once every second
float prematch_time = 120;	//Number of seconds for prewar!    :R00k

void() set_suicide_frame;	// prototype
void() respawn;				// ditto
Replace StartFrame in world.qc with:

Code: Select all

void() StartFrame =
{
	local entity tent, oldself;

	timelimit = cvar("timelimit") * 60;
	fraglimit = cvar("fraglimit");
	teamplay = cvar("teamplay");
	deathmatch = cvar("deathmatch");

	framecount = framecount + 1;
	
	if (time > prematch_time)//R00k       
	{
		StartTimer(); // Doc start the game timer
		
		if (!game_started)
		{
			game_started = TRUE;

			tent = find(world, classname, "player");
			while (tent != world)
			{
				oldself = self;
				self = tent;
				
				set_suicide_frame();
				respawn();
				self = oldself;
				tent = find(tent, classname, "player");
			}
		}
	}
	else if (prematch_time - time <= 10)
	if (nextcountdown <= time)
	{
		nextcountdown = time + 1;
	
		if (ceil(prematch_time - time) == 10)
			bprint (PRINT_HIGH, "Game starts in 10 seconds\n");
		else
			bprint3 (PRINT_HIGH, "[", ftos(ceil(prematch_time - time)), "]\n");
	}
};
Add to the top of all touch functions in items.qc and to the top of T_Damage in combat.qc:

Code: Select all

if (time < prematch_time)
        return;
And to the top of TeamCaptureFlagTouch in teamplay.qc like so:

Code: Select all

void() TeamCaptureFlagTouch =
{
	local entity p, escort;
	local float timmy;

	if (time < prematch_time)
        return;
		
	...
And that's it. Let us know if everything works. :)
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

Supa wrote:Try moving your prematch timer code from CheckRules to StartFrame? CheckRules is called by every client every frame in PlayerPreThink, so that would be why you're getting spammed with timer messages.
Makes sense, as in my netQuake mods i dont have check_rules per client anymore, but called from startframe, when porting to QW I forgot to change the bprint to sprints...

Supa's tight optimizations should work exactly.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

Yes its working now!

Thanks.

Not crashing now.

now we just have to make it so people don't die during that time.

right now lava and slime will kill players.
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

Well, you could adjust the functions that have lava and slime do damage do the same check of time < prematchtime and returning, else do their damage.
...and all around me was the chaos of battle and the reek of running blood.... and for the first time in my life I knew true happiness.
Batman!]ZFA[
Posts: 32
Joined: Thu Nov 20, 2008 12:51 am
Location: Pennsylvania
Contact:

Post by Batman!]ZFA[ »

thanks we got that part figured out.

only thing is its a leaving body.

when the prematch period is over at the location where you were before you respawn.

Image
MeTcHsteekle
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Post by MeTcHsteekle »

why is that quakeman a sickly pale?

anyways, i think that would be pretty cool to have deadguys on the map before the match even starts, gives it a factory slaughter kind of idea
bah
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

in world.qc there's a function called CopyToBodyQueue
Just make it return without doing anything in prewar.
Or stop it from being called in client.qc/player.qc wherever it is.


How are you handling doors/plats? :)
Post Reply