Neutral forward spawn question?


(SteelRat) #1

I am fixing some minor bugs on V2 Base since it is going to be a tournament map and I have stumbled onto a problem that I am unable to solve even though I have been reading a lot of posts here in the forum on the topic.

Currently the Fortress spawn belong to axis at map start (spawnflags 1) and autospawn is set to the default spawn for Axis. Both spawnpoints show up on the command map and you can select both, although if you select the Fortress Spawn that is the forward spawn point you still spawn at the default spawn. If you then as axis run up and touch the pole then you will be able to spawn there.

What I really would like is a totally neutral forward spawn point that does not show up on the command map until you have captured it. I played around with this but if I don’t select a team owner for the forward spawn flag then the alertentity forwardspawn1_wobj does not work and no flag pops up on the command map.

I have been reading the level designers reference as well as socks good posts on the topic but am still unable to get this working, does anybody have an idea how to create a neutral forward spawn and still get the command map markers to work?

here is a snip from my script

// ================================================
// ============    FORWARD SPAWN     ==============
// ================================================

forward_spawn
{
	spawn
	{
	accum 4 set 0	// 0-Axis, 1-Allied
	}
	trigger axis_capture
	{
		accum 4 abort_if_not_equal 1
		accum 4 set 0
		alertentity forwardspawn1_wobj
		setautospawn	"Fortress Spawn"	0
		setautospawn	"Allied Spawn"	1
		trigger game_manager axis_flag
	}

	trigger allied_capture
	{
		accum 4 abort_if_not_equal 0
		accum 4 set 1
		alertentity forwardspawn1_wobj
		setautospawn	"Axis Spawn"	0
		setautospawn	"Fortress Spawn"	1
		trigger game_manager allies_flag
	}
}

/SteelRat


(Mean Mr. Mustard) #2

I believe you can control the CM flag with a setstate ‘spawnTWO-name’ default/invisible. You might have to give an ‘owner’ initially and then setstate ‘spawnTWO-name’ invisible.

I think I have a little test map with a forward spawn. I’ll mess with it and see if I can figure out the mechanics (I know I did what you wanted before…)


(Mean Mr. Mustard) #3

Ok…I think I have it…

First, check both ‘default allies’ and ‘default axis’ for the forwardspawn1_wobj (spawnflags 3)

Then here is a script that worked for me: (part of this is from Ifurita and part from me - I can’t remember who did what) Also, we named ours forwardflag_wobj

// FORWARD SPAWN POINT ================================================
forward_spawn
{
	spawn
	{
		wait 200
		setstate forwardflag_wobj invisible
		accum 0 set 0
	}

	trigger axis_capture
	{
		trigger game_manager forwardflagred
		trigger forward_spawn setaxis
	}

	trigger allied_capture
	{
		trigger game_manager forwardflagblue
		trigger forward_spawn setallies
	}

	trigger setaxis
	{
		setstate forwardflag_wobj default
		accum 0 abort_if_equal 0
		accum 0 set 0
		alertentity forwardflag_wobj
	}

	trigger setallies
	{
		setstate forwardflag_wobj default
		accum 0 abort_if_equal 1
		accum 0 set 1
		alertentity forwardflag_wobj
	}
}

(SteelRat) #4

Thanks Mustard, you got me thinking along the right paths :slight_smile:

I found the solution, see code posted.
I realised that if you capture the flag as axis the alertentity forwardspawn1_wobj actually swapped the flag to being not captured and if you have no spawnflags set the alertentity event does not work. So I came up with this idea using accum 9 to see if Allies have captured the flag once, since if that has happened the alertentity will toggle the flag properly. :smiley:

This now works, I have tested it from all teams in all combinations.

// ================================================
// ============    FORWARD SPAWN     ==============
// ================================================

forward_spawn
{
	spawn
	{
	wait 200
	accum 4 set 0	// 0-Axis, 1-Allied
	accum 9 set 0    // 
	setstate forwardspawn1_wobj invisible
	}
	trigger axis_capture
	{
		trigger forward_spawn setaxis
		trigger game_manager axis_flag
	}

	trigger allied_capture
	{
		trigger forward_spawn setallies
		trigger game_manager allies_flag
	}
	trigger setallies
	{
	accum 4 abort_if_not_equal 1
	accum 4 set 0
	setstate forwardspawn1_wobj default	
	setautospawn	"Fortress Spawn"	0
	setautospawn	"Allied Spawn"	1
	alertentity forwardspawn1_wobj
	accum 9 set 1 // Allies have captured the flag at least once
	}
	trigger setaxis
	{
	accum 4 abort_if_not_equal 0
	accum 4 set 1
	setstate forwardspawn1_wobj default
	setautospawn	"Axis Spawn"	0
	setautospawn	"Fortress Spawn"	1
	accum 9 abort_if_less_than 1
      alertentity forwardspawn1_wobj
	}
}

/SteelRat


(sock) #5

Ummm what a cool idea :smiley: Must add this to the LDR at some point as one of the possible variants of the Forward Command Post.

Sock
:moo:


(SteelRat) #6

Sock, I fixed this script using your examples available here:
Initially Allies controlled: http://www.planetquake.com/simland/ldr1_1/samplemap07a.htm
Initially Axis controlled: http://www.planetquake.com/simland/ldr1_1/samplemap07b.htm
Permenant switch: http://www.planetquake.com/simland/ldr1_1/samplemap07c.htm

This new map/script flagpole is neutral from the start of the map, then after Allies have blowed the wall Allies spawn will be permanently moved to the flag position as in the “Permanent switch” example.

I had to add some logic to keep track of conditions before someone captures the flag to make sure the right icon is displayed on the command map.

Here is the new code:

// ============================================================================
game_manager 
{ 
	spawn
	{
		wait 50				// Wait for all entities to spawn
	}
} 

// ============================================================================
// Forward Spawn point - Initially neutral
//
// ============================================================================
forwardspawn1_flag
{
	spawn
	{
		wait 200
		accum 0 set 2			// Who owns flag: 0-Axis, 1-Allied
		accum 9 set 0			// Axis have not captures flag once yet
		accum 8 set 0			// Allies have not captured flag once yet
		setstate forwardspawn1_wobj invisible //remove Axis flag command map marker until captured
	}
	trigger axis_capture				// Touched by an Axis player
	{
		accum 0 abort_if_equal 0 		// do Axis own flag?
		accum 0 set 0 				// Axis own the flag
		wm_announce "Axis reclaim the Forward Spawn!"
		setstate forwardspawn1_wobj default
		setautospawn "Forward Spawn"	0	// Set Axis to forward spawn
		alertentity forwardspawn1_wobj		// Switch command map marker
		accum 8 abort_if_equal 1			// Abort if Allies have captured flag once
		accum 9 abort_if_equal 1			//Abort if axis have captured flag once
		alertentity forwardspawn1_wobj
		accum 9 set 1					//Allies have captured at least once
	}

	trigger allied_capture				// Touched by an allied player
	{
		accum 0 abort_if_equal 1 		// do Allies own flag?
		accum 0 set 1 				// Allies own the flag
		wm_announce "Allies capture the Forward Spawn!"
		setstate forwardspawn1_wobj default
		alertentity forwardspawn1_wobj	// Switch command map marker
		setautospawn "Forward Spawn"	1	// Set Allies to forward spawn
		accum 8 set 1				//Allies have captured flag at least once
	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1 			// Do Allies own the flag?
		alertentity forwardspawn1_wobj		// Switch command map marker
		alertentity forwardspawn1_spawns		// Switch all spawnpoints
		setautospawn "Forward Spawn"	1		// Set Allies to forward spawn
	}
	trigger kill
	{
		remove				// Remove self (flag model)
	}
}

dynamiteobj1
{
	spawn
	{
		wait 100				// Wait for all entities to spawn
		constructible_class 3			// Dynamite only
	}

	death
	{
		trigger forwardspawn1_flag force_allied 	// Switch forward spawn to Allied ONLY
		trigger forwardspawn1_flag kill		// Remove entities
		setstate forwardspawn1_base invisible	// Remove base of flag

		wm_announce "Allies have destroyed the Dynamite Objective 1"
	}
}


I created an example map for this if anyone is interested:
http://www.srcgaming.com/downloads/et/prefabs/spawnp.zip

Cheers,
SteelRat


(Loffy) #7

A nice prefab. Thx Steelrat.
// Loffy


(Ifurita) #8

I tried a variant of that script with no luck. Here’s the script I’m using:

The Allied portion seems to work fine, but the axis part isn’t registering. I get the wm_announce message, but that’s it. I won’t change the flag icon, doesn’t change the custom command map image, doesn’t register the change in global accum.

The scriptname on the flag is checkpoint03, the targetname on the TWO is forwardflag_wobj. Any thoughts


checkpoint03
{
   	spawn 
   	{ 
      		wait 200 
      		accum 0 set 2         // Who owns flag: 0-Axis, 1-Allied 
      		accum 9 set 0         // Axis have not captures flag once yet 
      		accum 8 set 0         // Allies have not captured flag once yet 
      		setstate forwardflag_wobj invisible //remove Axis flag command map marker until captured 
   	} 

   	trigger axis_capture            // Touched by an Axis player 
   	{ 
      		accum 0 abort_if_equal 0       // do Axis own flag? 
      		accum 0 set 0             // Axis own the flag 
      		wm_announce "Axis have captured the Hotel De Ville" 

      		setstate forwardflag_wobj default 
      		alertentity forwardflag_wobj      // Switch command map marker 

		remapshader "gfx/breakout/flag3neutral" "gfx/breakout/flag3axis"
		remapshader "gfx/breakout/flag3allied" "gfx/breakout/flag3axis"
		remapshaderflush
      		setautospawn "Hotel De Ville"   0   // Set Axis to forward spawn 

		globalaccum 1 inc -1
		globalaccum 2 inc 1
		trigger game_manager axis_checkgame

      		accum 8 abort_if_equal 1         // Abort if Allies have captured flag once 
      		accum 9 abort_if_equal 1         //Abort if axis have captured flag once 
      		alertentity forwardflag_wobj 
      		accum 9 set 1               //Axis have captured at least once 
   	} 

   	trigger allied_capture            // Touched by an allied player 
   	{ 
      		accum 0 abort_if_equal 1       // do Allies own flag? 
     		accum 0 set 1             // Allies own the flag 
      		wm_announce "Allies capture the Hotel De Ville" 

		remapshader "gfx/breakout/flag3neutral" "gfx/breakout/flag3allied"
		remapshader "gfx/breakout/flag3axis" "gfx/breakout/flag3allied"
		remapshaderflush

		globalaccum 1 inc 1
		globalaccum 2 inc -1
		trigger game_manager allied_checkgame

      		setstate forwardflag_wobj default 
      		alertentity forwardflag_wobj   // Switch command map marker 
      		setautospawn "Hotel De Ville"   1   // Set Allies to forward spawn 
      		accum 8 set 1            //Allies have captured flag at least once 
   	} 
}


(G0-Gerbil) #9

Sorry, I read this through and I’m still a bit confused - what’s the current problem?
I’ve had plenty of ‘fun’ myself with spawn flags in helmsdeep, so might be able to help if I understand the latest issue?