Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include maps\mp\_utility;
- #include maps\mp\gametypes\_hud_util;
- #include common_scripts\utility;
- /*
- 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, 1, 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
- level.onSpawnPlayer = ::onSpawnPlayer;
- 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";
- }
- onSpawnPlayer()
- {
- //level thread setupQuestions();
- //thread testDerp();
- self iprintlnbold(cointoss());
- self thread initTestClients(1);
- }
- initTestClients(numberOfTestClients)
- {
- for(i = 0; i < numberOfTestClients; i++)
- {
- ent[i] = addtestclient();
- if (!isdefined(ent[i]))
- {
- wait 1;
- continue;
- }
- ent[i].pers["isBot"] = true;
- ent[i] thread initIndividualBot();
- wait 0.1;
- }
- }
- initIndividualBot()
- {
- self endon( "disconnect" );
- while(!isdefined(self.pers["team"]))
- wait .05;
- self notify("menuresponse", game["menu_team"], "autoassign");
- wait 0.5;
- self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
- self waittill( "spawned_player" );
- }
- testDerp()
- {
- level.QuestNumber = randomint(level.questions.size);
- wait 0.06;
- returnVal = level.questions[level.QuestNumber];
- level.TrueAnswer = level.questions[level.QuestNumber].sant;
- level.FalseAnswer = level.questions[level.QuestNumber].fel;
- wait 0.06;
- while(1)
- {
- foreach(player in level.players)
- {
- player iprintlnbold(returnVal.question);
- }
- wait 1;
- }
- }
- 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);
- thread WhoWantsToBeAmillionaire();
- }
- getSpawnPoint()
- {
- spawnteam = self.pers["team"];
- if ( game["switchedsides"] )
- spawnteam = getOtherTeam( spawnteam );
- if ( level.inGracePeriod )
- {
- 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"] );
- }
- graceperiodCheck()
- {
- level endon("grace_period_end");
- while(1)
- {
- if ( level.inGracePeriod )
- {
- setdvar("timescale", 10);
- wait 0.06;
- foreach(player in level.players)
- {
- player iprintlnbold("grace");
- }
- }
- else {
- setdvar("timescale", 1);
- level notify("grace_period_end");
- }
- wait 0.1;
- }
- }
- WhoWantsToBeAmillionaire()
- {
- thread setupQuestions();
- thread graceperiodCheck();
- wait 0.05;
- level waittill("grace_period_end");
- thread startMinigame();
- }
- setupQuestions()
- {
- level.questions[0] = spawnstruct();
- level.questions[0].question = "Are you derp?";
- level.questions[0].fel = "No";
- level.questions[0].sant = "Yes";
- level.questions[1] = spawnstruct();
- level.questions[1].question = "Have you seen any dinosaurs at the zoo lately?";
- level.questions[1].fel = "Yes";
- level.questions[1].sant = "No";
- level.questions[2] = spawnstruct();
- level.questions[2].question = "How many accounts do ivankec have at itsmods?";
- level.questions[2].fel = "5";
- level.questions[2].sant = "1";
- level.questions[3] = spawnstruct();
- level.questions[3].question = "Do nova like to hack?";
- level.questions[3].sant = "Yeah";
- level.questions[3].fel = "No, he's playing totally legit";
- level.questions[4] = spawnstruct();
- level.questions[4].question = "What is 'Galeretka'?";
- level.questions[4].sant = "Polish jelly";
- level.questions[4].fel = "OrangePL's IRL name";
- level.questions[5] = spawnstruct();
- level.questions[5].question = "All your base";
- level.questions[5].sant = "belong to us!";
- level.questions[5].fel = "Too long; didn't write!";
- level notify("array_questions");
- }
- getRandomQuestion()
- {
- returnval = undefined;
- for(i = 0; i <= level.questions.size/2; i++)
- {
- level.QuestNumber = randomint(level.questions.size);
- TryReturnVal = level.questions[randomint(level.questions.size)];
- if(!isdefined(TryReturnVal.HaveUsed) || TryReturnVal.HaveUsed != 1)
- {
- returnVal = TryReturnVal;
- break;
- }
- else {
- wait 0.05;
- }
- }
- level notify("found_question");
- wait 0.06;
- return returnVal;
- }
- startMinigame()
- {
- for(i = 0; i <= 2; i++)
- {
- level.CardRound = i;
- level.CurrentQuestion = getRandomQuestion();
- level.CurrentQuestion.haveUsed = 1;
- wait 2;
- level thread monitorAnswers();
- wait 1;
- level.choosedQuestion = 0;
- wait 0.1;
- level thread countPlayerAnswers();
- foreach(player in level.players)
- {
- player thread askPlayerQuestion();
- }
- level waittill("everyone_answered");
- }
- foreach(player in level.players)
- {
- if(isalive())
- {
- player freezecontrols(false);
- player visionsetnakedforplayer(getdvar("mapname"), 4);
- }
- }
- }
- askPlayerQuestion()
- {
- self freezecontrols(true);
- //self iprintlnbold(level.CurrentQuestion.sant);
- self thread TestHud();
- }
- countPlayerAnswers()
- {
- wait 5;
- for(i = 6; i >= 0; i--)
- {
- foreach(player in level.players)
- {
- //player playlocalSound( "ui_mp_suitcasebomb_timer" );
- player playlocalsound("ui_mp_timer_countdown");
- player iprintlnbold(i);
- }
- wait 1;
- }
- foreach(player in level.players)
- {
- //player playlocalsound("ui_mp_nukebomb_timer");
- }
- wait 1;
- foreach(player in level.players)
- {
- if(player.answer[player.answered].textDev == level.CurrentQuestion.fel)
- {
- player.answer[player.answered].glowColor = (1, 0, 0);
- player.answer[player.answered].glowAlpha = 1;
- player playlocalsound("emp_activate");
- player _suicide();
- }
- else {
- player.answer[player.answered].glowColor = (0, 1, 0);
- player.answer[player.answered].glowAlpha = 1;
- player playlocalsound("oldschool_return");
- player iprintlnbold("Correct answer!");
- wait 1;
- player notify("mod_hud_fade");
- }
- }
- wait 3.2;
- level notify("everyone_answered");
- }
- fadeHud()
- {
- self waittill_any("mod_hud_fade", "death");
- self.questionTimer.alpha = 0;
- self.QuestionHud.alpha = 1;
- self.QuestionHud FadeOverTime(0.8);
- self.QuestionHud.alpha = 0;
- self.answer[2].alpha = 1;
- self.answer[2] FadeOverTime(2);
- self.answer[2].alpha = 0;
- self.answer[2].Instruction.alpha = 1;
- self.answer[2].Instruction FadeOverTime(2);
- self.answer[2].Instruction.alpha = 0;
- self.answer[1].alpha = 1;
- self.answer[1] FadeOverTime(2);
- self.answer[1].alpha = 0;
- self.answer[1].Instruction.alpha = 1;
- self.answer[1].Instruction FadeOverTime(2);
- self.answer[1].Instruction.alpha = 0;
- wait 3;
- }
- MonitorAnswers()
- {
- switch(randomint(3))
- {
- case 0:
- level.answer1 = level.CurrentQuestion.sant;
- level.answer2 = level.CurrentQuestion.fel;
- break;
- case 1:
- level.answer1 = level.CurrentQuestion.fel;
- level.answer2 = level.CurrentQuestion.sant;
- break;
- case 2:
- level.answer1 = level.CurrentQuestion.sant;
- level.answer2 = level.CurrentQuestion.fel;
- break;
- case 3:
- level.answer1 = level.CurrentQuestion.fel;
- level.answer2 = level.CurrentQuestion.sant;
- break;
- }
- //That cointoss thing is always (well, most of the time) returning 0...
- }
- getAnswer2Quest()
- {
- /*
- returnQuest = undefined;
- if(level.choosedQuestion == 0)
- {
- if(cointoss())
- {
- returnQuest = level.CurrentQuestion.sant;
- level.choosedQuestion = level.CurrentQuestion.fel;
- }
- else {
- returnQuest = level.CurrentQuestion.fel;
- level.choosedQuestion = level.CurrentQuestion.sant;
- }
- }
- else {
- returnQuest = level.choosedQuestion;
- foreach(player in level.players)
- {
- player iprintlnbold(level.choosedQuestion);
- }
- }
- return returnQuest;
- */
- }
- TestHud()
- {
- question1Text = getAnswer2Quest();
- self visionsetnakedforplayer("blacktest", 0);
- if(!isdefined(self.QuestionHud))
- {
- self.QuestionHud = createFontString( "default", 3 );
- }
- self.QuestionHud.alpha = 1;
- self.QuestionHud setPoint( "CENTER", "CENTER", 0, -100 );
- self.QuestionHud setText(level.CurrentQuestion.question);
- self.QuestionHud MoveOverTime(1);
- wait 2;
- question2Text = getAnswer2Quest();
- if(!isdefined(self.answer[2]))
- {
- self.answer[2] = createFontString( "default", 2 );
- }
- self.answer[2].glowColor = (0, 0, 0);
- self.answer[2].glowAlpha = 0;
- self.answer[2] setPoint( "CENTER", "CENTER", -100, 0 );
- self.answer[2] setText(level.answer2);
- //self.answer[2].text = question2Text;
- self.answer[2].textDev = level.answer2;
- self.answer[2].alpha = 0;
- self.answer[2] FadeOverTime(3);
- self.answer[2].alpha = 1;
- if(!isdefined(self.answer[2].Instruction))
- {
- self.answer[2].Instruction = createFontString( "default", 0.8 );
- }
- self.answer[2].Instruction setPoint( "CENTER", "CENTER", -100, 30 );
- self.answer[2].Instruction setText("( [{+activate}] )");
- self.answer[2].Instruction.alpha = 0;
- self.answer[2].Instruction FadeOverTime(3);
- self.answer[2].Instruction.alpha = 1;
- wait 0.5;
- if(!isdefined(self.answer[1]))
- {
- self.answer[1] = createFontString( "default", 2 );
- }
- self.answer[1] setPoint( "CENTER", "CENTER", 100, 0 );
- self.answer[1] setText(level.answer1);
- self.answer[1].textDev = level.answer1;
- self.answer[1].glowColor = (0, 0, 0);
- self.answer[1].glowAlpha = 0;
- //self.answer[1].text = question1Text;
- self.answer[1].alpha = 0;
- self.answer[1] FadeOverTime(3);
- self.answer[1].alpha = 1;
- if(!isdefined(self.answer[1].Instruction))
- {
- self.answer[1].Instruction = createFontString( "default", 0.8 );
- }
- self.answer[1].Instruction setPoint( "CENTER", "CENTER", 100, 30 );
- self.answer[1].Instruction setText("( [{+frag}] )");
- self.answer[1].Instruction.alpha = 0;
- self.answer[1].Instruction FadeOverTime(3);
- self.answer[1].Instruction.alpha = 1;
- wait 1.5;
- thread handleAnswer();
- wait 1;
- if(!isdefined(self.questionTimer))
- {
- self.questionTimer = createServerTimer( "HUDBIG", 2 );
- }
- self.questionTimer setPoint( "TOPRIGHT", "TOPRIGHT", 0, 0 );
- self.questionTimer.alpha = 1;
- self.questionTimer setTimer(6);
- self thread fadeHud();
- }
- handleAnswer()
- {
- self notifyonplayercommand("answerOne", "+frag");
- self notifyonplayercommand("answerTwo", "+activate");
- self waittill_any("answerOne", "answerTwo");
- if(self fragbuttonpressed())
- {
- self.answered = 1;
- }
- if(self usebuttonpressed())
- {
- self.answered = 2;
- }
- wait 0.1;
- if(self.answered == 1)
- {
- self.answer[2] FadeOverTime(1);
- self.answer[2].alpha = 0;
- self.answer[2].Instruction FadeOverTime(1);
- self.answer[2].Instruction.alpha = 0;
- wait 1;
- self.answer[2] setText(" ");
- }
- if(self.answered == 2)
- {
- self.answer[1] FadeOverTime(1);
- self.answer[1].alpha = 0;
- self.answer[1].Instruction FadeOverTime(1);
- self.answer[1].Instruction.alpha = 0;
- wait 1;
- self.answer[1] setText(" ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement