Scripting help needed :(


(lennyballa) #1

Could someone help me out? I want to make a dual objective map, but i don’t know how i can make it so that when Allies destroy something Allies win, when axis destroy something axis win. The allies have to destroy a communication tower (scriptname “radio”) and Axis have to destroy ammo (scriptname “75mm”) Could someone tell me how to script it? This is my current thing i use:

game_manager
{
spawn
{

// this lets you declare variables that are use to note down when objectives are completed 
accum 1 set 0 
accum 2 set 0 
accum 3 set 2 

// game rules are defined here with repsawn times & total rond time and the number of objectives
wm_axis_respawntime 15
wm_allied_respawntime 13
wm_number_of_objectives 3
wm_set_round_timelimit 16

// each team is declared as having 3 objectives 

// "3 0" means 3 objectives for team 0 which is axis 

// "3 1" means 3 objectives for team 1 which is allies
wm_set_main_objective 3 0
wm_set_main_objective 3 1

// set all objevtives to 0 for each team to say they aren't complete yet

// this works in the following way: <objective number> <team> <objective status>
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



// if stopwatch is set, this indicates the defending team
wm_set_defending_team 0

// if time expires, a defualt winner has to be chosen. Setting this to -1 means it ends as a draw
wm_setwinner 1

}

// this is called when the entity with "bridge" scriptname is desotryed and sets variables so the game manager can know objectives are completed
trigger objective2
{
wm_objective_status 1 0 1
wm_announce "Axis have destroyed the bridge"
accum 2 set 1
trigger game_manager checkgame2
}
trigger objective1
{
wm_objective_status 3 1 1
wm_announce "Allieds have destroyed the communication system!"
accum 1 set 1
trigger game_manager checkgame
}

// the 2 following functions are called to check is allies or axis have won the game

// this is achieved by testing the status of variables accum 1 & accum 2


trigger checkgame2
{
accum 2 abort_if_not_equal 1
wm_setwinner 0
wait 1500
wm_endround
}
trigger checkgame
{
accum 1 abort_if_not_equal 1
wm_setwinner 0
wait 1500
wm_endround
}
game_manager 
{ 
   spawn 
   { 
   } 
} 
radio 
{ 
   spawn 
   { 
      wait 200 
      constructible_class 3 
   } 

   death 
   { 
 trigger game_manager objective1
   } 
}

game_manager 
{ 
   spawn 
   { 
   } 
} 
75mm
{ 
   spawn 
   { 
      wait 200 
      constructible_class 3 
   } 

   death 
   { 
      trigger game_manager objective2
   } 
}

I also got some other scripting stuff about forward spawn and constructables, but i dont think thats necessary


(sock) #2

Try this script …

game_manager
{
	spawn
	{
		wm_axis_respawntime 15
		wm_allied_respawntime 13
		wm_number_of_objectives 3
		wm_set_round_timelimit 16

		wm_set_main_objective 3 0
		wm_set_main_objective 3 1

		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_set_defending_team 0
		wm_setwinner 1
	}

	trigger objective1
	{
		wm_objective_status 3 1 1
		wm_announce "Allieds have destroyed the communication system!"
		trigger game_manager checkgame
	}
	trigger objective2
	{
		wm_objective_status 1 0 1
		wm_announce "Axis have destroyed the bridge"
		trigger game_manager checkgame
	}
	trigger checkgame
	{
		wm_setwinner 0
		wait 1500
		wm_endround
	}
}	

radio 
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 3 
	} 

	death 
	{ 
		trigger game_manager objective1
	} 
}

75mm
{ 
	spawn 
	{ 
		wait 200 
		constructible_class 3 
	} 

	death 
	{ 
		trigger game_manager objective2
	} 
}

If you are creating dual objective that means that if either objective is complete then the match/game ends. So you don’t need to keep track of variables or check their status, if the primary dual objectives are destroyed (death function) then game over.

Also you are defining the “game_manager” entity 3 times, it should only be defined once at the top of the script. The primary objectives (radio,75mm) should start their own routines, not be part of the “game_manager” routine each time.

I stripped out all the comments so that it does not develop into some huge reply back to you. I’ll leave for you to put them back in.

Sock
:moo:


(lennyballa) #3

Thx sock for your reply now it wotrks :smiley: