having trouble with cp spawning.


(Mean Mr. Mustard) #21

It may be odd, but it is correct :wink:

Let me explain what it is doing. accum 0 is the variable used to check if the allies own the CP spawn. Initially, they do not so it’s set to accum 0 set 0. If the allies build the CP, then ‘trigger alliedcp’ is called, which sets accum 0 to 1. If the allied CP is damaged, then accum 0 set 0 is enforced.

Why is this important? When the allies blow the false wall, they gain the forward spawn (regardless if the CP is axis, CP is allied or no CP is built). When the false wall is destroyed, it calls trigger axis_cp_two kill. This then calls axis_cp_two force_allied.

There are 2 conditions:

accum 0 = 0: This means allies do not have cp spawn, so set the the spawn locations.

accum 0 = 1: allies have cp spawn, so do not switch spawns since it’s already teh way it should be.


(Mean Mr. Mustard) #22

Ok, I ‘reworked’ the script to set the axis initial spawn at the Axis Spawn instead of the CP. I’ve tested it and conditions seem to work (of course, I can’t test all conditions).

So, Axis start at axis spawn. Allies start at allied spawn. If the cp is built, the construction team gets the cp spawn. If the cp is damaged, tehy are sent back to their original spawn. Once the wall is blown, allies get the CP spawn regardless of the state of the CP.

//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 Spawn"	1 //Uses name from description field of team_WOLF_objective
		setautospawn	"Axis Spawn"	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
		setautospawn "Allied CP" 1

		trigger allied_compost_built wall_notify
		trigger axis_compost_built wall_notify

		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
	
		accum 0 set 0		// state of false wall
	}

	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

		accum 0 abort_if_equal 1
		setstate allied_cp_two	default
		setautospawn "Allied CP" 1
		alertentity allied_cp_blob

		// needed if axis cp is never built 
		setstate axis_cp_two invisible
		setautospawn "Axis Spawn" 0

		trigger axis_cp_two alliedcp
	}

	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

		accum 0 abort_if_equal 1
		disablespeaker allied_cp_speaker
		setstate allied_cp_two invisible
		setautospawn "Allied Spawn" 1

		trigger axis_cp_two alliednocp
	}

	trigger wall_notify
	{
		accum 0 set 1
	}
}

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
		accum 0 set 0
	}

	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

		accum 0 abort_if_equal 1
		setstate axis_cp_two	default
		setautospawn "Axis CP" 0
	}

	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

		accum 0 abort_if_equal 1
		setstate axis_cp_two invisible
		setautospawn "Axis Spawn" 0
	}

	trigger wall_notify
	{
		accum 0 set 1
	}
}

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
		setautospawn "Axis Spawn" 0
	}
}

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

	trigger kill
	{
		trigger axis_cp_two force_allied
	}

	trigger alliedcp
	{
		accum 0 set 1
	}

	trigger alliednocp
	{
		accum 0 set 0
	}

	trigger force_allied
	{
wm_announce "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
		wait 100
		setautospawn "Allied CP" 1
		alertentity allied_cp_blob

		setstate axis_cp_two invisible
		setautospawn "Axis Spawn" 0

		remove
	}
}

(Vitriol) #23

awesome, thanks man.


(Vitriol) #24

still getting the same bug, only this way the axis have to build a cp at least once and spawn there, after that they keep spawning there. i tried taking the -setautospawn “Axis Spawn” 0- out of the axis cp built part, but that just made it so the axis had to select the spawn, it didnt keep them from spawning at the cp regardless of whether or not they owned it or if the wall was blown.
so, i guess i’ll give up on the cp and try something else. maybe a flag?


(Vitriol) #25

something else i’ve noticed, is that when the wall blows, it puts a check in the limbo menu where the allies take control of the axis cp, but not where they destroy the false wall. i’ll check my objdata file, but i have a feeling that it’s a script error.


(Mean Mr. Mustard) #26

I’ve tested it over and over. If the axis build the CP, they spawn there. If they cp is damaged, they are sent back to their rear spawn. :confused: Send the pk3 to Iffy and see what his tests show…


(Vitriol) #27

if you are testing it alone you wont get the bug. it only works if someone from the axis team is spawning at the cp before it is destroyed. i had to create a server on this puter, and connect from my other one to see it in action.


(Vitriol) #28

i’ve started work on the flag. hope all goes smoothly (of course i still have the other version saved).