#include maps\mp\_utility; #include maps\mp\gametypes\_hud_util; /* War Objective: Score points for your team by eliminating players on the opposing team Map ends: When one team reaches the score limit, or time limit is reached Respawning: No wait / Near teammates Level requirementss ------------------ Spawnpoints: classname mp_tdm_spawn All players spawn from these. The spawnpoint chosen is dependent on the current locations of teammates and enemies at the time of spawn. Players generally spawn behind their teammates relative to the direction of enemies. Spectator Spawnpoints: classname mp_global_intermission Spectators spawn from these and intermission is viewed from these positions. Atleast one is required, any more and they are randomly chosen between. */ /*QUAKED mp_tdm_spawn (0.0 0.0 1.0) (-16 -16 0) (16 16 72) Players spawn away from enemies and near their team at one of these positions.*/ /*QUAKED mp_tdm_spawn_axis_start (0.5 0.0 1.0) (-16 -16 0) (16 16 72) Axis players spawn away from enemies and near their team at one of these positions at the start of a round.*/ /*QUAKED mp_tdm_spawn_allies_start (0.0 0.5 1.0) (-16 -16 0) (16 16 72) Allied players spawn away from enemies and near their team at one of these positions at the start of a round.*/ main() { if(getdvar("mapname") == "mp_background") return; maps\mp\gametypes\_globallogic::init(); maps\mp\gametypes\_callbacksetup::SetupCallbacks(); maps\mp\gametypes\_globallogic::SetupCallbacks(); registerRoundSwitchDvar( level.gameType, 0, 0, 9 ); registerTimeLimitDvar( level.gameType, 10, 0, 1440 ); registerScoreLimitDvar( level.gameType, 500, 0, 5000 ); registerRoundLimitDvar( level.gameType, 1, 0, 10 ); registerWinLimitDvar( level.gameType, 1, 0, 10 ); registerRoundSwitchDvar( level.gameType, 3, 0, 30 ); registerNumLivesDvar( level.gameType, 0, 0, 10 ); registerHalfTimeDvar( level.gameType, 0, 0, 1 ); level.teamBased = true; level.onStartGameType = ::onStartGameType; level.getSpawnPoint = ::getSpawnPoint; level.onNormalDeath = ::onNormalDeath; //level.onTimeLimit = ::onTimeLimit; // overtime not fully supported yet game["dialog"]["gametype"] = "tm_death"; if ( getDvarInt( "g_hardcore" ) ) game["dialog"]["gametype"] = "hc_" + game["dialog"]["gametype"]; else if ( getDvarInt( "camera_thirdPerson" ) ) game["dialog"]["gametype"] = "thirdp_" + game["dialog"]["gametype"]; else if ( getDvarInt( "scr_diehard" ) ) game["dialog"]["gametype"] = "dh_" + game["dialog"]["gametype"]; else if (getDvarInt( "scr_" + level.gameType + "_promode" ) ) game["dialog"]["gametype"] = game["dialog"]["gametype"] + "_pro"; game["strings"]["overtime_hint"] = &"MP_FIRST_BLOOD"; } onStartGameType() { setClientNameMode("auto_change"); if ( !isdefined( game["switchedsides"] ) ) game["switchedsides"] = false; if ( game["switchedsides"] ) { oldAttackers = game["attackers"]; oldDefenders = game["defenders"]; game["attackers"] = oldDefenders; game["defenders"] = oldAttackers; } setObjectiveText( "allies", &"OBJECTIVES_WAR" ); setObjectiveText( "axis", &"OBJECTIVES_WAR" ); if ( level.splitscreen ) { setObjectiveScoreText( "allies", &"OBJECTIVES_WAR" ); setObjectiveScoreText( "axis", &"OBJECTIVES_WAR" ); } else { setObjectiveScoreText( "allies", &"OBJECTIVES_WAR_SCORE" ); setObjectiveScoreText( "axis", &"OBJECTIVES_WAR_SCORE" ); } setObjectiveHintText( "allies", &"OBJECTIVES_WAR_HINT" ); setObjectiveHintText( "axis", &"OBJECTIVES_WAR_HINT" ); level.spawnMins = ( 0, 0, 0 ); level.spawnMaxs = ( 0, 0, 0 ); maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" ); maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" ); maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" ); maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" ); level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs ); setMapCenter( level.mapCenter ); allowed[0] = level.gameType; allowed[1] = "airdrop_pallet"; maps\mp\gametypes\_gameobjects::main(allowed); } getSpawnPoint() { spawnteam = self.pers["team"]; if ( game["switchedsides"] ) spawnteam = getOtherTeam( spawnteam ); if ( level.inGracePeriod ) { if ( getDvar( "mapname" ) == "mp_shipment_long" ) { spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_cha_spawn_" + spawnteam + "_start" ); spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints ); } else { spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_tdm_spawn_" + spawnteam + "_start" ); spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints ); } } else { spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam ); spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints ); } return spawnPoint; } onNormalDeath( victim, attacker, lifeId ) { score = maps\mp\gametypes\_rank::getScoreInfoValue( "kill" ); assert( isDefined( score ) ); attacker maps\mp\gametypes\_gamescore::giveTeamScoreForObjective( attacker.pers["team"], score ); if ( game["state"] == "postgame" && game["teamScores"][attacker.team] > game["teamScores"][level.otherTeam[attacker.team]] ) attacker.finalKill = true; } onTimeLimit() { if ( game["status"] == "overtime" ) { winner = "forfeit"; } else if ( game["teamScores"]["allies"] == game["teamScores"]["axis"] ) { winner = "overtime"; } else if ( game["teamScores"]["axis"] > game["teamScores"]["allies"] ) { winner = "axis"; } else { winner = "allies"; } thread maps\mp\gametypes\_gamelogic::endGame( winner, game["strings"]["time_limit_reached"] ); }