Scripting problem


(TF) #1

Hey, im having trouble making allies autospawn at the cp when they construct it. It doesnt work :confused: and i have no idea whats wrong

Here is the script:

////////////////
//game_manager//
////////////////
game_manager
{
	spawn
	{
		accum 1 set 0	//V2
		accum 2 set 0	//allies cp
		accum 3 set 0

		

		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	20
		wm_number_of_objectives 7
		wm_set_round_timelimit	20

		// Objectives
                // 1: Primary1 : Base Gate
                // 2: Primary2 : Forward Spawn
                // 3: Primary3 : Keycard
		// 4: Primary4 : V2
                // 5: Secondary1 : Side Door
                // 6: Secondary2 : Fence
                // 7: Secondary3 : Command Post

		
		// 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
                wm_objective_status 4 1 0
                wm_objective_status 4 0 0
                wm_objective_status 5 1 0
                wm_objective_status 5 0 0
                wm_objective_status 6 1 0
                wm_objective_status 6 0 0
                wm_objective_status 7 1 0
                wm_objective_status 7 0 0

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective 0 4
		wm_set_main_objective 1 4

		
		
		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// If the round timer expires, the Axis have won, so set the current winning team
		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner 0

		// Set starting spawns
		// The wait command after is VERY IMPORTANT for correct spawns!
		wait 150
		setautospawn "Forward Bunker" 0
   		setautospawn "Allied start" 1
		wait 350





	}




	trigger objective1
	{
		accum 1 set 1
		trigger game_manager checkgame


	}



	trigger checkgame
	{
		accum 1 abort_if_not_equal 1
		wm_setwinner 1
		wait 1000
		wm_endround
	}
}


v2rocket
{
	spawn
	{
		wait 300

		constructible_class 3
	}

	death
	{


		trigger game_manager objective1
		
		trigger v2rocket_model remove
		
		wm_announce	"Allies have destroyed the prototype rocket!"

		wm_teamvoiceannounce 0 "axis_obj_destroyed"
		wm_teamvoiceannounce 1 "allies_obj_destroyed"
		
		wm_objective_status         4 0 2
		wm_objective_status         4 1 1

	}
}

v2rocket_model
{
	trigger remove
	{
		remove
	}
}
////////
//BOOM//
////////
door1 // Base gate
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		wm_announce	"Allies have destroyed the base gate!"
		wm_teamvoiceannounce 0 "axis_main_destroyed"
		wm_teamvoiceannounce 1 "allies_main_destroyed"
		
		wm_objective_status         1 0 2
		wm_objective_status         1 1 1
		wm_set_main_objective        2 0
		wm_set_main_objective        2 1

	}
}

//////////
//spawn//
////////


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

	trigger axis_capture
	{
		accum 0 abort_if_equal 0
		accum 0 set 0

		// Axis takes control of forward flag

		//announcements
		wm_announce	"Axis reclaim the forward bunker!"
		wm_teamvoiceannounce 0 "axis_flag_reclaimed"
		wm_teamvoiceannounce 1 "allies_flag_reclaimed"


		alertentity forwardflag_wobj   
		setautospawn "Forward Bunker" 0
   		setautospawn "Allied start" 1
	}

	trigger allied_capture
	{
		accum 0 abort_if_equal 1
		accum 0 set 1

		// Allied takes control of forward flag

		// Some kind of UI pop-up to alert players
   		wm_announce	"Allies have captured the forward bunker!"
  		wm_teamvoiceannounce 0 "axis_flag_captured"
  		wm_teamvoiceannounce 1 "allies_flag_captured"

		alertentity forwardflag_wobj
   		setautospawn "Axis second spawn" 0
   		setautospawn "Forward Bunker" 1
	}
   
	trigger allies_keep
	{
      		//setstate allied_forward_spawnblob invisible
   		setautospawn "Axis second spawn" 0
   		setautospawn "Forward Bunker" 1
      		remove

		wm_objective_status         2 0 2
		wm_objective_status         2 1 1

		accum 0 abort_if_equal 1
		alertentity forwardflag_wobj
		alertentity bunker_spawns

	}
}

door_side // side entrance
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		wm_announce	"Allies have destroyed the side entrance!"
		wm_teamvoiceannounce 0 "axis_side_destroyed"
		wm_teamvoiceannounce 1 "allies_side_destroyed"

		wm_objective_status         5 0 2
		wm_objective_status         5 1 1
	}
}

fence
{
	spawn
	{
		wait 400
		trigger fence setup

		constructible_class 2
	}

	trigger setup
	{
		setstate fence_materials invisible
		setstate fence_materials_clip invisible
		setstate fence_flag invisible
		 

	}

	buildstart final
	{
		setstate fence_materials default
		setstate fence_materials_clip default
		setstate fence_flag default


	}

	built final
	{
		setstate fence_materials invisible
		setstate fence_materials_clip invisible
		setstate fence_flag invisible

		wm_announce "The Fence has been constructed!"

		wm_objective_status 6 1 0
                wm_objective_status 6 0 0

	}

	decayed final
	{
		setstate fence_materials default
		setstate fence_materials_clip default
		setstate fence_flag default

	}

	death
	{
		setstate fence_materials default
		setstate fence_materials_clip default
		setstate fence_flag default
		
		wm_announce "The Fence has been destroyed."

		wm_objective_status         6 0 2
		wm_objective_status         6 1 1

	}


}

/////////////////
//keycard_stuff//
////////////////
keycard
{

	spawn
	{
	wait 200
	setstate keycard_sec invisible
	setstate keycard_red default
	}

	trigger dropped
	{
	}

	
	trigger stolen
	{
	setstate keycard_cm invisible
	setstate keycard_track invisible
	}

	trigger returned
	{
	setstate keycard_cm default
	setstate keycard_track default
	}

	trigger captured
	{
	}
}

keycard_holder
{
	spawn
	{
	}
	death
	{
	wm_teamvoiceannounce 0 "axis_obj_captured"
	wm_teamvoiceannounce 1 "allies_obj_secured"
	
	wm_announce "Allies have secured the keycard!"
	wm_announce "Base door is opening!"
	trigger forward_spawn allies_keep
	wm_announce "Allies have secured the forward bunker!"
	setstate keycard_sec default
	setstate keycard_red invisible
	trigger basedoor_2 move_up

	wm_objective_status         3 0 2
	wm_objective_status         3 1 1
	}
}

basedoor_2
{
	spawn
	{
		wait 200
		gotomarker basedoor_down 1000
	}
	
	trigger move_up
	{
		wait 500
		playsound sound/movers/misc/garage_door_start_01.wav
		wait 400
		playsound sound/movers/misc/garage_door_loop_01.wav
		gotomarker basedoor_up 35
		stopsound
		playsound sound/movers/misc/garage_door_end_01.wav
	}
}


// ========================================
// ============ COMMAND POST ==============
// ========================================

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 allies_compost_sound
	}

	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 allies_compost_sound
		
		wm_objective_status 7 1 0
                wm_objective_status 7 0 0
	}
}

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
		
		trigger alliedcpspawns_obj on

		wm_announce	"Allied Command Post constructed. Charge speed increased!"
		
		wm_objective_status 7 1 1
                wm_objective_status 7 0 2

		accum 2 set 1

		setautospawn "Command post" 1

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

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

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


	}

	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!"

		accum 2 set 0

		// *----------------------------------- 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"
		// *---------------------------------------------------------------------------------*
		trigger alliedcpspawns_obj off


	}
}

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_compost_sound
	}

	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_compost_sound

		wm_objective_status 7 1 0
                wm_objective_status 7 0 0
	}
}

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!"
		
		wm_objective_status 7 1 2
                wm_objective_status 7 0 1

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

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

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

	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"
		// *---------------------------------------------------------------------------------*


	}

}


alliedcpspawns_obj
{
	spawn
	{
		wait 50
		setstate alliedcpspawns_obj invisible
		setstate alliedcpspawns invisible
	}

	trigger on
	{
		setstate alliedcpspawns_obj default
		setstate alliedcpspawns default
		alertentity alliedcpspawns
		wait 150
	}

	trigger off
	{
		setstate alliedcpspawns_obj invisible
		setstate alliedcpspawns invisible
		alertentity alliedcpspawns
	}
}

alliedcpspawns
{
	spawn
	{
		wait 50
		setstate alliedcpspawns invisible
	}
}

// *---END---*

And i also made screenshots of the keys that team_wolf_objective and ctf_bluespawn have:


(FireFly) #2

In the radar map the team_CTF_bluespawns near the cp have their “startactive” checkbox enabled.
Combined with the “invulnerable” checkbox enabled you should end up with key=spawnflags / value=3


(d3coy) #3

yes, i had trouble with it at first as well…

Make sure your spawns for allies are start active… then i just used setstate commands in my script to set them invisible to start and default when cp is built.

axiscpspawns_obj
{
	spawn
	{
		wait 50
		setstate axiscpspawns_obj invisible
		setstate axiscpspawns invisible
	}

	trigger on
	{
		setstate axiscpspawns_obj default
		setstate axiscpspawns default
	}

	trigger off
	{
		setstate axiscpspawns_obj invisible
		setstate axiscpspawns invisible
	}
}

axiscpspawns
{
	spawn
	{
		wait 50
		setstate axiscpspawns invisible
	}
}

As you can see… i use the command “trigger axiscpspawns_obj on” and “off” to handle this for me.

Not sure this is the most efficient way of doing it, but it works quite well for me.

****note mine is axis because the axis get the cp spawns in my map. But you could change it for allies.

Just remember to have your allied spawns startactive


(TF) #4

I set spawnflags 3 but still no luck :expressionless:
Spawn is enbled but you have to choose it from limbomenu or use spawnscript :confused:
d3coy,its same in my script :smiley: I just added “alertentity alliedcpspawns” to trigger on and off after i had a look at the adlernest script :smiley:


(nUllSkillZ) #5

Did you have a look at Goldrush map and script?
Haven’t read your script.
Are you alerting the team_WOLF_objective entities?


(TF) #6

no, team_ctf_bluespawn
when i alerted the team_WOLF_objective flag didnt appeared at all in command map after bulding the cp and there was no way you could spawn there :expressionless:
I’ve had a look at several map scripts. Getting more confused with each one :evil:


(C) #7

There is a local accum used in the game_manager script:

game_manager 
{ 
   spawn 
   { 
      accum 2 set 0   //allies cp

You try to set this accum in another script-block (I think):

allied_compost_built_model
   trigger enable_allied_features 
   {
      accum 2 set 1 

Try using a globalaccum instead…
(Allthough i can’t see You are using this accum 2 value anywhere)

There is a remove-command in the middle of a trigger-routine.
To me that doesn’t look logical, is the rest of the code still executed?..

forward_spawn 
{
   trigger allies_keep 
   { 
            //setstate allied_forward_spawnblob invisible 
         setautospawn "Axis second spawn" 0 
         setautospawn "Forward Bunker" 1 
            remove 

      wm_objective_status         2 0 2

If You want to force spawns to 1 team:

  • first alertentity the team_WOLF_objective,
  • (maybe alertentity the team_CTF_redspawn/team_CTF_bluespawn in case the other team is in control of the spawnpoint),
  • setautospawn the teams to the new spawnpoints
  • kill the team_WOLF_checkpoint (the flagpole, if You have one)

If You only want to show/hide a spawnpoint which belongs to 1 team only:

  • Check: startactive on the team_CTF_bluespawn/team_CTF_redspawn
  • setstate the team_WOLF_objective to default/invisible
  • and maybe setautospawn the team to its new spawnpoint

(TF) #8

i havent got to using this accum 2 because im having problems with these command post spawns.

Yes,everything after that remove is still executed and works fine :slight_smile:

Now,at the cp are spawns that are activated after allies construct the cp

As i understand the problem must be somewhere here


alliedcpspawns_obj
{
   spawn
   {
      wait 50
      setstate alliedcpspawns_obj invisible
      setstate alliedcpspawns invisible
   }

   trigger on
   {
      setstate alliedcpspawns_obj default
      setstate alliedcpspawns default
      alertentity alliedcpspawns
      wait 150
   }

   trigger off
   {
      setstate alliedcpspawns_obj invisible
      setstate alliedcpspawns invisible
      alertentity alliedcpspawns
   }
} 

alliedcpspawns_obj is the scriptname+targetname of the team_wolf_objective
alliedcpspawns is the scriptname+targetname of the team_ctf_bluespawn

This makes them both invisible when map starts so allies cant use this spawn

 spawn
   {
      wait 50
      setstate alliedcpspawns_obj invisible
      setstate alliedcpspawns invisible
   }

When allies cp is constructed


trigger alliedcpspawns_obj on

triggers this

   trigger on
   {
      setstate alliedcpspawns_obj default
      setstate alliedcpspawns default
      wait 150
      setautospawn "Command post" 1
   }

This should show team_CTF_bluespawn and team_WOLF_objective and set allied default spawn there
(Command post is the description of the team_WOLF_objective)

The problem is that allied default spawn doesnt change :confused: they keep on spawning at the old place unless they change their spawn to command post from the limbomenu.


(d3coy) #9

here is a complete prefab of what you want. Command post with allied spawns including the script.

Just modify the setspawns for the names of your other spawn locations, add the vo stuff from radar sounds script.

http://etdoa.com/decoy/cpspawns.rar