Browse Source

First Commit

main
Chase 3 weeks ago
commit
fc79a7a6cb
8 changed files with 12581 additions and 0 deletions
  1. 12
      .github/FUNDING.yml
  2. 8
      README.md
  3. 673
      mp_killcam/maps/mp/gametypes/_finalkills.gsc
  4. 7705
      mp_killcam/maps/mp/gametypes/_globallogic.gsc
  5. 1199
      mp_killcam/maps/mp/gametypes/_rank.gsc
  6. 1932
      mp_killcam/maps/mp/gametypes/_weapons.gsc
  7. 887
      mp_killcam/maps/mp/gametypes/sd.gsc
  8. 165
      mp_killcam/maps/mp/gametypes/tdm.gsc

12
.github/FUNDING.yml

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ChxseH]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://chse.xyz/donate']

8
README.md

@ -0,0 +1,8 @@
# Final Killcam Mod for CoD: WAW
![Screenshot](https://i.imgur.com/X8xGBPA.png)
Credits:
* FzBr.d4rk - Original CoD4 Final Killcam mod that some code was taken from
* Matrix - Port to WAW
* Chase - Fixing some bugs & shrinking total size

673
mp_killcam/maps/mp/gametypes/_finalkills.gsc

@ -0,0 +1,673 @@
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
#include common_scripts\utility;
init()
{
level.killcam_style = 0;
level.fk = false;
level.showFinalKillcam = false;
level.waypoint = false;
level.doFK["axis"] = false;
level.doFK["allies"] = false;
level.slowmotstart = undefined;
OnPlayerConnect();
}
OnPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread beginFK();
}
}
beginFK()
{
self endon("disconnect");
for(;;)
{
self waittill("beginFK", winner);
self notify ( "reset_outcome" );
if(level.TeamBased)
{
self finalkillcam(level.KillInfo[winner]["attacker"], level.KillInfo[winner]["attackerNumber"], level.KillInfo[winner]["deathTime"], level.KillInfo[winner]["victim"]);
}
else
{
self finalkillcam(winner.KillInfo["attacker"], winner.KillInfo["attackerNumber"], winner.KillInfo["deathTime"], winner.KillInfo["victim"]);
}
}
}
finalkillcam( attacker, attackerNum, deathtime, victim)
{
self endon("disconnect");
level endon("end_killcam");
self SetClientDvar("ui_ShowMenuOnly", "none");
camtime = 5;
predelay = getTime()/1000 - deathTime;
postdelay = 2;
killcamlength = camtime + postdelay;
killcamoffset = camtime + predelay;
visionSetNaked( getdvar("mapname") );
self notify ( "begin_killcam", getTime() );
self allowSpectateTeam("allies", true);
self allowSpectateTeam("axis", true);
self allowSpectateTeam("freelook", true);
self allowSpectateTeam("none", true);
self.sessionstate = "spectator";
self.spectatorclient = attackerNum;
self.killcamentity = -1;
self.archivetime = killcamoffset;
self.killcamlength = killcamlength;
self.psoffsettime = 0;
if(!isDefined(level.slowmostart))
level.slowmostart = killcamlength - 2.5;
self.killcam = true;
wait 0.05;
if(!isDefined(self.top_fk_shader))
{
self CreateFKMenu(victim , attacker);
}
else
{
self.fk_title.alpha = 1;
self.fk_title_low.alpha = 1;
self.top_fk_shader.alpha = 0.5;
self.bottom_fk_shader.alpha = 0.5;
self.credits.alpha = 0.2;
}
self thread WaitEnd(killcamlength);
wait 0.05;
self waittill("end_killcam");
self thread CleanFK();
self.killcamentity = -1;
self.archivetime = 0;
self.psoffsettime = 0;
wait 0.05;
self.sessionstate = "spectator";
spawnpointname = "mp_global_intermission";
spawnpoints = getentarray(spawnpointname, "classname");
assert( spawnpoints.size );
spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(spawnpoints);
self spawn(spawnpoint.origin, spawnpoint.angles);
wait 0.05;
self.killcam = undefined;
self thread maps\mp\gametypes\_spectating::setSpectatePermissions();
level notify("end_killcam");
level.fk = false;
}
CleanFK()
{
self.fk_title.alpha = 0;
self.fk_title_low.alpha = 0;
self.top_fk_shader.alpha = 0;
self.bottom_fk_shader.alpha = 0;
self.credits.alpha = 0;
self SetClientDvar("ui_ShowMenuOnly", "");
visionSetNaked( "mpOutro", 1.0 );
}
WaitEnd( killcamlength )
{
self endon("disconnect");
self endon("end_killcam");
wait killcamlength;
self notify("end_killcam");
}
CreateFKMenu( victim , attacker)
{
self.top_fk_shader = newClientHudElem(self);
self.top_fk_shader.elemType = "shader";
self.top_fk_shader.archived = false;
self.top_fk_shader.horzAlign = "fullscreen";
self.top_fk_shader.vertAlign = "fullscreen";
self.top_fk_shader.sort = 0;
self.top_fk_shader.foreground = true;
self.top_fk_shader.color = (.15, .15, .15);
self.top_fk_shader setShader("white",640,60);
self.bottom_fk_shader = newClientHudElem(self);
self.bottom_fk_shader.elemType = "shader";
self.bottom_fk_shader.y = 420;
self.bottom_fk_shader.archived = false;
self.bottom_fk_shader.horzAlign = "fullscreen";
self.bottom_fk_shader.vertAlign = "fullscreen";
self.bottom_fk_shader.sort = 0;
self.bottom_fk_shader.foreground = true;
self.bottom_fk_shader.color = (.15, .15, .15);
self.bottom_fk_shader setShader("white",640,60);
self.fk_title = newClientHudElem(self);
self.fk_title.archived = false;
self.fk_title.y = 25; // top text????????
self.fk_title.alignX = "center";
self.fk_title.alignY = "middle";
self.fk_title.horzAlign = "center";
self.fk_title.vertAlign = "top";
self.fk_title.sort = 1; // force to draw after the bars
self.fk_title.font = "objective";
self.fk_title.fontscale = 2.25;
self.fk_title.foreground = true;
self.fk_title.shadown = 1;
self.fk_title_low = newClientHudElem(self);
self.fk_title_low.archived = false;
self.fk_title_low.x = 0;
self.fk_title_low.y = -25; // bottom text??????
self.fk_title_low.alignX = "center";
self.fk_title_low.alignY = "bottom";
self.fk_title_low.horzAlign = "center_safearea";
self.fk_title_low.vertAlign = "bottom";
self.fk_title_low.sort = 1; // force to draw after the bars
self.fk_title_low.font = "objective";
self.fk_title_low.fontscale = 1.5;
self.fk_title_low.foreground = true;
self.credits = newClientHudElem(self);
self.credits.archived = false;
self.credits.x = 0;
self.credits.y = 0;
self.credits.alignX = "left";
self.credits.alignY = "bottom";
self.credits.horzAlign = "left";
self.credits.vertAlign = "bottom";
self.credits.sort = 1; // force to draw after the bars
self.credits.font = "default";
self.credits.fontscale = 1.4;
self.credits.foreground = true;
self.fk_title.alpha = 1;
self.fk_title_low.alpha = 1;
self.top_fk_shader.alpha = 0.5;
self.bottom_fk_shader.alpha = 0.5;
self.credits.alpha = 0.2;
self.credits setText(" ");
self.fk_title_low setText(attacker.name);
if( !level.killcam_style )
self.fk_title setText("Game Winning Kill");
else
self.fk_title setText("Round Winning Kill");
}
onPlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
if(attacker != self)
{
level.showFinalKillcam = true;
team = attacker.team;
level.doFK[team] = true;
if(level.teamBased)
{
level.KillInfo[team]["attacker"] = attacker;
level.KillInfo[team]["attackerNumber"] = attacker getEntityNumber();
level.KillInfo[team]["victim"] = self;
level.KillInfo[team]["deathTime"] = GetTime()/1000;
}
else
{
attacker.KillInfo["attacker"] = attacker;
attacker.KillInfo["attackerNumber"] = attacker getEntityNumber();
attacker.KillInfo["victim"] = self;
attacker.KillInfo["deathTime"] = GetTime()/1000;
}
}
}
endGame( winner, endReasonText )
{
// return if already ending via host quit or victory
if ( game["state"] == "postgame" || level.gameEnded )
return;
if ( isDefined( level.onEndGame ) )
[[level.onEndGame]]( winner );
visionSetNaked( "mpOutro", 2.0 );
game["state"] = "postgame";
level.gameEndTime = getTime();
level.gameEnded = true;
level.inGracePeriod = false;
level notify ( "game_ended" );
if ( isdefined( winner ) && level.gametype == "sd" )
[[level._setTeamScore]]( winner, [[level._getTeamScore]]( winner ) + 1 );
setGameEndTime( 0 ); // stop/hide the timers
if ( level.rankedMatch )
{
maps\mp\gametypes\_globallogic::setXenonRanks();
if ( maps\mp\gametypes\_globallogic::hostIdledOut() )
{
level.hostForcedEnd = true;
logString( "host idled out" );
endLobby();
}
}
maps\mp\gametypes\_globallogic::updatePlacement();
maps\mp\gametypes\_globallogic::updateMatchBonusScores( winner );
maps\mp\gametypes\_globallogic::updateWinLossStats( winner );
setdvar( "g_deadChat", 1 );
// freeze players
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
player maps\mp\gametypes\_globallogic::freezePlayerForRoundEnd();
player thread maps\mp\gametypes\_globallogic::roundEndDoF( 4.0 );
player maps\mp\gametypes\_globallogic::freeGameplayHudElems();
player setClientDvars( "cg_everyoneHearsEveryone", 1 );
if( level.rankedMatch )
{
if ( isDefined( player.setPromotion ) )
player setClientDvar( "ui_lobbypopup", "promotion" );
else
player setClientDvar( "ui_lobbypopup", "summary" );
}
}
// end round
if ( (level.roundLimit > 1 || (!level.roundLimit && level.scoreLimit != 1)) && !level.forcedEnd )
{
if ( level.displayRoundEndText )
{
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
if ( level.teamBased )
player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify( winner, true, endReasonText );
else
player thread maps\mp\gametypes\_hud_message::outcomeNotify( winner, endReasonText );
player setClientDvars( "ui_hud_hardcore", 1,
"cg_drawSpectatorMessages", 0,
"g_compassShowEnemies", 0 );
}
if ( level.teamBased && !(maps\mp\gametypes\_globallogic::hitRoundLimit() || maps\mp\gametypes\_globallogic::hitScoreLimit()) )
thread maps\mp\gametypes\_globallogic::announceRoundWinner( winner, level.roundEndDelay / 4 );
if ( maps\mp\gametypes\_globallogic::hitRoundLimit() || maps\mp\gametypes\_globallogic::hitScoreLimit() )
maps\mp\gametypes\_globallogic::roundEndWait( level.roundEndDelay / 2, false );
else
maps\mp\gametypes\_globallogic::roundEndWait( level.roundEndDelay, true );
}
game["roundsplayed"]++;
roundSwitching = false;
if ( !maps\mp\gametypes\_globallogic::hitRoundLimit() && !maps\mp\gametypes\_globallogic::hitScoreLimit() )
roundSwitching = maps\mp\gametypes\_globallogic::checkRoundSwitch();
if ( roundSwitching && level.teamBased )
{
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
if ( !isDefined( player.pers["team"] ) || player.pers["team"] == "spectator" )
{
player [[level.spawnIntermission]]();
player closeMenu();
player closeInGameMenu();
continue;
}
switchType = level.halftimeType;
if ( switchType == "halftime" )
{
if ( level.roundLimit )
{
if ( (game["roundsplayed"] * 2) == level.roundLimit )
switchType = "halftime";
else
switchType = "intermission";
}
else if ( level.scoreLimit )
{
if ( game["roundsplayed"] == (level.scoreLimit - 1) )
switchType = "halftime";
else
switchType = "intermission";
}
else
{
switchType = "intermission";
}
}
switch( switchType )
{
case "halftime":
player maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "halftime" );
break;
case "overtime":
player maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "overtime" );
break;
default:
player maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "side_switch" );
break;
}
player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify( switchType, true, level.halftimeSubCaption );
player setClientDvar( "ui_hud_hardcore", 1 );
}
maps\mp\gametypes\_globallogic::roundEndWait( level.halftimeRoundEndDelay, false );
}
else if ( !maps\mp\gametypes\_globallogic::hitRoundLimit() && !maps\mp\gametypes\_globallogic::hitScoreLimit() && !level.displayRoundEndText && level.teamBased )
{
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
if ( !isDefined( player.pers["team"] ) || player.pers["team"] == "spectator" )
{
player [[level.spawnIntermission]]();
player closeMenu();
player closeInGameMenu();
continue;
}
switchType = level.halftimeType;
if ( switchType == "halftime" )
{
if ( level.roundLimit )
{
if ( (game["roundsplayed"] * 2) == level.roundLimit )
switchType = "halftime";
else
switchType = "roundend";
}
else if ( level.scoreLimit )
{
if ( game["roundsplayed"] == (level.scoreLimit - 1) )
switchType = "halftime";
else
switchTime = "roundend";
}
}
switch( switchType )
{
case "halftime":
player maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "halftime" );
break;
case "overtime":
player maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "overtime" );
break;
}
player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify( switchType, true, endReasonText );
player setClientDvar( "ui_hud_hardcore", 1 );
}
maps\mp\gametypes\_globallogic::roundEndWait( level.halftimeRoundEndDelay, !(maps\mp\gametypes\_globallogic::hitRoundLimit() || maps\mp\gametypes\_globallogic::hitScoreLimit()) );
}
if(level.players.size > 0 && level.gametype == "sd" && !maps\mp\gametypes\_globallogic::hitScoreLimit())
{
level.killcam_style = 1;
thread startFK( winner );
}
if(level.fk)
level waittill("end_killcam");
if ( !maps\mp\gametypes\_globallogic::hitRoundLimit() && !maps\mp\gametypes\_globallogic::hitScoreLimit() )
{
level notify ( "restarting" );
game["state"] = "playing";
map_restart( true );
return;
}
if ( maps\mp\gametypes\_globallogic::hitRoundLimit() )
endReasonText = game["strings"]["round_limit_reached"];
else if ( maps\mp\gametypes\_globallogic::hitScoreLimit() )
endReasonText = game["strings"]["score_limit_reached"];
else
endReasonText = game["strings"]["time_limit_reached"];
}
thread maps\mp\gametypes\_missions::roundEnd( winner );
// catching gametype, since DM forceEnd sends winner as player entity, instead of string
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
if ( !isDefined( player.pers["team"] ) || player.pers["team"] == "spectator" )
{
player [[level.spawnIntermission]]();
player closeMenu();
player closeInGameMenu();
continue;
}
if ( level.teamBased )
{
player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify( winner, false, endReasonText );
}
else
{
player thread maps\mp\gametypes\_hud_message::outcomeNotify( winner, endReasonText );
if ( isDefined( winner ) && player == winner )
player playLocalSound( game["music"]["victory_" + player.pers["team"] ] );
else if ( !level.splitScreen )
player playLocalSound( game["music"]["defeat"] );
}
player setClientDvars( "ui_hud_hardcore", 1,
"cg_drawSpectatorMessages", 0,
"g_compassShowEnemies", 0 );
}
if ( level.teamBased )
{
thread maps\mp\gametypes\_globallogic::announceGameWinner( winner, level.postRoundTime / 2 );
if ( level.splitscreen )
{
if ( winner == "allies" )
playSoundOnPlayers( game["music"]["victory_allies"], "allies" );
else if ( winner == "axis" )
playSoundOnPlayers( game["music"]["victory_axis"], "axis" );
else
playSoundOnPlayers( game["music"]["defeat"] );
}
else
{
if ( winner == "allies" )
{
playSoundOnPlayers( game["music"]["victory_allies"], "allies" );
playSoundOnPlayers( game["music"]["defeat"], "axis" );
}
else if ( winner == "axis" )
{
playSoundOnPlayers( game["music"]["victory_axis"], "axis" );
playSoundOnPlayers( game["music"]["defeat"], "allies" );
}
else
{
playSoundOnPlayers( game["music"]["defeat"] );
}
}
}
wait 9;
if(level.players.size > 0 && level.gametype != "sd")
{
level.killcam_style = 0;
thread startFK( winner );
}
if(level.gametype == "sd" && maps\mp\gametypes\_globallogic::hitScoreLimit() && level.players.size > 0)
{
level.killcam_style = 0;
thread startFK( winner );
}
if(level.fk)
level waittill("end_killcam");
else
maps\mp\gametypes\_globallogic::roundEndWait( level.postRoundTime, true );
level.intermission = true;
//regain players array since some might've disconnected during the wait above
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
player closeMenu();
player closeInGameMenu();
player notify ( "reset_outcome" );
player thread maps\mp\gametypes\_globallogic::spawnIntermission();
player setClientDvar( "ui_hud_hardcore", 0 );
player setclientdvar( "g_scriptMainMenu", game["menu_eog_main"] );
}
logString( "game ended" );
wait getDvarFloat( "scr_show_unlock_wait" );
if( level.console )
{
exitLevel( false );
return;
}
// popup for game summary
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
//iPrintLnBold( "opening eog summary!" );
//player.sessionstate = "dead";
player openMenu( game["menu_eog_unlock"] );
}
thread timeLimitClock_Intermission( getDvarFloat( "scr_intermission_time" ) );
wait getDvarFloat( "scr_intermission_time" );
players = level.players;
for ( index = 0; index < players.size; index++ )
{
player = players[index];
//iPrintLnBold( "closing eog summary!" );
player closeMenu();
player closeInGameMenu();
}
exitLevel( false );
}
timeLimitClock_Intermission( waitTime )
{
setGameEndTime( getTime() + int(waitTime*1000) );
clockObject = spawn( "script_origin", (0,0,0) );
if ( waitTime >= 10.0 )
wait ( waitTime - 10.0 );
for ( ;; )
{
clockObject playSound( "ui_mp_timer_countdown" );
wait ( 1.0 );
}
}
startFK( winner )
{
level endon("end_killcam");
if(!level.showFinalKillcam)
return;
if(!isPlayer(Winner) && !level.doFK[winner])
return;
level.fk = true;
for( i = 0; i < level.players.size; i ++)
{
player = level.players[i];
player notify("beginFK", winner);
}
slowMotion();
}
slowMotion()
{
while(!isDefined(level.slowmostart))
wait 0.05;
wait (level.slowmostart - 0.1);
SetDvar("timescale", ".3");
for(i=0;i<level.players.size;i++)
level.players[i] setclientdvar("timescale", ".3");
wait 1.7;
SetDvar("timescale", "1");
for(i=0;i<level.players.size;i++)
level.players[i] setclientdvar("timescale", "1");
}

7705
mp_killcam/maps/mp/gametypes/_globallogic.gsc
File diff suppressed because it is too large
View File

1199
mp_killcam/maps/mp/gametypes/_rank.gsc
File diff suppressed because it is too large
View File

1932
mp_killcam/maps/mp/gametypes/_weapons.gsc
File diff suppressed because it is too large
View File

887
mp_killcam/maps/mp/gametypes/sd.gsc

@ -0,0 +1,887 @@
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
main()
{
if(getdvar("mapname") == "mp_background")
return;
maps\mp\gametypes\_globallogic::init();
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
maps\mp\gametypes\_globallogic::SetupCallbacks();
maps\mp\gametypes\_globallogic::registerRoundSwitchDvar( level.gameType, 3, 0, 9 );
maps\mp\gametypes\_globallogic::registerTimeLimitDvar( level.gameType, 2.5, 0, 1440 );
maps\mp\gametypes\_globallogic::registerScoreLimitDvar( level.gameType, 4, 0, 500 );
maps\mp\gametypes\_globallogic::registerRoundLimitDvar( level.gameType, 0, 0, 12 );
maps\mp\gametypes\_globallogic::registerNumLivesDvar( level.gameType, 1, 0, 10 );
registerGrenadeLauncherDudDvar( level.gameType, 15, 0, 1440 );
level.teamBased = true;
level.overrideTeamScore = true;
level.onPrecacheGameType = ::onPrecacheGameType;
level.onStartGameType = ::onStartGameType;
level.onSpawnPlayer = ::onSpawnPlayer;
level.onSpawnPlayerUnified = ::onSpawnPlayerUnified;
level.playerSpawnedCB = ::sd_playerSpawnedCB;
level.onPlayerKilled = ::onPlayerKilled;
level.onDeadEvent = ::onDeadEvent;
level.onOneLeftEvent = ::onOneLeftEvent;
level.onTimeLimit = ::onTimeLimit;
level.onRoundSwitch = ::onRoundSwitch;
level.getTeamKillPenalty = ::sd_getTeamKillPenalty;
level.getTeamKillScore = ::sd_getTeamKillScore;
level.endGameOnScoreLimit = false;
game["dialog"]["gametype"] = "searchdestroy";
game["dialog"]["offense_obj"] = "obj_destroy";
game["dialog"]["defense_obj"] = "obj_defend";
game["dialog"]["sudden_death"] = "suddendeath_boost";
}
onPrecacheGameType()
{
game["bombmodelname"] = "weapon_explosives";
game["bombmodelnameobj"] = "weapon_explosives";
game["bomb_dropped_sound"] = "flag_drop_plr";
game["bomb_recovered_sound"] = "flag_pickup_plr";
precacheModel(game["bombmodelname"]);
precacheModel(game["bombmodelnameobj"]);
precacheShader("waypoint_bomb");
precacheShader("hud_suitcase_bomb");
precacheShader("waypoint_target");
precacheShader("waypoint_target_a");
precacheShader("waypoint_target_b");
precacheShader("waypoint_defend");
precacheShader("waypoint_defend_a");
precacheShader("waypoint_defend_b");
precacheShader("waypoint_defuse");
precacheShader("waypoint_defuse_a");
precacheShader("waypoint_defuse_b");
precacheShader("compass_waypoint_target");
precacheShader("compass_waypoint_target_a");
precacheShader("compass_waypoint_target_b");
precacheShader("compass_waypoint_defend");
precacheShader("compass_waypoint_defend_a");
precacheShader("compass_waypoint_defend_b");
precacheShader("compass_waypoint_defuse");
precacheShader("compass_waypoint_defuse_a");
precacheShader("compass_waypoint_defuse_b");
precacheString( &"MP_EXPLOSIVES_RECOVERED_BY" );
precacheString( &"MP_EXPLOSIVES_DROPPED_BY" );
precacheString( &"MP_EXPLOSIVES_PLANTED_BY" );
precacheString( &"MP_EXPLOSIVES_DEFUSED_BY" );
precacheString( &"PLATFORM_HOLD_TO_PLANT_EXPLOSIVES" );
precacheString( &"PLATFORM_HOLD_TO_DEFUSE_EXPLOSIVES" );
precacheString( &"MP_CANT_PLANT_WITHOUT_BOMB" );
precacheString( &"MP_PLANTING_EXPLOSIVE" );
precacheString( &"MP_DEFUSING_EXPLOSIVE" );
}
sd_getTeamKillPenalty( eInflictor, attacker, sMeansOfDeath, sWeapon )
{
teamkill_penalty = maps\mp\gametypes\_globallogic::default_getTeamKillPenalty( eInflictor, attacker, sMeansOfDeath, sWeapon );
if ( ( isdefined( self.isDefusing ) && self.isDefusing ) || ( isdefined( self.isPlanting ) && self.isPlanting ) )
{
teamkill_penalty = teamkill_penalty * level.teamKillPenaltyMultiplier;
}
return teamkill_penalty;
}
sd_getTeamKillScore( eInflictor, attacker, sMeansOfDeath, sWeapon )
{
teamkill_score = maps\mp\gametypes\_rank::getScoreInfoValue( "kill" );
if ( ( isdefined( self.isDefusing ) && self.isDefusing ) || ( isdefined( self.isPlanting ) && self.isPlanting ) )
{
teamkill_score = teamkill_score * level.teamKillScoreMultiplier;
}
return int(teamkill_score);
}
onRoundSwitch()
{
if ( !isdefined( game["switchedsides"] ) )
game["switchedsides"] = false;
if ( game["teamScores"]["allies"] == level.scorelimit - 1 && game["teamScores"]["axis"] == level.scorelimit - 1 )
{
// overtime! team that's ahead in kills gets to defend.
aheadTeam = getBetterTeam();
if ( aheadTeam != game["defenders"] )
{
game["switchedsides"] = !game["switchedsides"];
}
else
{
level.halftimeSubCaption = "";
}
level.halftimeType = "overtime";
}
else
{
level.halftimeType = "halftime";
game["switchedsides"] = !game["switchedsides"];
}
}
getBetterTeam()
{
kills["allies"] = 0;
kills["axis"] = 0;
deaths["allies"] = 0;
deaths["axis"] = 0;
for ( i = 0; i < level.players.size; i++ )
{
player = level.players[i];
team = player.pers["team"];
if ( isDefined( team ) && (team == "allies" || team == "axis") )
{
kills[ team ] += player.kills;
deaths[ team ] += player.deaths;
}
}
if ( kills["allies"] > kills["axis"] )
return "allies";
else if ( kills["axis"] > kills["allies"] )
return "axis";
// same number of kills
if ( deaths["allies"] < deaths["axis"] )
return "allies";
else if ( deaths["axis"] < deaths["allies"] )
return "axis";
// same number of deaths
if ( randomint(2) == 0 )
return "allies";
return "axis";
}
onStartGameType()
{
if ( !isDefined( game["switchedsides"] ) )
game["switchedsides"] = false;
if ( game["switchedsides"] )
{
oldAttackers = game["attackers"];
oldDefenders = game["defenders"];
game["attackers"] = oldDefenders;
game["defenders"] = oldAttackers;
}
setClientNameMode( "manual_change" );
game["strings"]["target_destroyed"] = &"MP_TARGET_DESTROYED";
game["strings"]["bomb_defused"] = &"MP_BOMB_DEFUSED";
precacheString( game["strings"]["target_destroyed"] );
precacheString( game["strings"]["bomb_defused"] );
level._effect["bombexplosion"] = loadfx("maps/mp_maps/fx_mp_exp_bomb");
maps\mp\gametypes\_globallogic::setObjectiveText( game["attackers"], &"OBJECTIVES_SD_ATTACKER" );
maps\mp\gametypes\_globallogic::setObjectiveText( game["defenders"], &"OBJECTIVES_SD_DEFENDER" );
if ( level.splitscreen )
{
maps\mp\gametypes\_globallogic::setObjectiveScoreText( game["attackers"], &"OBJECTIVES_SD_ATTACKER" );
maps\mp\gametypes\_globallogic::setObjectiveScoreText( game["defenders"], &"OBJECTIVES_SD_DEFENDER" );
}
else
{
maps\mp\gametypes\_globallogic::setObjectiveScoreText( game["attackers"], &"OBJECTIVES_SD_ATTACKER_SCORE" );
maps\mp\gametypes\_globallogic::setObjectiveScoreText( game["defenders"], &"OBJECTIVES_SD_DEFENDER_SCORE" );
}
maps\mp\gametypes\_globallogic::setObjectiveHintText( game["attackers"], &"OBJECTIVES_SD_ATTACKER_HINT" );
maps\mp\gametypes\_globallogic::setObjectiveHintText( game["defenders"], &"OBJECTIVES_SD_DEFENDER_HINT" );
level.spawnMins = ( 0, 0, 0 );
level.spawnMaxs = ( 0, 0, 0 );
maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_sd_spawn_attacker" );
maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_sd_spawn_defender" );
level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
setMapCenter( level.mapCenter );
allowed[0] = "sd";
allowed[1] = "bombzone";
allowed[2] = "blocker";
maps\mp\gametypes\_gameobjects::main(allowed);
// now that the game objects have been deleted place the influencers
maps\mp\gametypes\_spawning::create_map_placed_influencers();
level.spawn_axis_start = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_sd_spawn_defender" );
level.spawn_allies_start = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_sd_spawn_attacker" );
maps\mp\gametypes\_rank::registerScoreInfo( "win", 2 );
maps\mp\gametypes\_rank::registerScoreInfo( "loss", 1 );
maps\mp\gametypes\_rank::registerScoreInfo( "tie", 1.5 );
maps\mp\gametypes\_rank::registerScoreInfo( "kill", 50 );
maps\mp\gametypes\_rank::registerScoreInfo( "headshot", 50 );
maps\mp\gametypes\_rank::registerScoreInfo( "plant", 100 );
maps\mp\gametypes\_rank::registerScoreInfo( "defuse", 100 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist_75", 25 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist_50", 25 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist_25", 25 );
maps\mp\gametypes\_rank::registerScoreInfo( "assist", 25 );
thread updateGametypeDvars();
thread bombs();
}
onSpawnPlayerUnified()
{
self.isPlanting = false;
self.isDefusing = false;
self.isBombCarrier = false;
if ( level.multiBomb && !isDefined( self.carryIcon ) && self.pers["team"] == game["attackers"] && !level.bombPlanted )
{
if ( level.splitscreen )
{
self.carryIcon = createIcon( "hud_suitcase_bomb", 35, 35 );
self.carryIcon setPoint( "BOTTOM RIGHT", "BOTTOM RIGHT", -10, -50 );
self.carryIcon.alpha = 0.75;
}
else
{
self.carryIcon = createIcon( "hud_suitcase_bomb", 50, 50 );
self.carryIcon setPoint( "CENTER", "CENTER", 220, 140 );
self.carryIcon.alpha = 0.75;
}
}
maps\mp\gametypes\_spawning::onSpawnPlayer_Unified();
}
onSpawnPlayer()
{
self.isPlanting = false;
self.isDefusing = false;
self.isBombCarrier = false;
if(self.pers["team"] == game["attackers"])
spawnPointName = "mp_sd_spawn_attacker";
else
spawnPointName = "mp_sd_spawn_defender";
if ( level.multiBomb && !isDefined( self.carryIcon ) && self.pers["team"] == game["attackers"] && !level.bombPlanted )
{
if ( level.splitscreen )
{
self.carryIcon = createIcon( "hud_suitcase_bomb", 35, 35 );
self.carryIcon setPoint( "BOTTOM RIGHT", "BOTTOM RIGHT", -10, -50 );
self.carryIcon.alpha = 0.75;
}
else
{
self.carryIcon = createIcon( "hud_suitcase_bomb", 50, 50 );
self.carryIcon setPoint( "CENTER", "CENTER", 220, 140 );
self.carryIcon.alpha = 0.75;
}
}
spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( spawnPointName );
assert( spawnPoints.size );
spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
self spawn( spawnpoint.origin, spawnpoint.angles );
}
sd_playerSpawnedCB()
{
level notify ( "spawned_player" );
}
onPlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
thread maps\mp\gametypes\_finalkills::onPlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);
thread checkAllowSpectating();
}
checkAllowSpectating()
{
wait ( 0.05 );
update = false;
if ( !level.aliveCount[ game["attackers"] ] )
{
level.spectateOverride[game["attackers"]].allowEnemySpectate = 1;
update = true;
}
if ( !level.aliveCount[ game["defenders"] ] )
{
level.spectateOverride[game["defenders"]].allowEnemySpectate = 1;
update = true;
}
if ( update )
maps\mp\gametypes\_spectating::updateSpectateSettings();
}
sd_endGame( winningTeam, endReasonText )
{
//if ( isdefined( winningTeam ) )
// [[level._setTeamScore]]( winningTeam, [[level._getTeamScore]]( winningTeam ) + 1 );
thread maps\mp\gametypes\_finalkills::endGame( winningTeam, endReasonText );
}
onDeadEvent( team )
{
if ( level.bombExploded || level.bombDefused )
return;
if ( team == "all" )
{
if ( level.bombPlanted )
sd_endGame( game["attackers"], game["strings"][game["defenders"]+"_eliminated"] );
else
sd_endGame( game["defenders"], game["strings"][game["attackers"]+"_eliminated"] );
}
else if ( team == game["attackers"] )
{
if ( level.bombPlanted )
return;
sd_endGame( game["defenders"], game["strings"][game["attackers"]+"_eliminated"] );
}
else if ( team == game["defenders"] )
{
sd_endGame( game["attackers"], game["strings"][game["defenders"]+"_eliminated"] );
}
}
onOneLeftEvent( team )
{
if ( level.bombExploded || level.bombDefused )
return;
//if ( team == game["attackers"] )
warnLastPlayer( team );
}
onTimeLimit()
{
if ( level.teamBased )
sd_endGame( game["defenders"], game["strings"]["time_limit_reached"] );
else
sd_endGame( undefined, game["strings"]["time_limit_reached"] );
}
warnLastPlayer( team )
{
if ( !isdefined( level.warnedLastPlayer ) )
level.warnedLastPlayer = [];
if ( isDefined( level.warnedLastPlayer[team] ) )
return;
level.warnedLastPlayer[team] = true;
players = level.players;
for ( i = 0; i < players.size; i++ )
{
player = players[i];
if ( isDefined( player.pers["team"] ) && player.pers["team"] == team && isdefined( player.pers["class"] ) )
{
if ( player.sessionstate == "playing" && !player.afk )
break;
}
}
if ( i == players.size )
return;
players[i] thread giveLastAttackerWarning();
}
giveLastAttackerWarning()
{
self endon("death");
self endon("disconnect");
fullHealthTime = 0;
interval = .05;
while(1)
{
if ( self.health != self.maxhealth )
fullHealthTime = 0;
else
fullHealthTime += interval;
wait interval;
if (self.health == self.maxhealth && fullHealthTime >= 3)
break;
}
//self iprintlnbold(&"MP_YOU_ARE_THE_ONLY_REMAINING_PLAYER");
//self maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "last_alive" );
self maps\mp\gametypes\_globallogic::leaderDialogOnPlayer( "sudden_death" );
self maps\mp\gametypes\_missions::lastManSD();
}
updateGametypeDvars()
{
level.plantTime = dvarFloatValue( "planttime", 5, 0, 20 );
level.defuseTime = dvarFloatValue( "defusetime", 5, 0, 20 );
level.bombTimer = dvarFloatValue( "bombtimer", 45, 1, 300 );
level.multiBomb = dvarIntValue( "multibomb", 0, 0, 1 );
level.teamKillPenaltyMultiplier = dvarFloatValue( "teamkillpenalty", 2, 0, 10 );
level.teamKillScoreMultiplier = dvarFloatValue( "teamkillscore", 4, 0, 40 );
}
bombs()
{
level.bombPlanted = false;
level.bombDefused = false;
level.bombExploded = false;
trigger = getEnt( "sd_bomb_pickup_trig", "targetname" );
if ( !isDefined( trigger ) )
{
maps\mp\_utility::error("No sd_bomb_pickup_trig trigger found in map.");
return;
}
visuals[0] = getEnt( "sd_bomb", "targetname" );
if ( !isDefined( visuals[0] ) )
{
maps\mp\_utility::error("No sd_bomb script_model found in map.");
return;
}
precacheModel( "weapon_explosives" );
visuals[0] setModel( "weapon_explosives" );
if ( !level.multiBomb )
{
level.sdBomb = maps\mp\gametypes\_gameobjects::createCarryObject( game["attackers"], trigger, visuals, (0,0,32) );
level.sdBomb maps\mp\gametypes\_gameobjects::allowCarry( "friendly" );
level.sdBomb maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", "compass_waypoint_bomb" );
level.sdBomb maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "waypoint_bomb" );
level.sdBomb maps\mp\gametypes\_gameobjects::setVisibleTeam( "friendly" );
level.sdBomb maps\mp\gametypes\_gameobjects::setCarryIcon( "hud_suitcase_bomb" );
level.sdBomb.allowWeapons = true;
level.sdBomb.onPickup = ::onPickup;
level.sdBomb.onDrop = ::onDrop;
}
else
{
trigger delete();
visuals[0] delete();
}
level.bombZones = [];
bombZones = getEntArray( "bombzone", "targetname" );
for ( index = 0; index < bombZones.size; index++ )
{
trigger = bombZones[index];
visuals = getEntArray( bombZones[index].target, "targetname" );
bombZone = maps\mp\gametypes\_gameobjects::createUseObject( game["defenders"], trigger, visuals, (0,0,64) );
bombZone maps\mp\gametypes\_gameobjects::allowUse( "enemy" );
bombZone maps\mp\gametypes\_gameobjects::setUseTime( level.plantTime );
bombZone maps\mp\gametypes\_gameobjects::setUseText( &"MP_PLANTING_EXPLOSIVE" );
bombZone maps\mp\gametypes\_gameobjects::setUseHintText( &"PLATFORM_HOLD_TO_PLANT_EXPLOSIVES" );
if ( !level.multiBomb )
bombZone maps\mp\gametypes\_gameobjects::setKeyObject( level.sdBomb );
label = bombZone maps\mp\gametypes\_gameobjects::getLabel();
bombZone.label = label;
bombZone maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", "compass_waypoint_defend" + label );
bombZone maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "waypoint_defend" + label );
bombZone maps\mp\gametypes\_gameobjects::set2DIcon( "enemy", "compass_waypoint_target" + label );
bombZone maps\mp\gametypes\_gameobjects::set3DIcon( "enemy", "waypoint_target" + label );
bombZone maps\mp\gametypes\_gameobjects::setVisibleTeam( "any" );
bombZone.onBeginUse = ::onBeginUse;
bombZone.onEndUse = ::onEndUse;
bombZone.onUse = ::onUsePlantObject;
bombZone.onCantUse = ::onCantUse;
bombZone.useWeapon = "briefcase_bomb_mp";
for ( i = 0; i < visuals.size; i++ )
{
if ( isDefined( visuals[i].script_exploder ) )
{
bombZone.exploderIndex = visuals[i].script_exploder;
break;
}
}
level.bombZones[level.bombZones.size] = bombZone;
bombZone.bombDefuseTrig = getent( visuals[0].target, "targetname" );
assert( isdefined( bombZone.bombDefuseTrig ) );
bombZone.bombDefuseTrig.origin += (0,0,-10000);
bombZone.bombDefuseTrig.label = label;
}
for ( index = 0; index < level.bombZones.size; index++ )
{
array = [];
for ( otherindex = 0; otherindex < level.bombZones.size; otherindex++ )
{
if ( otherindex != index )
array[ array.size ] = level.bombZones[otherindex];
}
level.bombZones[index].otherBombZones = array;
}
}
onBeginUse( player )
{
if ( self maps\mp\gametypes\_gameobjects::isFriendlyTeam( player.pers["team"] ) )
{
player playSound( "mp_bomb_defuse" );
player.isDefusing = true;
player thread maps\mp\gametypes\_battlechatter_mp::gametypeSpecificBattleChatter( "sd_enemyplant", player.pers["team"] );
if ( isDefined( level.sdBombModel ) )
level.sdBombModel hide();
}
else
{
player.isPlanting = true;
player thread maps\mp\gametypes\_battlechatter_mp::gametypeSpecificBattleChatter( "sd_friendlyplant", player.pers["team"] );
if ( level.multibomb )
{
for ( i = 0; i < self.otherBombZones.size; i++ )
{
self.otherBombZones[i] maps\mp\gametypes\_gameobjects::disableObject();
}
}
}
}
onEndUse( team, player, result )
{
if ( !isAlive( player ) )
return;
player.isDefusing = false;
player.isPlanting = false;
player notify( "event_ended" );
if ( self maps\mp\gametypes\_gameobjects::isFriendlyTeam( player.pers["team"] ) )
{
if ( isDefined( level.sdBombModel ) && !result )
{
level.sdBombModel show();
}
}
else
{
if ( level.multibomb && !result )
{
for ( i = 0; i < self.otherBombZones.size; i++ )
{
self.otherBombZones[i] maps\mp\gametypes\_gameobjects::enableObject();
}
}
}
}
onCantUse( player )
{
player iPrintLnBold( &"MP_CANT_PLANT_WITHOUT_BOMB" );
}
onUsePlantObject( player )
{
// planted the bomb
if ( !self maps\mp\gametypes\_gameobjects::isFriendlyTeam( player.pers["team"] ) )
{
level thread bombPlanted( self, player );
player logString( "bomb planted: " + self.label );
// disable all bomb zones except this one
for ( index = 0; index < level.bombZones.size; index++ )
{
if ( level.bombZones[index] == self )
continue;
level.bombZones[index] maps\mp\gametypes\_gameobjects::disableObject();
}
thread playSoundOnPlayers( "mx_SD_planted"+"_"+level.teamPrefix[player.pers["team"]] );
player playSound( "mp_bomb_plant" );
player notify ( "bomb_planted" );
if ( !level.hardcoreMode )
iPrintLn( &"MP_EXPLOSIVES_PLANTED_BY", player );
maps\mp\gametypes\_globallogic::leaderDialog( "bomb_planted" );
maps\mp\gametypes\_globallogic::givePlayerScore( "plant", player );
player thread [[level.onXPEvent]]( "plant" );
}
}
onUseDefuseObject( player )
{
wait .05;
player notify ( "bomb_defused" );
player logString( "bomb defused: " + self.label );
level thread bombDefused();
// disable this bomb zone
self maps\mp\gametypes\_gameobjects::disableObject();
if ( !level.hardcoreMode )
iPrintLn( &"MP_EXPLOSIVES_DEFUSED_BY", player );
player setStatLBByName( "search_and_destroy", 1, "Targets Defused" );
thread playSoundOnPlayers( "mx_SD_defused"+"_"+level.teamPrefix[player.pers["team"]] );
maps\mp\gametypes\_globallogic::leaderDialog( "bomb_defused" );
maps\mp\gametypes\_globallogic::givePlayerScore( "defuse", player );
player thread [[level.onXPEvent]]( "defuse" );
}
onDrop( player )
{
if ( !level.bombPlanted )
{
if ( isDefined( player ) && isDefined( player.name ) )
printOnTeamArg( &"MP_EXPLOSIVES_DROPPED_BY", game["attackers"], player );
// maps\mp\gametypes\_globallogic::leaderDialog( "bomb_lost", player.pers["team"] );
if ( isDefined( player ) )
player logString( "bomb dropped" );
else
logString( "bomb dropped" );
}
player notify( "event_ended" );
self maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "waypoint_bomb" );
maps\mp\_utility::playSoundOnPlayers( game["bomb_dropped_sound"], game["attackers"] );
}
onPickup( player )
{
player.isBombCarrier = true;
self maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "waypoint_defend" );
if ( !level.bombDefused )
{
if ( isDefined( player ) && isDefined( player.name ) )
printOnTeamArg( &"MP_EXPLOSIVES_RECOVERED_BY", game["attackers"], player );
thread playSoundOnPlayers( "mx_SD_pickup"+"_"+level.teamPrefix[player.pers["team"]], player.pers["team"] );
maps\mp\gametypes\_globallogic::leaderDialog( "bomb_taken", player.pers["team"] );
player logString( "bomb taken" );
}
maps\mp\_utility::playSoundOnPlayers( game["bomb_recovered_sound"], game["attackers"] );
}
onReset()
{
}
bombPlanted( destroyedObj, player )
{
maps\mp\gametypes\_globallogic::pauseTimer();
level.bombPlanted = true;
destroyedObj.visuals[0] thread maps\mp\gametypes\_globallogic::playTickingSound();
level.tickingObject = destroyedObj.visuals[0];
level.timeLimitOverride = true;
setGameEndTime( int( gettime() + (level.bombTimer * 1000) ) );
setDvar( "ui_bomb_timer", 1 );
if ( !level.multiBomb )
{
level.sdBomb maps\mp\gametypes\_gameobjects::allowCarry( "none" );
level.sdBomb maps\mp\gametypes\_gameobjects::setVisibleTeam( "none" );
level.sdBomb maps\mp\gametypes\_gameobjects::setDropped();
level.sdBombModel = level.sdBomb.visuals[0];
}
else
{
for ( index = 0; index < level.players.size; index++ )
{
if ( isDefined( level.players[index].carryIcon ) )
level.players[index].carryIcon destroyElem();
}
trace = bulletTrace( player.origin + (0,0,20), player.origin - (0,0,2000), false, player );
tempAngle = randomfloat( 360 );
forward = (cos( tempAngle ), sin( tempAngle ), 0);
forward = vectornormalize( forward - vector_scale( trace["normal"], vectordot( forward, trace["normal"] ) ) );
dropAngles = vectortoangles( forward );
level.sdBombModel = spawn( "script_model", trace["position"] );
level.sdBombModel.angles = dropAngles;
level.sdBombModel setModel( "weapon_explosives" );
}
destroyedObj maps\mp\gametypes\_gameobjects::allowUse( "none" );
destroyedObj maps\mp\gametypes\_gameobjects::setVisibleTeam( "none" );
/*
destroyedObj maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", undefined );
destroyedObj maps\mp\gametypes\_gameobjects::set2DIcon( "enemy", undefined );
destroyedObj maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", undefined );
destroyedObj maps\mp\gametypes\_gameobjects::set3DIcon( "enemy", undefined );
*/
label = destroyedObj maps\mp\gametypes\_gameobjects::getLabel();
// create a new object to defuse with.
trigger = destroyedObj.bombDefuseTrig;
trigger.origin = level.sdBombModel.origin;
visuals = [];
defuseObject = maps\mp\gametypes\_gameobjects::createUseObject( game["defenders"], trigger, visuals, (0,0,32) );
defuseObject maps\mp\gametypes\_gameobjects::allowUse( "friendly" );
defuseObject maps\mp\gametypes\_gameobjects::setUseTime( level.defuseTime );
defuseObject maps\mp\gametypes\_gameobjects::setUseText( &"MP_DEFUSING_EXPLOSIVE" );
defuseObject maps\mp\gametypes\_gameobjects::setUseHintText( &"PLATFORM_HOLD_TO_DEFUSE_EXPLOSIVES" );
defuseObject maps\mp\gametypes\_gameobjects::setVisibleTeam( "any" );
defuseObject maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", "compass_waypoint_defuse" + label );
defuseObject maps\mp\gametypes\_gameobjects::set2DIcon( "enemy", "compass_waypoint_defend" + label );
defuseObject maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "waypoint_defuse" + label );
defuseObject maps\mp\gametypes\_gameobjects::set3DIcon( "enemy", "waypoint_defend" + label );
defuseObject.label = label;
defuseObject.onBeginUse = ::onBeginUse;
defuseObject.onEndUse = ::onEndUse;
defuseObject.onUse = ::onUseDefuseObject;
defuseObject.useWeapon = "briefcase_bomb_defuse_mp";
player.isBombCarrier = false;
BombTimerWait();
setDvar( "ui_bomb_timer", 0 );
destroyedObj.visuals[0] maps\mp\gametypes\_globallogic::stopTickingSound();
if ( level.gameEnded || level.bombDefused )
return;
level.bombExploded = true;
explosionOrigin = level.sdBombModel.origin+(0,0,12);
level.sdBombModel hide();
if ( isdefined( player ) )
destroyedObj.visuals[0] radiusDamage( explosionOrigin, 512, 200, 20, player, "MOD_EXPLOSIVE", "briefcase_bomb_mp" );
else
destroyedObj.visuals[0] radiusDamage( explosionOrigin, 512, 200, 20, undefined, "MOD_EXPLOSIVE", "briefcase_bomb_mp" );
if ( isdefined(player) )
player setStatLBByName( "search_and_destroy", 1, "Targets Destroyed" );
rot = randomfloat(360);
explosionEffect = spawnFx( level._effect["bombexplosion"], explosionOrigin + (0,0,50), (0,0,1), (cos(rot),sin(rot),0) );
triggerFx( explosionEffect );
thread playSoundinSpace( "exp_suitcase_bomb_main", explosionOrigin );
if ( isDefined( destroyedObj.exploderIndex ) )
exploder( destroyedObj.exploderIndex );
for ( index = 0; index < level.bombZones.size; index++ )
level.bombZones[index] maps\mp\gametypes\_gameobjects::disableObject();
defuseObject maps\mp\gametypes\_gameobjects::disableObject();
setGameEndTime( 0 );
wait 3;
sd_endGame( game["attackers"], game["strings"]["target_destroyed"] );
}
BombTimerWait()
{
level endon("game_ended");
level endon("bomb_defused");
wait level.bombTimer;
}
playSoundinSpace( alias, origin )
{
org = spawn( "script_origin", origin );
org.origin = origin;
org playSound( alias );
wait 10; // MP doesn't have "sounddone" notifies =(
org delete();
}
bombDefused()
{
level.tickingObject maps\mp\gametypes\_globallogic::stopTickingSound();
level.bombDefused = true;
setDvar( "ui_bomb_timer", 0 );
level notify("bomb_defused");
wait 1.5;
setGameEndTime( 0 );
sd_endGame( game["defenders"], game["strings"]["bomb_defused"] );
}
registerGrenadeLauncherDudDvar( dvarString, defaultValue, minValue, maxValue )
{
dvarString = ("scr_" + dvarString + "_grenadeLauncherDudTime");
if ( getDvar( dvarString ) == "" )
setDvar( dvarString, defaultValue );
if ( getDvarInt( dvarString ) > maxValue )
setDvar( dvarString, maxValue );
else if ( getDvarInt( dvarString ) < minValue )
setDvar( dvarString, minValue );
level.grenadeLauncherDudTimeDvar = dvarString;
level.grenadeLauncherDudTimeMin = minValue;
level.grenadeLauncherDudTimeMax = maxValue;
level.grenadeLauncherDudTime = getDvarInt( level.grenadeLauncherDudTimeDvar );
}

165
mp_killcam/maps/mp/gametypes/tdm.gsc

@ -0,0 +1,165 @@
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
main()
{
if(getdvar("mapname") == "mp_background")
return;
maps\mp\gametypes\_globallogic::init();
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
maps\mp\gametypes\_globallogic::SetupCallbacks();
maps\mp\gametypes\_globallogic::registerTimeLimitDvar( "tdm", 10, 0, 1440 );
maps\mp\gametypes\_globallogic::registerScoreLimitDvar( "tdm", 500, 0, 5000 );
maps\mp\gametypes\_globallogic::registerRoundLimitDvar( "tdm", 1, 0, 10 );
maps\mp\gametypes\_globallogic::registerNumLivesDvar( "tdm", 0, 0, 10 );
level.teamBased = true;
level.onStartGameType = ::onStartGameType;
level.onSpawnPlayer = ::onSpawnPlayer;
level.onSpawnPlayerUnified = ::onSpawnPlayerUnified;
level.onScoreLimit = ::default_onScoreLimit;
level.onPlayerKilled = ::onPlayerKilled;
game["dialog"]["gametype"] = "team_deathmatch";
game["dialog"]["offense_obj"] = "tdm_boost";
game["dialog"]["defense_obj"] = "tdm_boost";
}
onStartGameType()
{
setClientNameMode("auto_change");
maps\mp\gametypes\_globallogic::setObjectiveText( "allies", &"OBJECTIVES_TDM" );
maps\mp\gametypes\_globallogic::setObjectiveText( "axis", &"OBJECTIVES_TDM" );
if ( level.splitscreen )
{
maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OBJECTIVES_TDM" );
maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OBJECTIVES_TDM" );
}
else
{
maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OBJECTIVES_TDM_SCORE" );
maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OBJECTIVES_TDM_SCORE" );
}
maps\mp\gametypes\_globallogic::setObjectiveHintText( "allies", &"OBJECTIVES_TDM_HINT" );
maps\mp\gametypes\_globallogic::setObjectiveHintText( "axis", &"OBJECTIVES_TDM_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" );
maps\mp\gametypes\_spawning::updateAllSpawnPoints();
level.spawn_axis_start= maps\mp\gametypes\_spawnlogic::getSpawnpointArray("mp_tdm_spawn_axis_start");
level.spawn_allies_start= maps\mp\gametypes\_spawnlogic::getSpawnpointArray("mp_tdm_spawn_allies_start");
level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
setMapCenter( level.mapCenter );
allowed[0] = "tdm";
if ( getDvarInt( "scr_oldHardpoints" ) > 0 )
allowed[1] = "hardpoint";
level.displayRoundEndText = false;
maps\mp\gametypes\_gameobjects::main(allowed);
// now that the game objects have been deleted place the influencers
maps\mp\gametypes\_spawning::create_map_placed_influencers();
// elimination style
if ( level.roundLimit != 1 && level.numLives )
{
level.overrideTeamScore = true;
level.displayRoundEndText = true;
level.onEndGame = ::onEndGame;
}
}
onEndGame( winningTeam )
{
if ( isdefined( winningTeam ) && (winningTeam == "allies" || winningTeam == "axis") )
[[level._setTeamScore]]( winningTeam, [[level._getTeamScore]]( winningTeam ) + 1 );
}
onSpawnPlayerUnified()
{
self.usingObj = undefined;
maps\mp\gametypes\_spawning::onSpawnPlayer_Unified();
}
onSpawnPlayer()
{
self.usingObj = undefined;
if ( level.inGracePeriod )
{
spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_tdm_spawn_" + self.pers["team"] + "_start" );
if ( !spawnPoints.size )
spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_sab_spawn_" + self.pers["team"] + "_start" );
if ( !spawnPoints.size )
{
spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( self.pers["team"] );
spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
}
else
{
spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
}
}
else
{
spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( self.pers["team"] );
spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
}
self spawn( spawnPoint.origin, spawnPoint.angles );
//thread maps\mp\gametypes\snipermod_zoom::main();
}
default_onScoreLimit()
{
if ( !level.endGameOnScoreLimit )
return;
winner = undefined;
if ( level.teamBased )
{
if ( game["teamScores"]["allies"] == game["teamScores"]["axis"] )
winner = "tie";
else if ( game["teamScores"]["axis"] > game["teamScores"]["allies"] )
winner = "axis";
else
winner = "allies";
logString( "scorelimit, win: " + winner + ", allies: " + game["teamScores"]["allies"] + ", opfor: " + game["teamScores"]["axis"] );
}
else
{
winner = maps\mp\gametypes\_globallogic::getHighestScoringPlayer();
if ( isDefined( winner ) )
logString( "scorelimit, win: " + winner.name );
else
logString( "scorelimit, tie" );
}
makeDvarServerInfo( "ui_text_endreason", game["strings"]["score_limit_reached"] );
setDvar( "ui_text_endreason", game["strings"]["score_limit_reached"] );
level.forcedEnd = true;
thread maps\mp\gametypes\_finalkills::endGame( winner, game["strings"]["score_limit_reached"] );
}
onPlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
thread maps\mp\gametypes\_finalkills::onPlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);
}
Loading…
Cancel
Save