having trouble with cp spawning.


(Vitriol) #1

hello all, this is my first post here. unfortunately, i’m posting because of a bug in my map. in my map, i have a command post that acts as a forward spawn. when the axis control it, they should auto-spawn there, but still be able to select their secondary spawn. for the allies to take control of the forward spawn, they need to destroy the axis cp and build their own, or blow up a wall. if the wall is not blown, the axis should still be able to retake control of the cp and the spawn. however, once the wall is blown, i want the allies to spawn there regardless of who controls the cp. it all sort of works. except that the axis can spawn at the cp regardless of whether the wall is blown and regardless of who controls the cp. they can see both the axis cp spawn flag and the allies cp spawn flag from the limbo menu (though both flags appear as axis flags for the axis team, just that one says allies and one says axis). so, here is the script file i have for the map (much <3 to ifurita for this):

//Map script for [mapname] by Vitriol
//Command post prefab by Seven_DC, CP spawn scripting by Mean Mr. Mustard
//Tweaked by Ifurita

game_manager
	{
	spawn
		{
		accum 0 set 0
		accum 1 set 0

		//spawntimes & round length
		wm_axis_respawntime 15
		wm_allied_respawntime 10
		wm_number_of_objectives 2
		wm_set_round_timelimit 20

		//objectives
		//1 Lunchbox
		//2 Fake Wall
		//3 Build CP 

		//current main objectives for both teams (0=axis, 1= allies)

		wm_set_main_objective 1 0
		wm_set_main_objective 1 1

		//objective overview status indicators
		//wm_objective_status <objective> <team (0=axis, 1=allies)> <status 0=neutral 1=complete 2=failed)>

		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0

		//stopwatch mode defending team (0=axis, 1=allies)
		wm_set_defending_team 0

		//if the round time expires, the axis have won, so set the current winning team
		//set round winner (axis=0, allies=1)
		wm_setwinner 0

		wait 2000

		setautospawn	"Allied CP"	1 //Uses name from description field of team_WOLF_objective
		setautospawn	"Axis CP"	0
		}

	trigger objective_counter
		{
		accum 1 inc 1
		trigger game_manager checkgame
		}

	trigger checkgame
		{
		accum 1 abort_if_not_equal 1
		wm_setwinner 1

		wm_endround
		}
	}

//End of game_manager section ==========================================================

//Gold
	allied_gold
	{
		spawn
		{
			wait 200
			setstate allied_gold_captured invisible 
		}

		trigger stolen
		{
			setstate allied_gold_cm_marker invisible
		}

		trigger returned
		{
			setstate allied_gold_cm_marker default
		}

		trigger captured
		{
			wm_announce "The Allies have secured the gold"
			setstate allied_gold_red invisible
			setstate allied_gold_captured default

			// *----------------------------------- vo ------------------------------------------*
			wm_teamvoiceannounce 0 "axis_obj_secured"

			wm_teamvoiceannounce 1 "allied_obj_lost"
			// *----------------------------------- vo ------------------------------------------*

			wm_objective_status 		1 0 1
			wm_objective_status 		1 1 2
		}
	}

	allied_objectives  
	{	
	death
		{
			trigger game_manager objective_counter
		}
	}

// False Wall ========================================================================
wall_1
{	
	spawn

	{
		wait 200
		constructible_class 3
	}

	death
	
	{
		wm_announce "Allies have breached the false wall"

		wm_objective_status 1 0 1
		wm_objective_status 1 1 2

		setautospawn "Axis Spawn" 0

		trigger axis_cp_two kill
	}

}

//Constructible Barrier by Gold =================================================
dockpad_script
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 2 
		trigger self startup 
	} 

	buildstart final 
	{ 
	} 

	built final 
	{ 
		setstate dockpad_target default 
		setstate dockpad_materials invisible 
		wm_announce "The gold barrier has been built" 
	} 

	decayed final 
	{ 
		trigger self startup 
	} 

	death 
	{
		wm_announce "The Allies have breached the gold barrier" 
		setstate dockpad_materials default
		setstate dockpad_target invisible
	} 

	trigger startup 
	{ 
		setstate dockpad_target invisible
		setstate dockpad_materials default 
	} 
}
	
// ============================================================================ 
// NEUTRAL COMMAND POST =======================================================
// FROM Goldrush Thx SD!!! prefab by seven 2003 ===============================
// CP Spawn scripting by Mean Mr. Mustard =====================================
// ============================================================================ 

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		setstate allied_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate allied_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger allied_compost_built_model enable_allied_features

		enablespeaker allied_cp_speaker
		setstate allied_cp_two	default
		alertentity allied_cp_blob
	}

	decayed final
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features

		disablespeaker allied_cp_speaker
		alertentity allied_cp_blob
		setstate allied_cp_two	invisible		
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		sethqstatus 1 1

		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1
	}

	trigger disable_allied_features
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		wm_announce	"Axis team has destroyed the Allied Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		setstate axis_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate axis_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger axis_compost_built_model enable_axis_features

		enablespeaker axis_cp_speaker
		setstate axis_cp_two	default
		alertentity axis_cp_blob
	}

	decayed final
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		disablespeaker axis_cp_speaker
		setstate axis_cp_two invisible
		alertentity axis_cp_blob
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		sethqstatus 0 1

		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 3 0 1
		wm_objective_status 3 1 2
	}

	trigger disable_axis_features
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
	}
}

// ============================================================================ 
// Command Post Spawns ========================================================
// ============================================================================ 

allied_cp_two
{
	spawn
	{
		wait 100
		setstate allied_cp_two invisible
	}
}

axis_cp_two
{
	spawn
	{
		wait 100
		setstate axis_cp_two default
	}

	trigger kill
	{
		trigger axis_cp_two force_allied
		alertentity axis_spawn_wobj
		remove
	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1 // Do Allies already own flag?

		wm_objective_status 3 1 1
		wm_objective_status 3 0 2

		setautospawn "Allied CP" 1
		setautospawn "Axis Spawn" 0

		alertentity allied_cp_two

	}
}

if anyone can give me some help on how to fix the problem, i would much appreciate it.


(MadJack) #2

In the false_wall, shouldn’t


      setautospawn "Axis Spawn" 0 

Be


      setautospawn "Axis Spawn" 1

Instead? 0 = Axis and 1 = Allied. Same goes for axis_cp_two in the trigger force_allied…

Maybe I misunderstood what you want to do…


(Vitriol) #3

heheh, there is an excellent chance that i am the one misunderstanding what i want to do. i will try out your suggestion first thing tomorrow. thx for the quick response.


(Vitriol) #4

i made the changes you suggested, but i still get the same result. here is what the false wall script looks like now:

// False Wall ======================================================================== 
wall_1 
{    
   spawn 

   { 
      wait 200 
      constructible_class 3 
   } 

   death 
    
   { 
      wm_announce "Allies have breached the false wall" 

      wm_objective_status 1 0 1 
      wm_objective_status 1 1 2 

      setautospawn "Axis Spawn" 1 

      trigger axis_cp_two kill 
   } 

} 

and the end of the cp spawning section:


   trigger force_allied 
   { 
      accum 0 abort_if_equal 1 // Do Allies already own flag? 

      wm_objective_status 3 1 1 
      wm_objective_status 3 0 2 

      setautospawn "Allied CP" 1 
      setautospawn "Axis Spawn" 1

      alertentity allied_cp_two 

   } 
}


(Vitriol) #5

bump. still cant get it working.


(Vitriol) #6

i guess i’ll give up and just go with a flag/wall combo like in oasis.


(Mean Mr. Mustard) #7

The main problem is you started with something worked by Ifurita and myself :stuck_out_tongue: …I know my things are flawed. I can’t talk about Ifurita’s stuff, but I have seen his work…

I see no problem with your concept. It should work. And things look correct in the script. It could be a combination of entities and script ‘errors’. Iffy will probably bug you for the .map for me. It’s the best way to debug these things.


(Vitriol) #8

ah, i believe i sent iffy the .map when he originally tweaked the not-even-close-to-working script that i had (he probably started from scratch, mine was bad with a capital B and that rhymes with c which stands for “i Can’t script”), but i will certainly send him the most recent if he asks.


(Ifurita) #9

Post a link to the most recent .map file or you can e-mail it to me at michael@kan.org


(Vitriol) #10

i’m on it. i was lookin for you on irc, but you lagged out. gimme about 5 mins to upload it to an ftp.


(Vitriol) #11

ygm iffy.


(Vitriol) #12

it works, i’m so happy i’m pissing myself. thanks guys, i really appreciate it. i had to add setautospawn “Axis Spawn” 0 to the trigger axis_cp_two because the axis were still spawning at the cp when the cmd post was built, but once the wall was working it was easy to see where the problem was. much love for Mean Mr. Mustard and iffy. This puts me inches away from having a ‘complete’ version. :smiley:


(Ifurita) #13

Stupid head!

For the record, my contribution was the creation of the problem :smiley:


(Vitriol) #14

yea, but you also directed me to splashdamage.com, and i wouldnt have gotten even close had i still been using the script i had. <3


(seven_dc) #15

Nice of you iffy for directing people in right direction.
BTW Thank you for credits Vitrol.
Maybe you could make a prefab out of the CP spawnpoint/destroy wall system.


thai girl Cams


(Mean Mr. Mustard) #16

i had to add setautospawn “Axis Spawn” 0 to the trigger axis_cp_two because the axis were still spawning at the cp when the cmd post was built

I wasn’t sure where you wanted the initial spawn. It looked like you had it at the CP, so I left it.

Maybe you could make a prefab out of the CP spawnpoint/destroy wall system.

Be careful about that…since both Iffy and I had our hands in it (me twice), it’s probably unreliable and untrustworthy :wink:


(Vitriol) #17

you don’t want me doing anything that others might use. i have some brush prefabs of like statues, sleeping bags, and stuff like that; but nothing that requires more than a basic understanding.

btw Mr. Mustard, when i made that change, it made it so that in warmup the axis would spawn at the secondary spawn, not the cp. but when the round started they autospawned at the cp (which you are right about, that is supposed to be the initial spawn). i’m not going to worry about that at all, since the game would play how i want it to. just pointing out that slight difference. eh, now that i think about it, i may have made that change somewhere else. i looked at the false wall part of the script, and what that triggered to make the axis spawn at the secondary spawn. then i looked for the part of the script where the allies had the cp built, and added that line to that part of the script. so actually, it was probably in the “trigger kill” section of axis_cp_two. it’s all good though, i’m very excited about getting this project complete and starting a new one.


(Vitriol) #18

bump.
i’m still having troubles with this. i took out the part i added, just in case. so now the scriptfile is the same one that Mean Mr. Mustard had. the problem is that when an axis player starts the game spawning at the cp, they continue autospawning there the whole round, regardless of any of the other events (wall blown or allied cp built). i can’t test this myself either, because i cant start the game as axis AND blow the wall.


(Vitriol) #19

one thing i was thinking: should there be:

	trigger force_allied
	{
		accum 0 abort_if_equal 1 // Do Allies already own flag?

		wm_objective_status 3 1 1
		wm_objective_status 3 0 2

		setstate allied_cp_two	default
		setautospawn "Allied CP" 1
		alertentity allied_cp_blob

		setstate axis_cp_two invisible
		setautospawn "Axis Spawn" 0
		alertentity axis_spawn_blob

		remove
	}
}

the thing i added here was ‘alertentity axis_spawn_blob’ to force_allied. i’m not sure about this, so i might be completely wrong. i’ve tried several other variations of the script, adding force_allied here and there. now that i think about it though, forcing the allied spawn to cp doesn’t necessarily force the axis spawn to the secondary. ugh.


(Vitriol) #20

i found something that seems odd, here it is:


axis_cp_two
{
	spawn
	{
		wait 100
		setstate axis_cp_two default
		accum 0 set 0
	}

	trigger kill
	{
		trigger axis_cp_two force_allied
		setautospawn "Axis Spawn" 0
	}

	trigger alliedcp
	{
		accum 0 set 1
	}

	trigger alliednocp
	{
		accum 0 set 0
	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1 // Do Allies already own flag?

		wm_objective_status 3 1 1
		wm_objective_status 3 0 2

		setstate allied_cp_two	default
		setautospawn "Allied CP" 1
		alertentity allied_cp_blob

		setstate axis_cp_two invisible
		setautospawn "Axis Spawn" 0
		alertentity axis_spawn_blob

		remove
	}
}

in axis_cp_two, it sets the value of accum 0 to 0. axis_cp_two should be the condition where axis control the spawn if i’m not mistaken, however, in trigger kill it triggers axis_cp_two and force_allied. these conditions are opposites of each other, with axis_cp_two setting the cp to axis control, and force_allied setting the cp to allied control.