Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BotGroupMissionC1: MissionServer
- {
- //Spawns for Aisching!!
- void BotGroupMissionC1() { StartMissionAI(); }
- AIWorld world = GetGame().GetWorld().GetAIWorld();
- // Bot configs
- vector BotSpawnPoint = "8172.23 9.7125 7212.66"; // çàäàåì òî÷êó ñïàâíà áîòà
- protected int m_botAcuracy = 30; // Setting the bot's accuracy (the higher the number, the more often the bot misses)
- protected int BotSolderCountMin = 1; // assign the minimum number of bots
- protected int BotSolderCountMax = 10; // assign the maximum number of bots
- protected int botLootCountMin = 5; // set the minimum amount of loot for the bot
- protected int botLootCountMax = 10; // assign the maximum amount of loot for the bot
- protected float Zone_Radius = 900; // Trigger radius for the player to spawn bots
- protected bool isUseCheckPoints = true; // set whether checkpoints are used true - used, fslse - not used
- protected 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
- protected bool onRespawnBot = true; // Enable or disable bot respawn (true - enabled, fslse - disabled)
- protected bool canUseTrigger = true; // Use trigger (true - enabled, fslse - disabled), if the trigger is not used, bots will spawn immediately after starting the server
- protected bool useKilFeed = true; // Enabling or disabling alerts when killing a bot
- protected bool m_Frendly = false; // 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.
- protected bool onVoice = false; // Enable or disable bot voice (enabling this setting causes more server load)
- protected int m_spawnBotRadius = 100; // The radius of the spawn of bots in the territory, the center of the territory is the coordinate specified in BotSpawnPoint
- protected int m_SpeedPatrol = 3; // Setting the movement speed while patrolling (min = 1 max = 3)
- protected int m_TargetDist = 800; // We set the distance in meters at which the bot sees the target.
- protected bool canBotSpawned = true; // Do not change !!!!!!!
- // ------------------------------- end of config ------------------------------------------ //
- // Arrays with loot and clothes
- // If some type is not needed, just leave empty quotes example ---> TStringArray OtherEquip = {""};
- ref TStringArray Shirt = {"Military_Sweater", "Military_Sweater_Red", "Military_Sweater_Blue", "Military_Sweater_Green", "Military_Sweater_Black", "Military_Sweater_White", "Layered_Shirt_Base", "Layered_Shirt_White", "Layered_Shirt_Cheburashka", "Layered_Shirt_Courage", "Layered_Shirt_Lily", "Winter_Parka_Base", "Winter_Parka_White", "Winter_Parka_Green", "Medium_Sleeves_Shirt", "Medium_Sleeves_Shirt_Red", "Medium_Sleeves_Shirt_Blue", "GorkaEJacket_Autumn", "GorkaEJacket_Flat", "GorkaEJacket_PautRev", "GorkaEJacket_Summer", "WoolCoat_Beige", "WoolCoat_Black", "WoolCoat_BlackCheck", "WoolCoat_Blue", "WoolCoat_BlueCheck", "WoolCoat_BrownCheck", "WoolCoat_Green", "WoolCoat_GreyCheck", "WoolCoat_Red", "WoolCoat_RedCheck", "TrackSuitJacket_Black", "TrackSuitJacket_Blue", "TrackSuitJacket_Green", "TrackSuitJacket_LightBlue", "TrackSuitJacket_Red", "BDUJacket", "Raincoat_Orange", "Raincoat_Black", "Raincoat_Blue", "Raincoat_Green", "Raincoat_Pink", "Raincoat_Red", "Raincoat_Yellow", "LeatherShirt_Natural", "MedicalScrubsShirt_Blue", "MedicalScrubsShirt_Green", "MedicalScrubsShirt_White", "Shirt_BlueCheck", "Shirt_BlueCheckBright", "Shirt_GreenCheck", "Shirt_PlaneBlack", "Shirt_RedCheck", "Shirt_WhiteCheck", "TShirt_Beige", "TShirt_Black", "TShirt_Blue", "TShirt_Green", "TShirt_Grey", "TShirt_OrangeWhiteStripes", "TShirt_Red", "TShirt_RedBlackStripes", "TShirt_White", "TacticalShirt_Black", "TacticalShirt_Grey", "TacticalShirt_Olive", "TacticalShirt_Tan"};
- ref TStringArray Jeans = {"jeans_bluedark", "jeans_blue", "jeans_brown", "jeans_green", "jeans_grey", "cargopants_beige", "cargopants_black", "cargopants_blue", "cargopants_green", "cargopants_grey", "hunterpants_autumn", "hunterpants_brown", "hunterpants_spring", "hunterpants_summer", "hunterpants_winter", "canvaspants_beige", "canvaspants_blue", "canvaspants_grey", "canvaspants_red", "canvaspants_violet", "Blue_Leggings", "Msp_BoxingShorts_Blue", "Latex_Leggings", "Adidas_Leggings", "Red_Leggings", "Purple_Leggings", "Latex_White_Leggings", "Kneepads_Jeans_Base", "Kneepads_Jeans_Black", "GorkaPants_Autumn", "GorkaPants_PautRev", "GorkaPants_Summer", "TrackSuitPants_Blue", "TrackSuitPants_Black", "TrackSuitPants_Green", "TrackSuitPants_LightBlue", "TrackSuitPants_Red", "BDUPants"};
- ref TStringArray Shoes = {"AthleticShoes_Blue", "AthleticShoes_Grey", "AthleticShoes_Brown", "AthleticShoes_Green", "AthleticShoes_Black", "High_Knee_Sneakers", "High_Knee_Sneakers_Black", "FlipFlops_Colorbase", "TTSKOBoots", "WorkingBoots_Beige", "CombatBoots_Beige", "CombatBoots_Black", "CombatBoots_Brown", "Sneakers_Black", "Sneakers_Gray", "Sneakers_Green", "Sneakers_Red", "Sneakers_White"}; //Add boots ref TStringArray BackPack = {"CoyoteBag_Brown", "CoyoteBag_Green", "HuntingBag", "TortillaBag", "WaterproofBag_Green"}; //Add the Backpack
- ref TStringArray BackPack = {"CoyoteBag_Brown", "CoyoteBag_Green", "HuntingBag", "TortillaBag", "DryBag_Black", "DryBag_Blue", "DryBag_Green", "AliceBag_Black", "AssaultBag_Black", "AssaultBag_Green", "ChildBag_Blue", "ChildBag_Green", "ChildBag_Red", "CourierBag", "DryBag_Orange", "DryBag_Red", "DryBag_Yellow", "FurCourierBag", "FurImprovisedBag", "MountainBag_Blue", "MountainBag_Green", "MountainBag_Orange", "MountainBag_Red", "TaloonBag_Blue", "TaloonBag_Green", "TaloonBag_Orange", "TaloonBag_Violet"}; //Add the Backpack
- ref TStringArray Vest = {"HighCapacityVest_Black", "HighCapacityVest_Olive", "HuntingVest", "PlateCarrierVest", "UKAssVest_Camo"}; //Add Vest
- ref TStringArray Helm = {"Poncho_Red_Checkered", "Poncho_Blue_Checkered", "Poncho_Yellow_Checkered", "Poncho_Brown", "Poncho_Green", "Poncho_White", "Poncho_Red", "Poncho_Black", "Poncho_BlackAndWhite", "Poncho_BlackAndWhite2", "Slouch_Hat_Brown", "baseballcap_blue", "baseballcap_beige", "baseballcap_black", "baseballcap_olive", "baseballcap_pink", "baseballcap_red", "baseballcap_camo", "baseballcap_cmmg_black", "baseballcap_cmmg_pink", "pilothelmet_zsh3", "BeanieHat_Beige", "BeanieHat_Black", "BeanieHat_Blue", "BeanieHat_Brown", "BeanieHat_Green", "BeanieHat_Grey", "BeanieHat_Pink", "BeanieHat_Red", "Ushanka_Black", "Ushanka_Blue", "Ushanka_Green", "DarkMotoHelmet_Black", "DarkMotoHelmet_Blue", "DarkMotoHelmet_Green", "DarkMotoHelmet_Red", "DarkMotoHelmet_White", "headtorch_grey", "headtorch_black", "Bandana_Blackpattern", "RadarCap_Black", "RadarCap_Brown", "RadarCap_Green", "RadarCap_Red", "radarcap_black", "radarcap_blue", "radarcap_brown", "radarcap_green", "radarcap_red", "zmijovkacap_black", "zmijovkacap_blue", "zmijovkacap_brown", "zmijovkacap_green", "zmijovkacap_red", "MilitaryBeret_CDF", "MilitaryBeret_ChDKZ", "MilitaryBeret_Red", "MilitaryBeret_UN", "MilitaryBeret_NZ", "constructionhelmet_blue", "constructionhelmet_green2", "constructionhelmet_orange", "constructionhelmet_red", "constructionhelmet_white", "constructionhelmet_yellow", "DarkMotoHelmet_Lime", "cowboyhat_brown", "cowboyhat_black", "cowboyhat_darkbrown", "cowboyhat_green", "ballistichelmet_green", "ballistichelmet_black", "ballistichelmet_un", "flatcap_black", "flatcap_blue", "flatcap_red", "flatcap_brown", "flatcap_grey", "flatcap_check_brown", "flatcap_check_grey", "flatcap_check_black", "booniehat_black", "booniehat_blue", "booniehat_dpm", "booniehat_dubok", "booniehat_flecktran", "booniehat_navyblue", "booniehat_olive", "booniehat_orange", "booniehat_red", "booniehat_tan", "constructionhelmet_lime", "motohelmet_grey", "officerhat", "policecap", "pilotkacap", "Mich2001Helmet", "PumpkinHelmet", "SkateHelmet_Black", "GorkaHelmet", "BallisticHelmet_Black"}; //Add a helmet or headgear ref TStringArray Gloves = {"WorkingGloves_Beige", "WorkingGloves_Black", "NBCGlovesGray", "OMNOGloves_Brown", "SurgicalGloves_Blue"}; //Add gloves
- ref TStringArray Gloves = {"WorkingGloves_Beige", "WorkingGloves_Black", "NBCGlovesGray", "OMNOGloves_Brown", "SurgicalGloves_Blue", "LeatherGloves_Beige", "LeatherGloves_Black", "NBCGlovesGray", "SurgicalGloves_Green", "SurgicalGloves_LightBlue", "SurgicalGloves_White", "Fingerless_Gloves", "Fingerless_Gloves_Brown", "Fingerless_Gloves_Wool", "Fingerless_Gloves_Wool_Grey"}; //Add gloves
- ref TStringArray OtherEquip = {"CivilianBelt", "MilitaryBelt", "GasMask", "Balaclava3Holes_Beige", "Balaclava3Holes_Black", "Balaclava3Holes_Blue", "Balaclava3Holes_Green", "BalaclavaMask_Beige", "BalaclavaMask_Black", "BalaclavaMask_Blackskull", "BalaclavaMask_Blue", "BalaclavaMask_Green", "BalaclavaMask_Pink", "BalaclavaMask_White", "SurgicalMask", "DallasMask", "GP5GasMask", "HockeyMask", "HoxtonMask", "NioshFaceMask", "WeldingMask", "WolfMask", "PMK_5A_Gas_Mask", "SkullMask", "AirborneMask", "BandanaMask_BlackPattern", "BandanaMask_CamoPattern", "BandanaMask_GreenPattern", "BandanaMask_PolkaPattern"}; //Add an additional item of clothing, it can be anything :)
- ref TStringArray RandomLoot = {"SardinesCan", "SodaCan_Cola", "SodaCan_Kvass", "Rice", "Rope", "Screwdriver", "AmmoBox_545x39_20Rnd", "AmmoBox_00buck_10rnd", "AmmoBox_12gaSlug_10Rnd", "AmmoBox_22_50Rnd", "AmmoBox_308Win_20Rnd", "AmmoBox_357_20Rnd", "AmmoBox_380_35rnd","AmmoBox_45ACP_25rnd", "AmmoBox_556x45_20Rnd", "AmmoBox_762x39_20Rnd", "AmmoBox_762x54_20Rnd", "AmmoBox_9x19_25rnd"}; //We add any loot to the array, the amount is not limited
- ref TStringArray MeleeWeap = {"WoodAxe", "FirefighterAxe", "Shovel", "Pickaxe"}; //Add melee weapons
- // -------------------------------- end -------------------------------------------------------//
- protected 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("8266.25 9.72369 7280.59");
- m_BotSolder.AddCheckpoint("8362.73 9.71786 7329.12");
- m_BotSolder.AddCheckpoint("8379.96 10.2438 7224.36");
- m_BotSolder.AddCheckpoint("8343.43 18.1293 6975.42");
- m_BotSolder.AddCheckpoint("8520 46.5298 7023.95");
- m_BotSolder.AddCheckpoint("8212.65 9.71247 7219.08");
- }
- // ---------------------------------- end -------------------------------------- /
- ref array<SurvivorBotBase> m_BotMass = new array<SurvivorBotBase>;
- // 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, 4);
- switch( randomWeapon )
- {
- case 1:
- {
- m_BotSolder.AddWeapon("M4A1"); //Weapon
- m_BotSolder.AddWeaponAtt("M4_RISHndgrd"); //Att 1
- m_BotSolder.AddWeaponAtt("M4_MPBttstck"); //Att 2
- m_BotSolder.AddWeaponAtt("ACOGOptic"); //Att 3
- // m_BotSolder.AddMagazine("Mag_STANAG_30Rnd"); //Mag
- break;
- //We add body kits as needed, magazines for weapons are issued automatically, no need to add them
- }
- case 2:
- {
- m_BotSolder.AddWeapon("AKM");
- m_BotSolder.AddWeaponAtt("AK_WoodBttstck");
- m_BotSolder.AddWeaponAtt("AK_WoodHndgrd");
- // m_BotSolder.AddMagazine("Mag_AKM_Drum75Rnd");
- break;
- }
- case 3:
- {
- m_BotSolder.AddWeapon("SVD");
- // m_BotSolder.AddMagazine("Mag_SVD_10Rnd");
- break;
- }
- case 4:
- {
- m_BotSolder.AddWeapon("Rev_HK417");
- m_BotSolder.AddWeaponAtt("ReflexOptic");
- // m_BotSolder.AddMagazine("Rev_Mag_HK417_20rnd");
- break;
- }
- }
- }
- // ----------------------------- 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().CreateObject(m_BotBody.GetRandomElement(), Navmesh));
- else
- m_BotSolder = SurvivorBotBase.Cast(GetGame().CreateObject(m_BotBody.GetRandomElement(), botSpPos));
- m_BotSolder.GetInventory().CreateInInventory(Shirt.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(Jeans.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(Shoes.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(BackPack.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(Vest.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(Helm.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(Gloves.GetRandomElement());
- m_BotSolder.GetInventory().CreateInInventory(OtherEquip.GetRandomElement());
- 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)
- {
- int rndHlt = Math.RandomInt(55,100);
- itemEnt.SetHealth("","",rndHlt);
- }
- }
- 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<Man> players = new array<Man>;
- GetGame().GetPlayers( players );
- SurvivorBotBase Bot_Ar;
- vector posB;
- bool m_botRemoved = false;
- float distB;
- int m_countBot = m_BotMass.Count();
- 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 )
- return;
- if (dist > Zone_Radius)
- {
- 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;
- }
- }
- }
- if (m_botRemoved)
- {
- 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<Man> players = new array<Man>;
- 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;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement