Handle End Game

Handle End Game

STOP END GAME

Check if players are down


//place this in mapname.gsc main function 
level._game_module_game_end_check = &GameEndCheck;  

//place this at bottom of mapname.gsc 
function GameEndCheck() 
{  
  return false; 
}  
//to end the game when you want to add this in your script level notify("end_game"); 
//================================================================== 
//To check when players are downed just check:  
if(isdefined(self.laststand) && self.laststand)    

//To respawn and revive a player (self is the player here):  
self thread [[ level.spawnPlayer ]]();  
self ReviveMe();  

//you may want to take guns or something here...   
function ReviveMe() 
{
 self notify ( "player_revived", level ); 
 self notify ("stop_revive_trigger");
 self notify ( "death");         
 //requires #using scripts\shared\laststand_shared; at the top  
 self zm_laststand::revive_success(level,false);  
} 

Modify endgame text


Modify end game text add this to mapname.gsc main function  
level.custom_game_over_hud_elem = &Ending;  
level.wongame = false;

//set to true before ending the game if they won  
level.endgame_prefix = "Thanks For Playing!";  
level.classic_win = "You Escaped!";  
level.classic_lose = "Please Try Again."; 

//add this to bottom of mapname.gsc 
function Ending(player, game_over, survived) 
{  
  if(isdefined(level.gungamewinner))  
 {   
  text = level.gungamewinner + " Won!";  
 }  
 else if(level.wongame) 
 {   
  text = level.classic_win;
 }  
 else  
 {   
  text = level.classic_lose;
 }
 game_over.alignX = "center";
 game_over.alignY = "middle";
 game_over.horzAlign = "center";  
 game_over.vertAlign = "middle";  
 game_over.y -= 130;  
 game_over.foreground = true;  
 game_over.fontScale = 3;  
 game_over.alpha = 0;  
 game_over.color = ( 1.0, 1.0, 1.0 );  
 game_over.hidewheninmenu = true;  game_over SetText( level.endgame_prefix + " " + text );   game_over FadeOverTime( 1 );  
 game_over.alpha = 1;  if ( player isSplitScreen() )  {   
 game_over.fontScale = 2;   
 game_over.y += 40;  }   
 survived.alignX = "center";  
 survived.alignY = "middle";  
 survived.horzAlign = "center";  
 survived.vertAlign = "middle";  
 survived.y -= 100;  
 survived.foreground = true;  
 survived.fontScale = 2;  
 survived.alpha = 0;  
 survived.color = ( 1.0, 1.0, 1.0 );  
 survived.hidewheninmenu = true;  
 if ( player isSplitScreen() )  
 {   
  survived.fontScale = 1.5;   
  survived.y += 40;  
 } 
}