class BotGroupMission_BEREZINO_AI2: MissionBase { void BotGroupMission_BEREZINO_AI2() { StartMissionAI(); } AIWorld world = GetGame().GetWorld().GetAIWorld(); // Bot configs vector BotSpawnPoint = "12800.9 5.96536 10167"; // set the spawn point of the bot int m_botAcuracy = Math.RandomInt(5,25); // Setting the bot's accuracy (the higher the number, the more often the bot misses) int BotSolderCountMin = 1; // assign the minimum number of bots int BotSolderCountMax = Math.RandomInt(1,5); // assign the maximum number of bots int botLootCountMin = Math.RandomInt(1,5); // set the minimum amount of loot for the bot int botLootCountMax = Math.RandomInt(6,15); // assign the maximum amount of loot for the bot float Zone_Radius = 1100; // Trigger radius for the player to spawn bots bool isUseCheckPoints = true; // set whether checkpoints are used true - used, fslse - not used bool isBotKaratist = false; // We set whether bots will carry weapons or will be fought with fists, by default they are with weapons, if needed without a firearm, write true int rndBotKaratist = Math.RandomInt(0,100); bool onRespawnBot = true; // Enable or disable bot respawn (true - enabled, fslse - disabled) bool canUseTrigger = true; // Use trigger (true - enabled, fslse - disabled), if the trigger is not used, bots will spawn immediately after starting the server bool useKilFeed = true; // Enabling or disabling alerts when killing a bot bool m_Frendly = true; // Friendliness :) enable or disable. If enabled, then bots will not attack you until you attack it, if you attack a bot, you will become an enemy for all bots. int rndFriendly = Math.RandomInt(0,100); bool onVoice = true; // Enable or disable bot voice (enabling this setting causes more server load) int m_spawnBotRadius = 400; // The radius of the spawn of bots in the territory, the center of the territory is the coordinate specified in BotSpawnPoint int m_SpeedPatrol = 2; // Setting the movement speed while patrolling (min = 1 max = 3) int rndTargetDist = Math.RandomInt( 100, 200 ); int m_TargetDist = Math.RandomInt(100,200); // We set the distance in meters at which the bot sees the target. bool canBotSpawned = true; // Do not change !!!!!!! int rndHlt; // ------------------------------- end of config ------------------------------------------ // // Arrays with loot and clothes // If some type is not needed, just leave empty quotes example ---> TStringArray OtherEquip = {""}; ref TStringArray Shirt = {"","BomberJacket_Black","BomberJacket_Blue","BomberJacket_Brown","BomberJacket_Grey","BomberJacket_Maroon","BomberJacket_Olive","BomberJacket_SkyBlue","ChernarusSportShirt", "FirefighterJacket_Beige","FirefighterJacket_Black","GorkaEJacket_Flat","GorkaEJacket_PautRev","GorkaEJacket_Summer","HikingJacket_Black","HikingJacket_Blue","HikingJacket_Green", "HikingJacket_Red","HuntingJacket_Autumn","HuntingJacket_Brown","HuntingJacket_Spring","HuntingJacket_Summer","HuntingJacket_Winter","JumpsuitJacket_Blue","JumpsuitJacket_Gray", "JumpsuitJacket_Green","JumpsuitJacket_Red","LabCoat","LeatherJacket_Beige","LeatherJacket_Black","LeatherJacket_Brown","LeatherJacket_Natural","","","","","MedicalScrubsShirt_Blue", "MedicalScrubsShirt_Green","MedicalScrubsShirt_White","ParamedicJacket_Blue","ParamedicJacket_Crimson","ParamedicJacket_Green","PoliceJacket","PoliceJacketOrel","PrisonUniformJacket", "QuiltedJacket_Black","QuiltedJacket_Blue","QuiltedJacket_Green","QuiltedJacket_Grey","QuiltedJacket_Orange","QuiltedJacket_Red","QuiltedJacket_Violet","QuiltedJacket_Yellow", "Raincoat_Black","Raincoat_Blue","Raincoat_Green","Raincoat_Orange","Raincoat_Pink","Raincoat_Red","Raincoat_Yellow","RidersJacket_Black","Shirt_BlueCheck","Shirt_BlueCheckBright", "Shirt_GreenCheck","Shirt_PlaneBlack","Shirt_RedCheck","Shirt_WhiteCheck","Sweater_Blue","Sweater_Gray","Sweater_Green","Sweater_Red","TShirt_Beige","TShirt_Black","TShirt_Blue", "TShirt_Green","TShirt_Grey","TShirt_OrangeWhiteStripes","TShirt_Red","TShirt_RedBlackStripes","TShirt_White","","","","","TelnyashkaShirt","TrackSuitJacket_Black", "TrackSuitJacket_Blue","TrackSuitJacket_Green","TrackSuitJacket_LightBlue","TrackSuitJacket_Red","TrackSuitPants_Black","TrackSuitPants_Blue","TrackSuitPants_Green", "TrackSuitPants_LightBlue","TrackSuitPants_Red","WomanSuit_Beige","WomanSuit_Black","WomanSuit_Blue","WomanSuit_Brown","WomanSuit_DarkGrey","WomanSuit_Khaki", "WomanSuit_LightGrey","WomanSuit_White","WoolCoat_Beige","WoolCoat_Black","WoolCoat_BlackCheck","WoolCoat_Blue","WoolCoat_BlueCheck","WoolCoat_BrownCheck","WoolCoat_Green", "WoolCoat_GreyCheck","WoolCoat_Red","WoolCoat_RedCheck","MiniDress_BlueChecker","MiniDress_BlueWithDots","MiniDress_BrownChecker","MiniDress_GreenChecker","MiniDress_Pink", "MiniDress_PinkChecker","MiniDress_RedChecker","MiniDress_WhiteChecker","NurseDress_Blue","NurseDress_White"}; //Add the top of the clothes ref TStringArray Jeans = {"","Breeches_Beetcheck","Breeches_Beige","Breeches_Black","Breeches_Blackcheck","Breeches_Blue","Breeches_Browncheck","Breeches_Green","Breeches_Pink", "Breeches_Red","Breeches_White","CanvasPantsMidi_Beige","CanvasPantsMidi_Blue","CanvasPantsMidi_Grey","CanvasPantsMidi_Red","CanvasPantsMidi_Violet","CanvasPants_Beige", "CanvasPants_Blue","CanvasPants_Grey","CanvasPants_Red","CanvasPants_Violet","CargoPants_Beige","CargoPants_Black","CargoPants_Blue","CargoPants_Green","CargoPants_Grey", "FirefightersPants_Beige","FirefightersPants_Black","","","","","HunterPants_Autumn","HunterPants_Brown","HunterPants_Spring","HunterPants_Summer","HunterPants_Winter", "Jeans_Black","Jeans_Blue","Jeans_BlueDark","Jeans_Brown","Jeans_Green","Jeans_Grey","LeatherPants_Beige","LeatherPants_Black","LeatherPants_Brown","LeatherPants_Natural", "MedicalScrubsPants_Blue","MedicalScrubsPants_Green","MedicalScrubsPants_White","PolicePants","PolicePantsOrel","SlacksPants_Beige","SlacksPants_Black","SlacksPants_Blue", "SlacksPants_Brown","SlacksPants_DarkGrey","SlacksPants_Khaki","SlacksPants_LightGrey","SlacksPants_White","TrackSuitPants_Black","TrackSuitPants_Blue", "TrackSuitPants_Green","TrackSuitPants_LightBlue","TrackSuitPants_Red","",""}; //Add pants ref TStringArray Shoes = {"AthleticShoes_Black","AthleticShoes_Blue","AthleticShoes_Brown","AthleticShoes_Green","AthleticShoes_Grey","","","","","","DressShoes_Beige","DressShoes_Black","DressShoes_Brown", "DressShoes_Sunburst","DressShoes_White","HikingBootsLow_Beige","HikingBootsLow_Black","HikingBootsLow_Blue","HikingBootsLow_Grey","HikingBoots_Black","HikingBoots_Brown", "JoggingShoes_Black","JoggingShoes_Blue","JoggingShoes_Red","JoggingShoes_Violet","JoggingShoes_White","","","","","","","","","","","","","","","","","Sneakers_Black", "Sneakers_Gray","Sneakers_Green","Sneakers_Red","Sneakers_White","","Wellies_Black","Wellies_Brown","Wellies_Green","Wellies_Grey","WorkingBoots_Beige","WorkingBoots_Brown", "WorkingBoots_Green","WorkingBoots_Grey","WorkingBoots_Yellow"}; //Add boots ref TStringArray BackPack = {"","","","","","","","","","ImprovisedBag","","","","","","","","","TaloonBag_Blue","TaloonBag_Green","TaloonBag_Orange","TaloonBag_Violet","","ChildBag_Blue", "ChildBag_Green","ChildBag_Red","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", "","","","","","","","","","","","","","","","",""}; //Add the Backpack ref TStringArray Vest = {"","","","","","","PressVest_Blue","PressVest_LightBlue","ReflexVest","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", "","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //Add Vest ref TStringArray Helm = {"Balaclava3Holes_Beige","Balaclava3Holes_Black","Balaclava3Holes_Blue","Balaclava3Holes_Green","BalaclavaMask_Beige","BalaclavaMask_Black","BalaclavaMask_Blackskull", "BalaclavaMask_Blue","BalaclavaMask_Green","BalaclavaMask_Pink","BalaclavaMask_White","","","","Bandana_Blackpattern", "Bandana_Camopattern","Bandana_Greenpattern","Bandana_Polkapattern","Bandana_Redpattern","BaseballCap_Beige","BaseballCap_Black","BaseballCap_Blue","BaseballCap_CMMG_Black", "BaseballCap_CMMG_Pink","BaseballCap_Camo","BaseballCap_Olive","BaseballCap_Pink","BaseballCap_Red","BeanieHat_Beige","BeanieHat_Black","BeanieHat_Blue","BeanieHat_Brown", "BeanieHat_Green","BeanieHat_Grey","BeanieHat_Pink","BeanieHat_Red","BoonieHat_Black","BoonieHat_Blue","BoonieHat_DPM","BoonieHat_Dubok","BoonieHat_Flecktran","BoonieHat_NavyBlue", "BoonieHat_Olive","BoonieHat_Orange","BoonieHat_Red","BoonieHat_Tan","ConstructionHelmet_Blue","ConstructionHelmet_Lime","ConstructionHelmet_Orange","ConstructionHelmet_Red", "ConstructionHelmet_White","ConstructionHelmet_Yellow","CowboyHat_Brown","CowboyHat_black","CowboyHat_darkBrown","CowboyHat_green","","","","","","","","","","","","","","","","", "FlatCap_Black","FlatCap_BlackCheck","FlatCap_Blue","FlatCap_Brown","FlatCap_BrownCheck","FlatCap_Grey","FlatCap_GreyCheck","FlatCap_Red","","","","","","","","","","","", "NioshFaceMask","OfficerHat","PilotkaCap","PoliceCap","PrisonerCap","RadarCap_Black","RadarCap_Blue","RadarCap_Brown","RadarCap_Green","RadarCap_Red","SkateHelmet_Black", "SkateHelmet_Blue","SkateHelmet_Gray","SkateHelmet_Green","SkateHelmet_Red","","Ushanka_Black","Ushanka_Blue","Ushanka_Green","WeldingMask","","ZmijovkaCap_Black", "ZmijovkaCap_Blue","ZmijovkaCap_Brown","ZmijovkaCap_Green","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", "","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", "","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //Add a helmet or headgear ref TStringArray Gloves = {"","","","","","", "WorkingGloves_Beige","WorkingGloves_Black","WorkingGloves_Brown","WorkingGloves_Yellow","SurgicalGloves_Blue","SurgicalGloves_Green","SurgicalGloves_LightBlue", "SurgicalGloves_White","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //Add gloves ref TStringArray OtherEquip = {"CivilianBelt","","","","","","","","","","","","","","","","",""}; //Add an additional item of clothing, it can be anything :) ref TStringArray RandomLoot = {"Apple","AgaricusMushroom","AuriculariaMushroom","BakedBeansCan","Bitterlings","BoxCerealCrunchin","BrisketSpread","Canteen", "CatFoodCan","Chips","Crackers","DogFoodCan","GreenBellPepper","Lunchmeat","Pajka","Pate","PeachesCan","Pear","Plum","Potato", "PowderedMilk","Pumpkin","Rice","SaltySticks","SardinesCan","SlicedPumpkin","SodaCan_Cola","SodaCan_Fronta","SodaCan_Kvass", "SodaCan_Pipsi","SodaCan_Spite","SpaghettiCan","TacticalBaconCan","Tomato","TunaCan","UnknownFoodCan","Zagorky","ZagorkyChocolate", "ZagorkyPeanuts","Zucchini","BandageDressing","BarbedWire","Battery9V","BloodBagEmpty","BloodBagIV","BloodTestKit","BurlapSack", "CanOpener","CharcoalTablets","Chemlight_Blue","Chemlight_Green","Chemlight_Red","Chemlight_White","Chemlight_Yellow","ChernarusMap", "Compass","Crowbar","DisinfectantAlcohol","DisinfectantSpray","DuctTape","Epinephrine","EpoxyPutty","Fabric","FishingRod", "Flashlight","GardenLime","Hacksaw","Hammer","HandSaw","HeadlightH7_Box","Headtorch_Black","Headtorch_Grey","Heatpack", "ImprovisedFishingRod","IodineTincture","LargeGasCanister","LugWrench","Matchbox","MediumGasCanister","MetalWire","Morphine", "NVGHeadstrap","NailBox","Netting","NylonKnifeSheath","OrienteeringCompass","PainkillerTablets","PersonalRadio","PetrolLighter", "PipeWrench","Pliers","PortableGasLamp","PortableGasStove","Pot","PurificationTablets","Rangefinder","Roadflare","SalineBag", "SalineBagIV","Screwdriver","SewingKit","SmallGasCanister","SparkPlug","StartKitIV","","TetracyclineAntibiotics","Thermometer", "VitaminBottle","WaterBottle","Whetstone","Wrench","XmasLights","AmmoBox_00buck_10rnd","AmmoBox_12gaRubberSlug_10Rnd","AmmoBox_12gaSlug_10Rnd", "AmmoBox_22_50Rnd","AmmoBox_308WinTracer_20Rnd","AmmoBox_308Win_20Rnd","AmmoBox_357_20Rnd","AmmoBox_380_35rnd","AmmoBox_45ACP_25rnd", "AmmoBox_545x39Tracer_20Rnd","AmmoBox_545x39_20Rnd","AmmoBox_556x45Tracer_20Rnd","AmmoBox_556x45_20Rnd","AmmoBox_762x39Tracer_20Rnd", "AmmoBox_762x39_20Rnd","AmmoBox_762x54Tracer_20Rnd","AmmoBox_762x54_20Rnd","AmmoBox_9x19_25rnd","AmmoBox_9x39AP_20Rnd","AmmoBox_9x39_20Rnd", "","","","","","UniversalLight","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", "","","","","","","","","","","","","","","","","","","","","","","",""}; //We add any loot to the array, the amount is not limited ref TStringArray MeleeWeap = {"WoodAxe", "FirefighterAxe", "Shovel", "Pickaxe"}; //Add melee weapons // -------------------------------- end -------------------------------------------------------// EntityAI itemEnt; // Do not change !!!! // Function for creating checkpoints (register checkpoints here) void AddCeckPoint(SurvivorBotBase m_BotSolder) { m_BotSolder.SetUseCheckpoint(); // Do not touch this line! /* m_BotSolder.AddCheckpoint("13429.400391 5.890710 6028.540039"); m_BotSolder.AddCheckpoint("13380.400391 6.140470 6040.580078"); m_BotSolder.AddCheckpoint("13376.799805 6.140510 6130.660156"); m_BotSolder.AddCheckpoint("13404.700195 6.083950 6218.189941"); m_BotSolder.AddCheckpoint("13412.400391 5.780290 6245.870117"); m_BotSolder.AddCheckpoint("13425.799805 5.979890 6270.229980"); m_BotSolder.AddCheckpoint("13427.099609 6.382700 6348.950195"); m_BotSolder.AddCheckpoint("13464.400391 6.096580 6368.109863"); */ } // ---------------------------------- end -------------------------------------- / ref array m_BotMass = new array; ref array m_PlaersZoneArray = new array; // The function of creating weapons for the bot (here you can add 7 weapon wmds, enter at your discretion) void createWeapFromBot(SurvivorBotBase m_BotSolder) { int randomWeapon = Math.RandomInt(1, 7); switch( randomWeapon ) { case 1: { m_BotSolder.AddWeapon("Deagle"); //Gun m_BotSolder.AddMagazine("Mag_Deagle_9rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } case 2: { m_BotSolder.AddWeapon("Colt1911"); //Gun m_BotSolder.AddMagazine("Mag_1911_7Rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } case 3: { m_BotSolder.AddWeapon("MKII"); //Gun m_BotSolder.AddMagazine("Mag_MKII_10Rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } case 4: { m_BotSolder.AddWeapon("Glock19"); //Gun m_BotSolder.AddMagazine("Mag_Glock_15Rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } case 5: { m_BotSolder.AddWeapon("CZ61"); //Gun m_BotSolder.AddMagazine("Mag_CZ61_20Rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } case 6: { m_BotSolder.AddWeapon("CZ527"); //Gun m_BotSolder.AddMagazine("Mag_CZ527_5rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } case 7: { m_BotSolder.AddWeapon("Ruger1022"); //Gun m_BotSolder.AddMagazine("Mag_Ruger1022_15Rnd"); //Mag break; //We add body kits as needed, magazines for weapons are issued automatically, no need to add them } } } // ----------------------------- end ------------------------------------- // // Bot spawn function (we don't change anything here !!!) void createBotUnit() { vector Navmesh; vector botSpPos; private SurvivorBotBase m_BotSolder; ref TStringArray m_BotBody = { "BotM_Mirek", "BotM_Rolf", "BotM_Quinn", "BotM_Peter", "BotM_Oliver" }; PGFilter m_pgFilterNav = new PGFilter(); m_pgFilterNav.SetFlags(PGPolyFlags.WALK, PGPolyFlags.INSIDE, 0); float bspX = BotSpawnPoint[0]; float bspY = BotSpawnPoint[2]; if (isUseCheckPoints) botSpPos = Vector(bspX + Math.RandomInt(-7, 7), BotSpawnPoint[1], bspY + Math.RandomInt(-7, 7)); else botSpPos = Vector(bspX + Math.RandomInt(-m_spawnBotRadius, m_spawnBotRadius), BotSpawnPoint[1], bspY + Math.RandomInt(-m_spawnBotRadius, m_spawnBotRadius)); bool IsNavmesh = world.SampleNavmeshPosition( botSpPos, 2, m_pgFilterNav, Navmesh ); if (IsNavmesh) m_BotSolder = SurvivorBotBase.Cast(GetGame().CreatePlayer(null, m_BotBody.GetRandomElement(), Navmesh, 0, "NONE")); else m_BotSolder = SurvivorBotBase.Cast(GetGame().CreatePlayer(null, m_BotBody.GetRandomElement(), botSpPos, 0, "NONE")); itemEnt = m_BotSolder.GetInventory().CreateInInventory(Shirt.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(Jeans.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(Shoes.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(BackPack.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(Vest.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(Helm.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(Gloves.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } itemEnt = m_BotSolder.GetInventory().CreateInInventory(OtherEquip.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } //Determine of Bots have guns... if (rndBotKaratist > 10){ isBotKaratist = false; Print("ZZZ: Guns?=FALSE " + rndBotKaratist); }else{ isBotKaratist = true; Print("ZZZ: Guns?=TRUE " + rndBotKaratist); } if (isBotKaratist) m_BotSolder.GetHumanInventory().CreateInHands(MeleeWeap.GetRandomElement()); else createWeapFromBot(m_BotSolder); int rndLootCnt = Math.RandomInt(botLootCountMin, botLootCountMax); for (int i = 0; i < rndLootCnt; i++) { itemEnt = m_BotSolder.GetInventory().CreateInInventory(RandomLoot.GetRandomElement()); if (itemEnt) { rndHlt = Math.RandomInt(55,90); itemEnt.SetHealth("","",rndHlt); } } //Determine of bots are friendly... if (rndFriendly < 30){ m_Frendly = false; Print("ZZZ: Friendly=FALSE " + rndFriendly); }else{ m_Frendly = true; Print("ZZZ: Friendly=TRUE " + rndFriendly); } m_BotSolder.SetAcuracy(m_botAcuracy); m_BotSolder.SetDistance(m_TargetDist); m_BotSolder.SetUseVoice(onVoice); m_BotSolder.SetUseKillFeed(useKilFeed); m_BotSolder.SetFrendly(m_Frendly); m_BotSolder.SetSpeedPatrol(m_SpeedPatrol); if (isUseCheckPoints) AddCeckPoint(m_BotSolder); m_BotMass.Insert(m_BotSolder); } // ----------------------------- end ------------------------------------- // // ----------------------------- Bots respawn function ----------------------------------------// private void respawnBotUnitC1() { ref array players = new array; GetGame().GetPlayers( players ); SurvivorBotBase Bot_Ar; vector posB; bool m_botRemoved = false; float distB; int m_countBot = m_BotMass.Count(); int plaersZoneCount = -1; m_PlaersZoneArray.Clear(); if (canBotSpawned) { for ( int u = 0; u < players.Count(); u++ ) { PlayerBase player; Class.CastTo(player, players.Get(u)); vector pos = player.GetPosition(); float dist = vector.Distance( pos, BotSpawnPoint ); if ( dist < Zone_Radius && player.IsAlive() ) { m_PlaersZoneArray.Insert(player); // return; } } Print("Players count in zone bots C1 = " + m_PlaersZoneArray.Count()); if (m_PlaersZoneArray.Count() == 0) { for ( int a = 0; a < m_countBot; a++ ) { Bot_Ar = m_BotMass.Get(a); if (Bot_Ar) { if (!Bot_Ar.IsAlive()) { posB = Bot_Ar.GetPosition(); distB = vector.Distance( posB, BotSpawnPoint ); if (distB < Zone_Radius) { m_BotMass.Remove( a ); } if (m_BotMass.Count() == 0) m_botRemoved = true; } else { if (distB < Zone_Radius) { m_BotMass.Remove( a ); GetGame().ObjectDelete( Bot_Ar ); } if (m_BotMass.Count() == 0) m_botRemoved = true; } } } if (m_botRemoved && m_PlaersZoneArray.Count() == 0) { StartMissionAI(); GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(respawnBotUnitC1); m_botRemoved = false; } } } } // ----------------------------- end ----------------------------------------// // Spawn function of a group of bots int delaySpawn = 0; void spawnBotGroup() { int rndBotGrpCnt = Math.RandomInt(BotSolderCountMin, BotSolderCountMax); Print("Bots spawned! Count " + rndBotGrpCnt); for (int a = 0; a < rndBotGrpCnt; a++) { GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(createBotUnit, 500 + delaySpawn); delaySpawn +=1000; } } // --------------------------------------- end --------------------------------------- // // Player trigger function void TriggerPlayersC1() { ref array players = new array; GetGame().GetPlayers( players ); delaySpawn = 0; if (canBotSpawned && IsGoodSrvFps()) { for ( int u = 0; u < players.Count(); u++ ) { PlayerBase player; Class.CastTo(player, players.Get(u)); vector pos = player.GetPosition(); float dist = vector.Distance( pos, BotSpawnPoint ); if ( dist < Zone_Radius && !player.IsBot() ) { spawnBotGroup(); GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(TriggerPlayersC1); if (onRespawnBot) GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(respawnBotUnitC1, 60000, true); } } } } // --------------------------------------- end --------------------------------------- // void StartMissionAI() { Print("Start mission bot"); if (canUseTrigger) { GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(TriggerPlayersC1, 5000, true); } else if (IsGoodSrvFps()) { spawnBotGroup(); } } bool IsGoodSrvFps() { float TestFpsSrv = GetGame().GetFps(); if (TestFpsSrv < 2) { return true; } else { Print("Server FPS low! FPS = " + TestFpsSrv + " Bots not respawned!"); return false; } } }