Need help with script.


(stebbi67) #1

I have been trying to get the map to end, which I’m making, when I have completed all objectives on it, but it just will not end. I have tried to find out where the flaw is and made a few versions of this script but it does not work. I know that there is a tiny flaw in it and this is not like a rocket science to get a small script to work, I mean it is not like I’m writing a new OS. But my tiny brain seams not to be build with enough “brain power” to complete the task. And I know when some one will point out the flaw I will do some head banging to the wall in my frustration why I did not see it.

Ok, here are some info. The map has two primary objectives which the allies has to destroy ( dyno ) to complete the map. One is called script_ammo01 and the other rocketblast.

Here is the code :


game_manager
{

	// Initialising

	// When game starts
	spawn
	{
		// Level initialisation
		remapshaderflush		

		wm_set_round_timelimit 20
		wm_setwinner 0		
		wm_axis_respawntime 25
		wm_allied_respawntime 20

		// Set Defending Team for SW Mode
		wm_set_defending_team 0
		
		accum 1 set 0
		accum 2 set 0

		// Set objectives
		// 0:blank|1:tick|2:cross
		// Allies = 1, Axis = 0
		// Objectives
		// 1: North wall
		// 2: south wall
		// 3: Ammo storage
		// 4: Command Post
		// 5: Rocket
		
		wm_number_of_objectives 2


		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
						
					
		wait 2000	

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

		wm_addteamvoiceannounce 1 "allied_dest_doors"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"		
		// *---------------------------------------------------------------------------------*							
		
	}

	trigger end_blow
	{
		wait 1000
		alertentity atnt
		alertentity xtnt
		alertentity atnt4
		alertentity xtnt4
		wait 1000
		alertentity atnt3
		alertentity xtnt3
		wait 2000
		alertentity atnt2
		alertentity xtnt2
	}
	
	trigger checkgame
	{
		accum 1 abort_if_not_equal 1
		accum 2 abort_if_not_equal 1

		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner 1

		wait 1500

		// End the round
		wm_endround
	}
}



script_ammo01
{
	spawn // this is called when the game starts and the entity is spawned
	{
		wait 200
		constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity...
		accum 5 set 0
	}

	death // this is called when the entity is destroyed...
	{
		wm_announce "Allies have destroyed the ammo bunker!" // ... when the entity is destroyed, you annouce the message to all players in game with this
		wm_objective_status 3 0 2
		wm_objective_status 3 1 1
		accum 1 set 1
		trigger game_manager checkgame
	}
}

rocketblast
{
	spawn // this is called when the game starts and the entity is spawned
	{
		wait 200
		constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity...
		accum 5 set 0
	}

	death // this is called when the entity is destroyed...
	{
		wm_announce "Allies have destroyed the rocket!" // ... when the entity is destroyed, you annouce the message to all players in game with this
		wm_objective_status 5 0 2
		wm_objective_status 5 1 1
		accum 2 set 1
		trigger game_manager checkgame
		
	}

}


Now when I destroy the ammo01 I get messages that allies has destroyed the ammo bunker and the same when I destroy the rocket I get the message that allies has destroyed the rocket, so it seams like the checkgame trigger does not work. Just some info, when doing this script I tried to imitate some of the tc_base script.

Thanks,

Stebbi67


(S14Y3R) #2

hi, the accums in your game_manager have nothing to do with the accums in your func_consructibles. You should use globalaccum instead, well because they’re global.

just add global infront or the accum 1 & 2’s(assuming you aren’t using globalaccum 1 or 2 somewhere else):


 trigger checkgame
   {
      globalaccum 1 abort_if_not_equal 1
      globalaccum 2 abort_if_not_equal 1

      // Set the round winner:  0 == AXIS, 1 == ALLIED
      wm_setwinner 1

      wait 1500

      // End the round
      wm_endround
   }
 

…and in these too:


script_ammo01
{
   spawn // this is called when the game starts and the entity is spawned
   {
      wait 200
      constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity...
      globalaccum 1 set 0 
   }

   death // this is called when the entity is destroyed...
   {
      wm_announce "Allies have destroyed the ammo bunker!" // ... when the entity is destroyed, you annouce the message to all players in game with this
      wm_objective_status 3 0 2
      wm_objective_status 3 1 1
      globalaccum 1 set 1
      trigger game_manager checkgame
   }
}

//===============
//===============

rocketblast
{
   spawn // this is called when the game starts and the entity is spawned
   {
      wait 200
      constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity...
      globalaccum 2 set 0
   }

   death // this is called when the entity is destroyed...
   {
      wm_announce "Allies have destroyed the rocket!" // ... when the entity is destroyed, you annouce the message to all players in game with this
      wm_objective_status 5 0 2
      wm_objective_status 5 1 1
      globalaccum 2 set 1
      trigger game_manager checkgame
      
   }

}

so that’s why it doesn’t work. gl


(stebbi67) #3

I have always said that people from Canada are the most gifted one.

Thank you S14Y3R, your suggestion did the trick :drink: