Dayz_HardCore/BotMissions/BEREZINO_AI1.c

445 lines
24 KiB
C

class BotGroupMission_BEREZINO_AI1: MissionBase
{
void BotGroupMission_BEREZINO_AI1() { StartMissionAI(); }
AIWorld world = GetGame().GetWorld().GetAIWorld();
// Bot configs
vector BotSpawnPoint = "12433.6 8.29782 9514.96"; // set the spawn point of the bot
int m_botAcuracy = 10; // 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 = 2; // assign the maximum number of bots
int botLootCountMin = 5; // set the minimum amount of loot for the bot
int botLootCountMax = 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 = true; // 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
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,1);
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 = rndTargetDist; // We set the distance in meters at which the bot sees the target.
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 = {"BDUJacket","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","M65Jacket_Black","M65Jacket_Khaki",
"M65Jacket_Olive","M65Jacket_Tan","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","TacticalShirt_Black","TacticalShirt_Grey",
"TacticalShirt_Olive","TacticalShirt_Tan","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 = {"BDUPants","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","GorkaPants_Autumn","GorkaPants_Flat","GorkaPants_PautRev","GorkaPants_Summer","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","USMCPants_Desert","USMCPants_Woodland"}; //Add pants
ref TStringArray Shoes = {"AthleticShoes_Black","AthleticShoes_Blue","AthleticShoes_Brown","AthleticShoes_Green","AthleticShoes_Grey","CombatBoots_Beige","CombatBoots_Black",
"CombatBoots_Brown","CombatBoots_Green","CombatBoots_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","JungleBoots_Beige","JungleBoots_Black","JungleBoots_Brown","JungleBoots_Green","JungleBoots_Olive","LeatherShoes_Beige",
"LeatherShoes_Black","LeatherShoes_Brown","LeatherShoes_Natural","MilitaryBoots_Beige","MilitaryBoots_Black","MilitaryBoots_Bluerock","MilitaryBoots_Brown","MilitaryBoots_Redpunk",
"NBCBootsGray","NBCBootsYellow","Sneakers_Black","Sneakers_Gray","Sneakers_Green","Sneakers_Red","Sneakers_White","TTSKOBoots","Wellies_Black","Wellies_Brown","Wellies_Green","Wellies_Grey",
"WorkingBoots_Beige","WorkingBoots_Brown","WorkingBoots_Green","WorkingBoots_Grey","WorkingBoots_Yellow"}; //Add boots
ref TStringArray BackPack = {"AliceBag_Black","AliceBag_Camo","AliceBag_Green","AssaultBag_Black","AssaultBag_Green","AssaultBag_Ttsko","CoyoteBag_Brown",
"CoyoteBag_Green","HuntingBag","ImprovisedBag","LeatherSack_Beige","LeatherSack_Black","LeatherSack_Brown","LeatherSack_Natural",
"MountainBag_Green","MountainBag_Orange","MountainBag_Red","SmershBag","TaloonBag_Blue","TaloonBag_Green","TaloonBag_Orange",
"TaloonBag_Violet","TortillaBag","ChildBag_Blue","ChildBag_Green","ChildBag_Red","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //Add the Backpack
ref TStringArray Vest = {"HuntingVest","LeatherStorageVest_Beige","LeatherStorageVest_Black","LeatherStorageVest_Brown",
"LeatherStorageVest_Natural","PlateCarrierVest","PressVest_Blue","PressVest_LightBlue","ReflexVest",
"SmershVest","UKAssVest_Black","UKAssVest_Camo","UKAssVest_Khaki","UKAssVest_Olive","","","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //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","BallisticHelmet_Black","BallisticHelmet_Green","BallisticHelmet_UN","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","DarkMotoHelmet_Black","DarkMotoHelmet_Blue",
"DarkMotoHelmet_Green","DarkMotoHelmet_Grey","DarkMotoHelmet_Lime","DarkMotoHelmet_Red","DarkMotoHelmet_White","DirtBikeHelmet_Black","DirtBikeHelmet_Blue","DirtBikeHelmet_Chernarus",
"DirtBikeHelmet_Green","DirtBikeHelmet_Khaki","DirtBikeHelmet_Mouthguard","DirtBikeHelmet_Police","DirtBikeHelmet_Red","DirtBikeHelmet_Visor","FlatCap_Black","FlatCap_BlackCheck",
"FlatCap_Blue","FlatCap_Brown","FlatCap_BrownCheck","FlatCap_Grey","FlatCap_GreyCheck","FlatCap_Red","GP5GasMask","GasMask","GorkaHelmet","Mich2001Helmet","MotoHelmet_Black",
"MotoHelmet_Blue","MotoHelmet_Green","MotoHelmet_Grey","MotoHelmet_Lime","MotoHelmet_Red","MotoHelmet_White","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",
"TankerHelmet","Ushanka_Black","Ushanka_Blue","Ushanka_Green","WeldingMask","ZSh3PilotHelmet","ZmijovkaCap_Black","ZmijovkaCap_Blue","ZmijovkaCap_Brown","ZmijovkaCap_Green","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //Add a helmet or headgear
ref TStringArray Gloves = {"LeatherGloves_Beige","LeatherGloves_Black","LeatherGloves_Brown","LeatherGloves_Natural","OMNOGloves_Brown","OMNOGloves_Gray",
"WorkingGloves_Beige","WorkingGloves_Black","WorkingGloves_Brown","WorkingGloves_Yellow","SurgicalGloves_Blue","SurgicalGloves_Green",
"SurgicalGloves_LightBlue","SurgicalGloves_White","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //Add gloves
ref TStringArray OtherEquip = {"CivilianBelt", "MilitaryBelt","","","","","","","","","","","","","","","",""}; //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","Stone","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",
"M18SmokeGrenade_Green","M18SmokeGrenade_Purple","M18SmokeGrenade_Red","M18SmokeGrenade_White","M18SmokeGrenade_Yellow","UniversalLight",
"PistolOptic","KashtanOptic","KazuarOptic","KobraOptic","KobraOptic","ACOGOptic_6x","","","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; //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<SurvivorBotBase> m_BotMass = new array<SurvivorBotBase>;
ref array<SurvivorBotBase> m_PlaersZoneArray = 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, 7);
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("AKM");
m_BotSolder.AddWeaponAtt("AK_WoodBttstck");
m_BotSolder.AddWeaponAtt("AK_WoodHndgrd");
m_BotSolder.AddMagazine("Mag_AKM_Drum75Rnd");
break;
}
case 4:
{
m_BotSolder.AddWeapon("SVD");
m_BotSolder.AddMagazine("Mag_SVD_10Rnd");
break;
}
case 5:
{
m_BotSolder.AddWeapon("M4A1");
m_BotSolder.AddWeaponAtt("M4_RISHndgrd");
m_BotSolder.AddWeaponAtt("M4_MPBttstck");
m_BotSolder.AddWeaponAtt("ACOGOptic");
m_BotSolder.AddMagazine("Mag_STANAG_30Rnd");
break;
}
case 6:
{
m_BotSolder.AddWeapon("AKM");
m_BotSolder.AddWeaponAtt("AK_WoodBttstck");
m_BotSolder.AddWeaponAtt("AK_WoodHndgrd");
m_BotSolder.AddMagazine("Mag_AKM_Drum75Rnd");
break;
}
case 7:
{
m_BotSolder.AddWeapon("AKM");
m_BotSolder.AddWeaponAtt("AK_WoodBttstck");
m_BotSolder.AddWeaponAtt("AK_WoodHndgrd");
m_BotSolder.AddMagazine("Mag_AKM_Drum75Rnd");
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().CreatePlayer(null, m_BotBody.GetRandomElement(), Navmesh, 0, "NONE"));
else
m_BotSolder = SurvivorBotBase.Cast(GetGame().CreatePlayer(null, m_BotBody.GetRandomElement(), botSpPos, 0, "NONE"));
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,90);
itemEnt.SetHealth("","",rndHlt);
}
}
// if (rndFriendly == 0){
// m_Frendly = false;
// }
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();
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<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;
}
}
}