Autospawn mess


(]UBC[ McNite) #1

Hi guys,

there is a spawnbug in my map that I can even reproduce, but i have no clue why it is there at all.
And working around it produces another bug. Anyways I ll just tell you what we got here:

// ----- AXIS FIRST SPAWN
spawnstartax_spawns
{
	spawn
	{
	}
	trigger off
	{
		setstate spawnstartax_spawns invisible
	}
}

spawnstartax_wobj // first Axis spawn - descr. "Axis Start"
{
	spawn
	{
		wait 50
		setstate spawnstartax_wobj default
	}
	trigger on
	{
		setstate spawnstartax_wobj default
	}
	trigger off
	{
		setstate spawnstartax_wobj invisible
	}
}

// ----- FLAG in GUARD HOUSE
spawngh_flag
{
	spawn
	{
		wait 150
		accum 2 set 1 // Allies have the flag at the start
		setautospawn "Axis Start" 0
		setautospawn "Guardhouse" 1
	}

	trigger allied_capture
	{
		accum 2 abort_if_equal 1 // allies own the flag already
		accum 2 set 1

		wm_objective_status	5 0 2
		wm_objective_status	5 1 1
		wm_announce "^1Allies have captured the Guardhouse Flag!"

		alertentity spawngh_wobj
		setautospawn "Guardhouse" 1
		setautospawn "Axis Start" 0

		trigger spawnstartax_wobj on
	}

	trigger axis_capture
	{
		accum 2 abort_if_equal 0 // axis already own the flag
		accum 2 set 0

		wm_objective_status	5 0 1
		wm_objective_status	5 1 2
		wm_announce "^1Axis have captured the Guardhouse Flag!"

		alertentity spawngh_wobj
		trigger spawnstartax_wobj off

		setautospawn "Monastery" 1
		setautospawn "Guardhouse" 0
	}
}

I can get a bug this way:

  1. spawn as allies (capture the flag that you spawn next to, it makes no difference whether the allied flag is raised or not)
  2. manually select Monastery spawn, selfkill, spawn in Monastery
  3. spawn as axis
  4. go to flag, capture flag (which sets Guardhouse as autospawn for Axis), selfkill
  5. axis player spawns at Axis Start (whose wobj even got set invisible)
    :eek:

I mean, how on earth can the spawnselection of an allied player mess up the axis autospawns?
The only idea i have for this is that the allied Monastery spawn has the spawnnumber as the Axis Start spawn, and that that number gets stored somewhere and overrides the set autospawn.

Workaround #1:

// ----- AXIS FIRST SPAWN
spawnstartax_spawns
{
	spawn
	{
	}
	trigger off
	{
		setstate spawnstartax_spawns invisible
	}
}

spawnstartax_wobj // first Axis spawn - descr. "Axis Start"
{
	spawn
	{
		wait 50
		setstate spawnstartax_wobj default
	}
	trigger on
	{
		setstate spawnstartax_wobj default
	}
	trigger off
	{
		setstate spawnstartax_wobj invisible
	}
}

// ----- FLAG in GUARD HOUSE
spawngh_flag
{
	spawn
	{
		wait 150
		accum 2 set 1 // Allies have the flag at the start
		setautospawn "Axis Start" 0
		setautospawn "Guardhouse" 1
	}

	trigger allied_capture
	{
		accum 2 abort_if_equal 1 // allies own the flag already
		accum 2 set 1

		wm_objective_status	5 0 2
		wm_objective_status	5 1 1
		wm_announce "^1Allies have captured the Guardhouse Flag!"

		alertentity spawngh_wobj

		trigger spawnstartax_wobj on
		setstate spawnstartax_spawns default

		setautospawn "Axis Start" 0
		setautospawn "Guardhouse" 1
	}

	trigger axis_capture
	{
		accum 2 abort_if_equal 0 // axis already own the flag
		accum 2 set 0

		wm_objective_status	5 0 1
		wm_objective_status	5 1 2
		wm_announce "^1Axis have captured the Guardhouse Flag!"

		alertentity spawngh_wobj
		trigger spawnstartax_wobj off
		setstate spawnstartax_spawns invisible

		setautospawn "Monastery" 1
		setautospawn "Guardhouse" 0
	}
}

Difference: now I set the axis spawnboxes invisible when axis captures the flag. Only now I can get a bug this way:

  1. spawn as allies
  2. manually select Monastery spawn, selfkill, spawn in Monastery
  3. spawn as axis
  4. go to flag, capture flag, selfkill
  5. axis player spawns at Guardhouse (correct spawn… this is better now)
  6. spawn as allies (back on Monastery, of course)
  7. run to flag, recapture it (which sets autospawn guardhouse), selfkill
  8. allied player STILL spawns at Monastery
    :eek2:

Actually I think this situation can only happen in elaborate testing. Its very unlikely that on a server all the players will choose the back spawn and then recapture the flag. They will have lost the first stage before they get back to the flag.
Still, I d like to understand what s going on here… suggestions anyone?
(I can but hope spawns and flags will be better programmed in QW…)


(kamikazee) #2

I looked at the game code: setautospawn does not change the selected spawnpoint for all players, it just changes the default.

The code which is responsible for counting the player at a certain spot sugests that the player data includes a variable for saving the selected spawn point.
It allso seems that it has 2 states: 0 (no spawnpoint selected, spawn at autospawn point) and greater than zero (spawn at the selected point).

Now I haven’t found a snippet where this variable gets set to zero on team switch. If not, it will not use the default but the one closest to the selected one.

EDIT: I had a closer look, and I’d say the variable is only modified on map restarts, map changes, server starts and explicit spawnpoint changes.

So this means that the selected spawnpoint stays the same after switching teams. Since that spawnpoint is from the other team, another spawn point is looked up, closest to the selected one.
The only way to reset your spawnpoint to the default autospawn is by entering “/setspawnpt 0” (or an invalid spawn number like -1) into the console.


(kamikazee) #3

I just tried to recreate this bug. My map of choice was oasis, as it has a flag capture.
What I did was this:

  • start as axis
  • set spawnpoint to second spawn
  • switch to allies
  • capture old city and selfkill
    After that, I respawned near the ammo cabinets instead of the flag room. Allso, the spawn counts are not updated as I said.

I get the same results in ETPro as in etmain, and it seems that Bani nor Chruker found this out. Setting the selected spawn point to the default on team switch wouldn’t really hurt, or if it really matters a check could be made to see if that spawnpoint is possible for the freshly joined team.

My conclusion: rest on both ears (for as far that’s possible) as it seems a code bug. It must have slipped trough, most maps don’t give such a spectacular effect.


(]UBC[ McNite) #4

Thx for testing, saves me the testing :smiley:

So it is as I suspected already… well, chances are that nobody really will get into this trouble while playing.


(SCDS_reyalP) #5

This is exactly correct. Furthermore, the number used for /setspawnpt can be a TWO that belongs to the other team. All setautospawn does is change where those players with setspawnpt 0 will spawn. It doesn’t change their selected spawn (for good reason).

So this means that the selected spawnpoint stays the same after switching teams. Since that spawnpoint is from the other team, another spawn point is looked up, closest to the selected one.
The only way to reset your spawnpoint to the default autospawn is by entering “/setspawnpt 0” (or an invalid spawn number like -1) into the console.

Right again.


(mortis) #6

That’s an interesting tidbit. I had never thought about that…maybe it could be autoflushed to /setspawnpt 0 when switching teams via etpro?


(SCDS_reyalP) #7

Put it in your autoexec_<team> if you want :banana: