Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Annihilation PvE Co-op GameMode
- * Author : is died during the game
- * "Contact" : follow the road to the bottom of the road, access the cemetery and look for it
- */
- // ---------------------------------- //
- // Requirements
- // ---------------------------------- //
- #Extends "Modes/ShootMania/ModeBase.Script.txt"
- #Const CompatibleMapTypes "AnnihilationArena"
- #Const Version "2100-01-01"
- #Const ScriptName "Annihilation.Script.txt"
- #Include "MathLib" as MathLib
- #Include "TextLib" as TextLib
- #Include "Libs/Nadeo/Message.Script.txt" as Message
- #Include "Libs/Nadeo/Interface.Script.txt" as Interface
- #Include "Libs/Nadeo/ShootMania/SM.Script.txt" as SM
- #Include "Libs/Nadeo/ShootMania/Score.Script.txt" as Score
- #Include "Libs/Nadeo/ShootMania/SpawnScreen.Script.txt" as SpawnScreen
- // ---------------------------------- //
- // Settings
- // ---------------------------------- //
- //#Setting S_GameMode 0 as _("GameMode : 0 - Rounds, 1 - Survival, 2 - Custom (Enable option below)")
- //
- #Setting S_NbPlayers 6 as _("Number of max players")
- #Setting S_NbBots 30 as _("Number of bots total")
- #Setting S_Saunter_Radius 10. as _("Radius of bots from their spawn")
- #Setting S_AggroRadius 50. as _("Radius vision of bots")
- #Setting S_DisengageDistance 30. as _("Distance of disengage from their start")
- #Setting S_Accuracy 0.6 as _("Accuracy of bots")
- #Setting S_WeaponNumber 1 as _("Used weapon (1: Laser, 2: Rocket, 3: Nucleus, 4: Arrow, 6: Missile, else: Random)")
- #Setting S_ArmorMax 4 as _("Max armor of players") // Max armor of players
- #Setting S_AmmoMax 1. as _("Max ammunition factor") // Max ammunition factor
- #Setting S_AmmoGain 1.8 as _("Ammunition gain factor") // Speed of ammunition reload
- // ---------------------------------- //
- // Constants
- // ---------------------------------- //
- #Const C_ImgBase "file://ManiaPlanet/Media/Sounds"
- #Const C_KillStreakTime 2000 // Time between hits to perform a consecutive kill streak
- #Const C_AutoSwitchWeapon False // Automatically switch weapons (tunnels & laser pads) - With rockets => AutoTrue
- #Const C_StaminaFactor 1.0 // Stamina max & reload factor
- #Const C_DisplayHitDist True // Enable to display the distance when you hit someone
- #Const C_NearMissDist 0.7 // Max distance to show NearMiss message (-1 to disable the messages)
- #Const C_AnnounceHeadshots True // Announce headshots with a headshot sound
- #Const UITickPeriod 200
- #Const MaxRounds 6
- #Const Description _("TYPE: PvE Co-Op\nOBJECTIVE: Kill all bots before they get angry!\nINFOS\$0f0nGreen bots $g: Rocket\$f0cnPurple bots $g: Nucleus\$9ffnBlue bots $g: Laser\$ff0nYellow bots $g: Arrow")
- // ---------------------------------- //
- // Global var
- // ---------------------------------- //
- declare CUILayer SoundLayerFirst;
- declare CUILayer SoundLayerSecond;
- declare CUILayer MatchInfo;
- declare Integer LastHit;
- declare Integer KillStreak;
- declare Integer Score;
- declare Integer TimeLimit;
- declare Integer Round;
- declare Text GamePhase;
- declare Boolean CanPlay;
- declare Integer _LatestUITickLayerTeam;
- declare CUILayer _LayerTeam;
- declare Text[Ident] _PlayerManialinkLines;
- // ---------------------------------- //
- // Set rules
- // ---------------------------------- //
- ***Rules***
- ***
- declare ModeName = "Annihilation";
- declare ModeRules = TextLib::Compose(_("Kill all bots in the map before they get angry\$0f0nGreen bots $g: Rocket\$f0cnPurple bots $g: Nucleus\$9ffnBlue bots $g: Laser\$ff0nYellow bots $g: Arrow"), "$"^SpawnScreen::GetModeColor());
- SpawnScreen::ResetRulesSection();
- SpawnScreen::AddSubsection(_("Annihilation - PvE Co-Op Gamemode"), ModeRules, 20.);
- SpawnScreen::CreatePrettyRules(ModeName);
- ModeStatusMessage = _("TYPE: PvE Co-Op\nOBJECTIVE: Kill all bots before they get angry!\nINFOS\$0f0nGreen bots $g: Rocket\$f0cnPurple bots $g: Nucleus\$9ffnBlue bots $g: Laser\$ff0nYellow bots $g: Arrow");
- ***
- // ---------------------------------- //
- // Server start
- // ---------------------------------- //
- ***StartServer***
- ***
- SoundLayerFirst = UIManager.UILayerCreate();
- UIManager.UIAll.UILayers.add(SoundLayerFirst);
- SoundLayerFirst.ManialinkPage = """
- """;
- SoundLayerSecond = UIManager.UILayerCreate();
- UIManager.UIAll.UILayers.add(SoundLayerSecond);
- SoundLayerSecond.ManialinkPage = """
- """;
- MatchInfo = UIManager.UILayerCreate();
- UIManager.UIAll.UILayers.add(MatchInfo);
- MatchInfo.ManialinkPage = """
- """;
- //Layer Team
- _LayerTeam = UIManager.UILayerCreate();
- UIManager.UIAll.UILayers.add(_LayerTeam);
- _LayerTeam.ManialinkPage = """
- """;
- // ---------------------------------- //
- // Set mode options
- UseClans = True;
- UseAllies = True;
- // ---------------------------------- //
- // Create the rules
- ---Rules---
- // ---------------------------------- //
- // Initialize UI
- SpawnScreen::CreateScores("Score.RoundPoints");
- SpawnScreen::CreateMapInfo();
- //Interface::CreateRank();
- // ---------------------------------- //
- // Create the scores table
- ST2::SetStyle("LibST_SMBaseSolo");
- ST2::SetStyle("LibST_SMBasePoints");
- MB_SetScoresTableStyleFromXml(S_ScoresTableStylePath);
- ST2::Build("SM");
- ***
- // ---------------------------------- //
- // Map start
- // ---------------------------------- //
- ***StartMap***
- ***
- LastHit = Now;
- KillStreak = 0;
- Score = 0;
- Round = 1;
- GamePhase = "checking";
- Score::MatchBegin();
- SM::SetupDefaultVisibility();
- // ---------------------------------- //
- // Init bases
- foreach (Base in MapBases) {
- Base.Clan = 1;
- Base.IsActive = True;
- }
- // ---------------------------------- //
- // New map sound
- UIManager.UIAll.UISequence = CUIConfig::EUISequence::Intro;
- ***
- // ---------------------------------- //
- // Play loop
- // ---------------------------------- //
- ***PlayLoop***
- ***
- if(GamePhase == "checking"){
- CheckSettings();
- EndTime = 0;
- }
- if(GamePhase == "newRound"){
- PlaySound("newRoundIn", -1);
- declare Msg = "";
- Msg = TextLib::Compose(_("$s$i$o$af0Round $f00%1$fff-$f00%2"), TextLib::ToText(Round), TextLib::ToText(MaxRounds));
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::PhaseChange, 0);
- sleep(2000);
- CreateBots();
- SpawnPlayers();
- UIManager.UIAll.UISequence = CUIConfig::EUISequence::Playing;
- StartTime = Now;
- TimeLimit = 50 - 5 * Players.count;
- if (TimeLimit > 0) EndTime = StartTime + (TimeLimit * 1000) + 2500;
- else EndTime = -1;
- Score = 1;
- sleep(1000);
- PlaySound("play", 0);
- Msg = TextLib::Compose(_("$s$i$o$f00|||"), TextLib::ToText(Round));
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::Silence, 0);
- sleep(500);
- Msg = TextLib::Compose(_("$s$i$o$f00||"), TextLib::ToText(Round));
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::Silence, 0);
- sleep(500);
- Msg = TextLib::Compose(_("$s$i$o$f00|"), TextLib::ToText(Round));
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::Silence, 0);
- sleep(500);
- Msg = TextLib::Compose(_("$s$i$o$af0Play!"), TextLib::ToText(Round));
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::Silence, 0);
- MatchInfo(True);
- GamePhase = "play";
- } else if(GamePhase == "play"){
- ShowLayerTeam(True);
- foreach (Event, PendingEvents) {
- // ---------------------------------- //
- // On armor empty
- if (Event.Type == CSmModeEvent::EType::OnArmorEmpty) {
- if(Event.Victim.IsFakePlayer){
- Score += 1;
- declare Msg = "";
- declare Gap = BotPlayers.count - Score;
- declare Variant = 3 - Gap;
- if (Gap > 0 && Gap <= 3) {
- if (Gap > 1) {
- Msg = TextLib::Compose(_("%1 $s$i$o$f90bots around..."), TextLib::ToText(Gap));
- } else {
- Msg = TextLib::Compose(_("$s$i$o$f00Pulverize the last bot!!!"));
- }
- Message::SendStatusMessage(Msg, 2000, 3, CUIConfig::EUISound::TieBreakPoint, Variant);
- }
- else if (Gap <= 0) {
- Msg = TextLib::Compose(_("$s$i$o$f00All bots are powdered, good job!!!"));
- Message::SendStatusMessage(Msg, 2000, 3, CUIConfig::EUISound::VictoryPoint, 0);
- EndTime = 0;
- GamePhase = "roundEnd";
- } else {
- Message::SendStatusMessage(TextLib::Compose("$af0%1 : %2 / %3", _("$s$i$o$af0Kills"), TextLib::ToText(Score), TextLib::ToText(BotPlayers.count)), 2000, 3, CUIConfig::EUISound::ScoreProgress, MathLib::Rand(0,3));
- }
- MatchInfo(True);
- XmlRpc::OnArmorEmpty(Event);
- PassOn(Event);
- } else{
- declare statusMsg = TextLib::Compose(_("%1 $m$s$i$o$f00is dead!"), Event.Victim.Name);
- ChangePlayerState(Event.Victim, False);
- Message::SendStatusMessage(statusMsg, 2000, 3, CUIConfig::EUISound::EndMatch, 0);
- XmlRpc::OnArmorEmpty(Event);
- PassOn(Event);
- }
- }
- // ---------------------------------- //
- // On hit
- else if (Event.Type == CSmModeEvent::EType::OnHit) {
- if (Event.Victim == Null || Event.Shooter == Event.Victim) {
- Discard(Event);
- } else {
- if(Event.Shooter.IsFakePlayer && !Event.Victim.IsFakePlayer){ //Bots shoots Players
- Event.Damage = 100;
- XmlRpc::OnHit(Event);
- PassOn(Event);
- } else if(!Event.Shooter.IsFakePlayer && Event.Victim.IsFakePlayer){ //Players shoots Bots
- declare Points = 1;
- Score::AddPoints(Event.Shooter, Points);
- Event.ShooterPoints = Points;
- declare Distance = SendHitDistanceMessage(Event);
- SetPlayerAmmo(Event.Shooter, CSmMode::EWeapon::Laser, 1);
- declare HitInterval = 700;
- if(Now < LastHit + HitInterval){
- KillStreak += 1;
- LastHit = Now;
- DoKillStreakAnnounce();
- } else {
- KillStreak = 0;
- LastHit = Now;
- }
- declare lifeStealChance = MathLib::Rand(0,1);
- if(lifeStealChance == 1){
- Event.Shooter.Armor += 100;
- declare UI <=> UIManager.GetUI(Event.Shooter);
- UI.SendNotice(TextLib::Compose(_("$s$o$af0+1 Life!")), CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::Silence, 0);
- }
- if(Event.Victim.Armor == 100){
- declare bonusTime = 0;
- switch (Players.count){
- case 1:
- bonusTime = MathLib::Rand(3,4);
- case 2:
- bonusTime = MathLib::Rand(2,4);
- case 3:
- bonusTime = MathLib::Rand(2,3);
- case 4:
- bonusTime = MathLib::Rand(1,2);
- default:
- bonusTime = MathLib::Rand(3,4);
- }
- EndTime += (bonusTime * 1000);
- if(KillStreak == 0){
- if(bonusTime == 1){
- Message::SendBigMessage(TextLib::Compose(_("$s$i$o$fff+%1 $af0second $fff!"), TextLib::ToText(bonusTime)), 3000, 0);
- } else {
- Message::SendBigMessage(TextLib::Compose(_("$s$i$o$fff+%1 $af0seconds $fff!"), TextLib::ToText(bonusTime)), 3000, 0);
- }
- } else {
- if(bonusTime == 1){
- Message::SendBigMessage(TextLib::Compose(_("$s$i$o$fff+%1 $af0second $fff! ($f00+%2!$fff)"), TextLib::ToText(bonusTime+1), TextLib::ToText(1)), 3000, 0);
- } else {
- Message::SendBigMessage(TextLib::Compose(_("$s$i$o$fff+%1 $af0seconds $fff! ($f00+%2!$fff)"), TextLib::ToText(bonusTime+1), TextLib::ToText(1)), 3000, 0);
- }
- EndTime += 1000;
- }
- Event.Damage = 100;
- }
- XmlRpc::OnHit(Event);
- PassOn(Event);
- } else {
- Discard(Event);
- }
- }
- }
- // ---------------------------------- //
- // On player request respawn
- else if (Event.Type == CSmModeEvent::EType::OnPlayerRequestRespawn) {
- if(Event.Player.SpawnStatus == CSmPlayer::ESpawnStatus::Spawned) {
- declare statusMsg = TextLib::Compose(_("%1 $m$s$i$o$f00is dead!"), Event.Player.Name);
- Message::SendStatusMessage(statusMsg, 2000, 3, CUIConfig::EUISound::EndMatch, 0);
- ChangePlayerState(Event.Player, False);
- }
- XmlRpc::OnPlayerRequestRespawn(Event);
- PassOn(Event);
- } else {
- Discard(Event);
- }
- }
- TimerSound();
- if(EndTime < Now || Players.count == 0 || ClansNbPlayersAlive[1] == 0){
- sleep(1000);
- GamePhase = "roundEnd";
- }
- } else if (GamePhase == "roundEnd") {
- ShowLayerTeam(False);
- sleep(2000);
- MatchInfo.ManialinkPage = "";
- DestroyAllBotPlayers();
- MatchInfo(False);
- EndTime = 0;
- declare Msg = "";
- if(Score == BotPlayers.count) {
- if(Round >= MaxRounds){
- UnspawnPlayers();
- Msg = TextLib::Compose(_("$m$s$i$o$af0You are the best pulverizer!!!"));
- PlaySound("win", 0);
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::EndRound, 0);
- UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::ForcedVisible;
- UIManager.UIAll.UISequence = CUIConfig::EUISequence::PlayersPresentation;
- sleep(3000);
- Message::CleanBigMessages();
- Message::CleanStatusMessages();
- Score::MatchEnd(True);
- Round = 1;
- PlaySound("nextMap", 0);
- MatchEndRequested = True;
- sleep(8000);
- } else {
- Msg = TextLib::Compose(_("$s$i$o$af0Round $f00%1 $af0terminated!"), TextLib::ToText(Round));
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::EndRound, 0);
- Score::RoundEnd();
- PlaySound("excellent", 0);
- Round += 1;
- sleep(1000);
- GamePhase = "checking";
- }
- } else {
- UnspawnPlayers();
- Msg = TextLib::Compose(_("$s$i$o$af0Terminated!"));
- Score::RoundEnd();
- PlaySound("lost", 0);
- Message::SendBigMessage(Msg, 2000, 3, CUIConfig::EUISound::EndRound, 0);
- UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::ForcedVisible;
- UIManager.UIAll.UISequence = CUIConfig::EUISequence::PlayersPresentation;
- Round = 1;
- sleep(2000);
- Score::MatchEnd();
- Score::MatchBegin();
- }
- sleep(2000);
- GamePhase = "checking";
- }
- Message::Loop();
- ***
- // ---------------------------------- //
- // Map end
- // ---------------------------------- //
- /****EndMap***
- ***
- ****/
- // ---------------------------------- //
- // Server end
- // ---------------------------------- //
- ***EndServer***
- ***
- UIManager.UILayerDestroyAll();
- Interface::DestroyRank();
- SpawnScreen::DestroyRules();
- SpawnScreen::DestroyScores();
- SpawnScreen::DestroyMapInfo();
- ***
- // ---------------------------------- //
- // Functions
- // ---------------------------------- //
- Void ChangePlayerState(CSmPlayer Player, Boolean IsFree){
- if(Player.CurrentClan==0) return;
- if(IsFree){
- _PlayerManialinkLines[Player.Id] = """<player login="{{{Player.Login}}}"/>""";
- }else{
- _PlayerManialinkLines[Player.Id] = """<player isalive="false" nickname="{{{TextLib::MLEncode(Player.Name)}}}"/>""";
- }
- }
- // Play sound
- Sound::PlaySound(C_ImgBase^"Sounds/30_seconds_remain.ogg");
- Sound::PlaySound(C_ImgBase^"Sounds/Play.ogg");
- Sound::PlaySound(C_ImgBase^"Sounds/You_Have_Lost_the_Match.ogg");
- Sound::PlaySound(C_ImgBase^"Sounds/You_Have_Won_the_Match.ogg");
- Sound::PlaySound(C_ImgBase^"Sounds/NewRoundIn.ogg");
- Void CreateAnniBot(Text _Type, CSmMapLandmark _Spawn){
- declare newBot = CreateBotPlayer(NullId, 0);
- switch(_Type){
- case "Laser":{
- SetPlayerWeapon(newBot, CSmMode::EWeapon::Laser, False);
- newBot.ForceColor = <0.0, 0.5, 0.5>;}
- case "Rocket":{
- SetPlayerWeapon(newBot, CSmMode::EWeapon::Rocket, False);
- newBot.ForceColor = <0.0, 1.0, 0.0>;}
- case "Nucleus":{
- SetPlayerWeapon(newBot, CSmMode::EWeapon::Nucleus, False);
- newBot.ForceColor = <0.5, 0.0, 0.5>;}
- case "Arrow":{
- SetPlayerAmmoMax(newBot, CSmMode::EWeapon::Arrow, 2);
- SetPlayerWeapon(newBot, CSmMode::EWeapon::Arrow, False);
- newBot.ForceColor = <0.5, 0.5, 0.0>;}
- case "Special":{
- SetPlayerWeapon(newBot, CSmMode::EWeapon::Rocket, False);
- newBot.ForceColor = <1.0, 0.5, 0.0>;}
- }
- newBot.Driver.AttackFilter = CSmPlayerDriver::ESmAttackFilter::OppositePlayers;
- if(_Type != "Special"){
- newBot.Driver.Behaviour = CSmPlayerDriver::ESmDriverBehaviour::Saunter;
- newBot.Driver.Saunter_AnchorPoint = _Spawn.Position;
- newBot.Driver.Saunter_Radius = 10.;
- newBot.Driver.AggroRadius = 50.;
- newBot.Driver.DisengageDistance = 30.;
- newBot.Driver.Accuracy = 0.6;
- newBot.Driver.ShootPeriodMin = 500;
- newBot.Driver.ShootPeriodMax = 500;
- newBot.AmmoGain = 1.0;
- } else {
- newBot.Driver.Behaviour = CSmPlayerDriver::ESmDriverBehaviour::Turret;
- newBot.Driver.AggroRadius = 100.;
- newBot.Driver.DisengageDistance = 0.;
- newBot.Driver.Accuracy = 1.0;
- newBot.Driver.ShootPeriodMin = 10;
- newBot.Driver.ShootPeriodMax = 10;
- newBot.Driver.RocketAnticipation = True;
- newBot.AmmoGain = 10.0;
- }
- newBot.Driver.Fov = 400.0;
- newBot.ArmorMax = 100;
- newBot.Driver.AggroRadius = S_AggroRadius;
- newBot.Driver.ShootRadius = newBot.Driver.AggroRadius;
- newBot.Driver.DisengageDistance = newBot.Driver.AggroRadius;
- newBot.Driver.TargetMinDistance = 1.;
- SpawnBotPlayer(newBot, 0, 100, _Spawn.BotPath, Now);
- }
- Void CreateBots(){
- //Bots creation
- declare botCountId = 0;
- while(botCountId < MathLib::Clamp(S_NbBots, 1, 256)) {
- declare Spawn <=> MapLandmarks_BotPath[MathLib::Rand(0, MapLandmarks_BotPath.count-1)];
- declare botsWeapons = 0;
- if(Spawn.Tag == "BotPath"){
- if(Round == 1){
- botsWeapons = 1;
- }
- if(Round == 2){
- botsWeapons = 2;
- }
- if(Round == 3){
- botsWeapons = MathLib::Rand(2,3);
- }
- if(Round == 4){
- botsWeapons = 3;
- }
- if(Round == 5){
- botsWeapons = MathLib::Rand(3,4);
- }
- if(Round == 6){
- botsWeapons = MathLib::Rand(1,4);
- }
- if(botsWeapons == 1){
- CreateAnniBot("Laser",Spawn);
- } else if(botsWeapons == 2){
- CreateAnniBot("Rocket",Spawn);
- } else if(botsWeapons == 3){
- CreateAnniBot("Nucleus",Spawn);
- } else if(botsWeapons == 4){
- CreateAnniBot("Arrow", Spawn);
- }
- botCountId += 1;
- }
- }
- foreach(BotPath, MapLandmarks_BotPath){
- if(BotPath.Tag == "Special"){
- if(Round == MaxRounds){
- CreateAnniBot("Special", BotPath);
- }
- }
- }
- }
- // Get the currently used weapon
- CSmMode::EWeapon GetWeapon() {
- declare WeaponNumber = S_WeaponNumber;
- if (WeaponNumber < 1 || WeaponNumber > 6) {
- // Random weapon
- WeaponNumber = MathLib::Rand(1, 6);
- }
- // Return weapon
- switch (WeaponNumber) {
- case 1: {
- return CSmMode::EWeapon::Laser;
- }
- case 3: {
- return CSmMode::EWeapon::Nucleus;
- }
- case 4: {
- return CSmMode::EWeapon::Arrow;
- }
- case 6: {
- return CSmMode::EWeapon::Missile;
- }
- }
- return CSmMode::EWeapon::Rocket;
- }
- // Get whether weapons should be switched automatically
- Boolean GetAutoSwitchWeapon(CSmMode::EWeapon _Weapon) {
- return (C_AutoSwitchWeapon || _Weapon == CSmMode::EWeapon::Rocket);
- }
- Void SpawnPlayers() {
- foreach (Player in Players) {
- if(Player.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned){
- Player.ArmorMax = MathLib::Max(S_ArmorMax, 1) * 100;
- Player.AmmoGain = MathLib::Clamp(S_AmmoGain, 0., 10.);
- SetPlayerClan(Player, 1);
- ChangePlayerState(Player, True);
- SetPlayerWeapon(Player, GetWeapon(), GetAutoSwitchWeapon(GetWeapon()));
- SpawnPlayer(Player, 1, Player.ArmorMax, MapLandmarks_PlayerSpawn[MathLib::Rand(0, MapLandmarks_PlayerSpawn.count-1)].PlayerSpawn, Now);
- }
- }
- }
- // Set player weapon
- Void SetPlayerWeapon(CSmPlayer _Player) {
- if (_Player.SpawnStatus != CSmPlayer::ESpawnStatus::Spawned) {
- declare Weapon = GetWeapon();
- This.SetPlayerWeapon(_Player, Weapon, GetAutoSwitchWeapon(Weapon));
- // Set weapon depending values
- declare Integer AmmoMax;
- declare Real Accuracy;
- switch (Weapon) {
- case CSmMode::EWeapon::Rocket: {
- AmmoMax = 4;
- Accuracy = 1.0;
- }
- case CSmMode::EWeapon::Laser: {
- AmmoMax = 1;
- Accuracy = 1.0;
- }
- case CSmMode::EWeapon::Nucleus: {
- AmmoMax = 2;
- Accuracy = 1.0;
- }
- case CSmMode::EWeapon::Arrow: {
- AmmoMax = 3;
- Accuracy = 1.0;
- }
- default: {
- AmmoMax = 1;
- Accuracy = 1.0;
- }
- }
- This.SetPlayerAmmoMax(_Player, Weapon, MathLib::NearestInteger(AmmoMax*S_AmmoMax));
- if (_Player.Driver != Null) {
- _Player.Driver.Accuracy = S_Accuracy;
- }
- }
- }
- Void UnspawnPlayers(){
- foreach (Player in Players) {
- if (Player.SpawnStatus == CSmPlayer::ESpawnStatus::Spawned) {
- UnspawnPlayer(Player);
- }
- }
- }
- Real SendHitDistanceMessage(CSmModeEvent _Event) {
- if (_Event.Type != CSmModeEvent::EType::OnHit) return -1.; // Wrong event type
- if (_Event.Shooter == Null || _Event.Victim == Null || _Event.Shooter == _Event.Victim) return -1.; // Invalid players
- // Get distance
- declare Distance = MathLib::Distance(_Event.Shooter.Position, _Event.Victim.Position);
- Distance = MathLib::NearestInteger(Distance * 10) / 10.0;
- // Save longest hit
- /*
- if (Distance > G_LongestHitDist) {
- G_LongestHitDist = Distance;
- G_LongestHitName = _Event.Shooter.Name;
- SetFooterStats(Null);
- }
- */
- declare UI <=> UIManager.GetUI(_Event.Shooter);
- if (UI == Null) return -1.;
- // Send message
- UI.SendNotice(TextLib::Compose(_("$s$i$o$af0%1m hit!"), TextLib::ToText(Distance)),
- CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default,
- CUIConfig::EUISound::Silence, 0);
- return Distance;
- }
- //Play sound
- Sound::PlaySound(C_ImgBase^"Sounds/Double_Kill.ogg");
- foreach(Player in Players){
- declare UI <=> UIManager.GetUI(Player);
- UI.SendNotice(TextLib::Compose(_("$f00Double Kill!")), CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::Silence, 0);
- }
- Sound::PlaySound(C_ImgBase^"Sounds/MultiKill.ogg");
- foreach(Player in Players){
- declare UI <=> UIManager.GetUI(Player);
- UI.SendNotice(TextLib::Compose(_("$f00Multi Kill!")), CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::Silence, 0);
- }
- Sound::PlaySound(C_ImgBase^"Sounds/MegaKill.ogg");
- foreach(Player in Players){
- declare UI <=> UIManager.GetUI(Player);
- UI.SendNotice(TextLib::Compose(_("$f00Mega Kill!")), CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::Silence, 0);
- }
- Sound::PlaySound(C_ImgBase^"Sounds/UltraKill.ogg");
- foreach(Player in Players){
- declare UI <=> UIManager.GetUI(Player);
- UI.SendNotice(TextLib::Compose(_("$f00Ultra Kill!")), CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::Silence, 0);
- }
- Sound::PlaySound(C_ImgBase^"Sounds/MonsterKill_F.ogg");
- foreach(Player in Players){
- declare UI <=> UIManager.GetUI(Player);
- UI.SendNotice(TextLib::Compose(_("$f00Monster Kill!")), CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::Silence, 0);
- }
- Void MatchInfo(Boolean show){
- if(show){
- MatchInfo.ManialinkPage = """
- <frame posn="158 -76 0">
- <label posn="0 0 1" halign="right" style="TextButtonNav" text="{{{_("$s$i$o$af0$oKills")}}} : {{{Score}}}/{{{BotPlayers.count}}}" />
- </frame>
- <frame posn="158 -72 0">
- <label posn="0 0 1" halign="right" style="TextButtonNav" text="{{{_("$s$i$o$af0$oRound")}}} : {{{Round}}}/{{{MaxRounds}}}" />
- </frame>
- <quad posn="165 -80 0" halign= "right" sizen="49 13" bgcolor="FFFA" image="https://dl.dropboxusercontent.com/u/39375802/ATA/logoann.png"/>
- """;
- } else {
- MatchInfo.ManialinkPage = "";
- }
- }
- Void CheckSettings(){
- UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::Normal;
- if (MapLandmarks_BotPath.count == 0){
- declare Msg = TextLib::Compose(_("This map doesn't have bot spawns. Skipping..."));
- Message::SendBigMessage(Msg, 1000, 3, CUIConfig::EUISound::EndRound, 0);
- sleep(5000);
- GamePhase = "error";
- MatchEndRequested = True;
- } else {
- if(Players.count == 0){
- sleep(1000);
- declare Msg = TextLib::Compose(_("No Players"));
- Message::SendBigMessage(Msg, 1000, 3, CUIConfig::EUISound::Silence, 0);
- } else if (Players.count > 10){
- sleep(1000);
- declare Msg = TextLib::Compose(_("Too much players. Max players script-forced to 10."));
- Message::SendBigMessage(Msg, 1000, 3, CUIConfig::EUISound::Silence, 0);
- } else {
- GamePhase = "newRound";
- }
- }
- }
- Void TimerSound(){
- if((EndTime - Now) == 30000){
- PlaySound("30sec", -1);
- }
- if((EndTime - Now) == 10000){
- PlaySound("cd", 10);
- }
- if((EndTime - Now) == 9000){
- PlaySound("cd", 9);
- }
- if((EndTime - Now) == 8000){
- PlaySound("cd", 8);
- }
- if((EndTime - Now) == 7000){
- PlaySound("cd", 7);
- }
- if((EndTime - Now) == 6000){
- PlaySound("cd", 6);
- }
- if((EndTime - Now) == 5000){
- PlaySound("cd", 5);
- }
- if((EndTime - Now) == 4000){
- PlaySound("cd", 4);
- }
- if((EndTime - Now) == 3000){
- PlaySound("cd", 3);
- }
- if((EndTime - Now) == 2000){
- PlaySound("cd", 2);
- }
- if((EndTime - Now) == 1000){
- PlaySound("cd", 1);
- }
- }
- Void ShowLayerTeam(Boolean show) {
- if(show){
- if(Now > _LatestUITickLayerTeam + UITickPeriod){
- _LatestUITickLayerTeam = Now;
- _LayerTeam.ManialinkPage = """
- <frame posn="-159 88 0">
- <label posn="0 0 0" halign="left" style="TextButtonBig" text="{{{_("$s$i$o$af0Players alive")}}} : {{{ ClansNbPlayersAlive[1]}}}" />
- </frame>
- """;
- declare Integer[Integer] NumberOfLines = [1=>0];
- declare Text[Integer] TextOfPlayers = [1=>""];
- foreach (Player in Players) {
- if(Player.CurrentClan == 1){
- if(NumberOfLines[Player.CurrentClan] < 20 && _PlayerManialinkLines.existskey(Player.Id)) {
- TextOfPlayers[Player.CurrentClan] ^= _PlayerManialinkLines[Player.Id];
- NumberOfLines[Player.CurrentClan] += 1;
- }
- }
- }
- _LayerTeam.ManialinkPage ^= """<playerlist posn="-160 84" halign="left" style="" substyle="Small" lines="20" columns="1" static="true">{{{TextOfPlayers[1]}}}</playerlist>""";
- }
- } else {
- if(_LayerTeam.ManialinkPage != ""){
- _LayerTeam.ManialinkPage = "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement