destructible removing spawns


(evillair) #1

I have a capturable forward spawn;
I want when the ‘main door’ is destroyed that the forward spawn goes to allies and it removes the axis spawn.

The problem I am having is that everything works well except if allies already have the forward spawn captured.
It works if Axis captured the spawn.
It works fine if no one has touched the flag.

If allies has the spawn captured and the main door is destroyed;
1- the allies flag is removed from the command map
2- the axis can still select it and spawn there.

Here’s the script sections that pertains to these functions;

The code that sets the forward spawn to allies when the main door is destroyed: (this is in game_manager)


trigger allies_broke_door
	{
		accum 2 abort_if_not_equal 0

		wm_announce "Allied team has breached the Main Door and secured the Forward Shack!"

		alertentity forwardbunker_spawns 	//alert the spawns
		alertentity forwardbunker_wobj		
		setautospawn "Axis Main Bunker" 0 //set to axis
		setautospawn "Forward Bunker"	1 //set to allies
		
		wm_objective_status 2 1 1
		wm_objective_status 2 0 0
		wm_objective_status 3 1 1
		wm_objective_status 3 0 0
	
		trigger forwardbunker_flag kill // kill flag

	}

The main door code:


bigwall_01 // main door
{
	spawn
	{
		//accum 2 set 1 //sets wall alive
		wait 200
		constructible_class 3
	}

	death
	{
		accum 2 set 0 //sets wall is broke
		trigger game_manager allies_broke_door

	}
}


Finaly the forward spawn code:


trigger forwardbunker_flagblue
	{
		// Some kind of UI pop-up to alert players
		wm_announce	"Allies capture the Forward Bunker!"

		wm_objective_status	3 1 1
		wm_objective_status	3 0 0
		
		setautospawn "Forward Bunker"	1 //set to allies

	}

trigger forwardbunker_flagred
	{
		// Some kind of UI pop-up to alert players
		wm_announce	"Axis capture the forward Bunker!"

		wm_objective_status	3 1 0
		wm_objective_status	3 0 1
		
		setautospawn "Forward Bunker"	0 //set to axis

	}
}

// ============    the above is in game_manager ==============

//*========--------- obj 3 ----------=========*//
forwardbunker_spawns
{
	spawn
	{
	}
}

forwardbunker_wobj
{
	spawn
	{
	}
}

forwardbunker_flag
{
	spawn
	{
		accum 0 set 0	// Who has the flag: 0-Axis, 1-Allied
	}

	trigger allied_capture
	{
		accum 0 abort_if_equal 1 // do Allies own flag?

		trigger game_manager forwardbunker_flagblue

		setstate forwardbunker_spawns default
		setstate forwardbunker_wobj default

		trigger forwardbunker_flag setallies

	}

	trigger setallies
	{
		accum 0 abort_if_equal 1
		accum 0 set 1

		alertentity forwardbunker_wobj
		alertentity forwardbunker_spawns
	}

	trigger axis_capture
	{
		accum 0 abort_if_equal 0 // do Axis own flag?

		trigger game_manager forwardbunker_flagred

		setstate forwardbunker_spawns default
		setstate forwardbunker_wobj default
		
		//setstate flag_base default

		trigger forwardbunker_flag setaxis

	}

	trigger setaxis
	{
		accum 0 abort_if_equal 0
		accum 0 set 0

		alertentity forwardbunker_wobj
		alertentity forwardbunker_spawns
	}

	trigger kill
	{
		remove
	}
	

}


Any help in figuring this out will be much appreciated.

It’s probably something silly but I have been trying to get this to work for 2 days. :\


(Mlehliw) #2

In your allies_broke_door function you have alertentity in there; so if the allies already have captured the flag and that function gets called the axis get control of the spawn point (I think). So I would use a globalaccum which tells what team has the flag then making some sort of code like this.

trigger allies_broke_door 
   { 
      accum 2 abort_if_not_equal 0 

      wm_announce "Allied team has breached the Main Door and secured the Forward Shack!" 

      
      wm_objective_status 2 1 1 
      wm_objective_status 2 0 0 
      wm_objective_status 3 1 1 
      wm_objective_status 3 0 0 
    
      trigger forwardbunker_flag kill // kill flag 

      globalaccum 1 abort_if_equal 0

      alertentity forwardbunker_spawns    //alert the spawns 
      alertentity forwardbunker_wobj       
      setautospawn "Axis Main Bunker" 0 //set to axis 
      setautospawn "Forward Bunker"   1 //set to allies 
       
   } 

Then if the allies happen to have the flag all that superfluous code won’t be called.


(evillair) #3

It worked great with the code you supplied but now when axis has the flag it does the same thing as before.

It’s reversed.


(Blackadder_NZ) #4

You’ve looked at the Oasis .script?


(Mlehliw) #5

I was hoping that you would have catched it :wink: but you have to set the globalaccums properly in the flag capture portion of the script otherwise it will do exactly as you said.

In the trigger allied_capture put
globalaccum 1 set 0

In the trigger axis_capture put
globalaccum 1 set 1

Then somewhere at the beginning of the script in the game_manager put
globalaccum 1 set 1

Hopefully that will straighten it out :slight_smile:


(evillair) #6

That worked great, thanks alot!

I actualy thought of that after I posted and rechecked the script; "where is the globalaccum set?: :stuck_out_tongue:


(sock) #7

In the map OASIS the entity “oldcityflag” (line 159-243) keeps track of the status of the flag with a local variable. The variable is defined in the spawn function (Line 161-164). Everytime the Axis/Allied touch the flag, the variable is kept up to date. (Line 168-171 and 195-197) Finally when it is time to swap the spawnpoint the function “trigger force_allied” is called (Line 231-237) which checks this local variable and then switches the spawnpoints/wolf objective around to suit the allies. If the flag does not need switching around then nothing happens and the spawnpoint remains with the allies.

Sock
:moo: