2Bit's Mapping Corner on www.PythonOnline.co.uk
ET Mapping Tutorial

Lesson 33

Topics

Making the game end
 
Making the game end
Back to main menu
Making the game end [Top]
The map will end when a winning team has been specified in the script, and the game ending conditions have been met.

The instruction wm_setwinner is used to specify the winning team:

  • -1 = No winning team specified yet
  • 0 = Axis win
  • 1 = Allies win

In the tutorial script, we have set wm_setwinner to 0 right at the start, so that if the game time expires, Axis will win.

What we will do is add some script to make the allies win if they blow the gate.

Open the tutorial.script file, and add this line at the end of the gate death trigger:

  • trigger game_manager allies_win

So when the gate is blown up, the last thing the death trigger does is call (execute) the allies_win trigger in the game_manager procedure.

Add this script after the closing "}" of the spawn trigger in the game_manager procedure, but before the closing "}" of the game_manager itself.:

trigger allies_win  
{  
  wm_announce "The Allies blew up the gate!"

wm_setwinner 1

wait 3000

wm_endround

}  
So if the allies succeed, an announcement is made, wm_setwinner is changed to 1, a 3 second delay to give people time to see it, and then the wm_endround instruction is executed, which forces the game to end now.

As you can see, there is no provision for a draw:  wm_setwinner is either 0 or 1 when the game ends.  If the timer expires and wm_setwinner is -1, then the game continues until you set it to 0 or 1, at which time the game immediately ends.

Next lesson