eai
eai copied to clipboard
how to equip bots?/Как снарядить ботов?
Привет уважаемый разработчик мода, возникла проблема, в файле HumanLoadout.json и прочих подобных файлов поменял снаряжение для ботов, но они все также спавняться со своим старндартным снаряжением, как исправить?
Hello dear mod developer, there is a problem in the HumanLoadout file.json and other similar files have changed the equipment for bots, but they still spawn with their stardart equipment, how can I fix it?
Доброго времени суток. Решается всё следующим способом:
- Вставляй вместо своего - вставляй этот файл: HumanLoadout.txt
- Направляемся в: Server\mpmissions\dayzOffline.ChernarusPlus\eAI\AI_init.c
- Находим строку:
ref array<string> patrol_loadouts =
- Сверяем каждую строку с списком патрулей (т.е. по дефолту 10 патрулей и можно сделать уникальную разгрузку для каждого патруля ArrayExample.txt
- Необходимо доукомплектовать метод: OnUnitSpawn(eAIBase unit), в нём можно накрутить обвесы AiLoadoutExample.txt
- PROFIT!!!!!!
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- English version:
Good daytime. Your situation might be fixed that way:
- Replace yours HumanLoadout.json with mine (rename from .txt to .json: HumanLoadout.txt
- Get to the path: Server\mpmissions\dayzOffline.ChernarusPlus\eAI\AI_init.c
- Find the line like:
ref array<string> patrol_loadouts =
- Check amount of patrols and amount of loadouts THEY MUST BE EQUAL! ArrayExample.txt
- You need to override method: OnUnitSpawn(eAIBase unit), there you may set additional attachments for yours AI firearm AiLoadoutExample.txt
- PROFIT!!!!!!
I made a new file for the loadout and in no way do the bots come with the equipment I selected, and every time it creates a new SoldierLoadout.json file, I can edit this new file but within the game it doesn't change anything, and if I delete it it comes back appear next...
I made a new file for the loadout and in no way do the bots come with the equipment I selected, and every time it creates a new SoldierLoadout.json file, I can edit this new file but within the game it doesn't change anything, and if I delete it it comes back appear next...
Please read my answer carefully. It contains everything to not to be ****ed up. If write simply - checkout array of loadouts, items count in array MUST BE qual to ammount of patrols.
And try to not make any single mistake in loadout coz it might brake the loading of json file and everything went to trash.
Also there's one way where you may make a mistake is the function void InitDynamicPatrols()
There there's if statement like if (i< patrol_loadouts.Count()) { loadout = patrol_loadouts[i]; } else { loadout = "HumanLoadout.json"; // Here you may set any other loadout, but keep in mind that state will submitted if made a mistake with count of loadouts (less then) and patrols count. }
I've been trying to fix this for 2 days now... if you could help me...
// Patrol 1 = Balota strip
ref array
// Patrol 2 = SW Rail Line
ref array
// Patrol 3 = Cherno Port
ref array
// Patrol 4 = Elektro Yard
ref array
// Patrol 5 = Solnechny south
ref array
// Patrol 6 = Rify Trail
ref array
// Patrol 7 = Nizhneye
ref array
// Patrol 8 = NWAF North
ref array
// Patrol 9 = NWAF south
ref array
// Patrol 10 = Tisy
ref array
// If you add another patrol array, add it to this list
ref array<array
// IMPORTANT: If you add an entry to the above list, pick the loadout for it by adding the loadout filename to this list
ref array
// you may change these quantities const int NUMBER_PER_PATROL = 5; // Number of AI per patrol const int MAXR = 800; // This is the main spawn radius- how close a player needs to be to spawn them in. const int MINR = 250; // If a player is this close to the patrol start point, it is too close for them to spawn const int DESPAWNR = 1000; // If all players are this far away, they despawn. const int RESPAWN_SECONDS = 300; // The amount of seconds before a new patrol will spawn, after they both die
class CustomPatrol : eAIDynamicPatrol { override void OnPatrolSpawn(eAIGroup patrol) { // Uncomment this line to change the faction of the patrol from Raiders (default) // eAIFactionGuards for example is a faction which only kills players who have their weapons out // patrol.SetFaction(new eAIFactionGuards());
// Uncomment this line to slow down or speed up the patrol (1.0 to 3.0)
patrol.SetSpeedLimit(1.0);
}
override void OnUnitSpawn(eAIBase unit) {
// Uncomment this to give the AI unlimited magazines (new one is added on reload)
unit.SetUnlimitedMags(true);
// You can also do anything you would do in the StartingEquipSetup() for players here
// These lines will add attachments the same way you would for a player. However, the AI must have the M4A1 class in the Loadout.json file already for it to work.
//Weapon_Base weapon = Weapon_Base.Cast(unit.GetItemInHands());
//weapon.GetInventory().CreateAttachment("M4_PlasticHndgrd");
//weapon.GetInventory().CreateAttachment("M4_OEBttstck");
//weapon.GetInventory().CreateAttachment("M4_CarryHandleOptic");
}
};
autoptr array<autoptr eAIDynamicPatrol> patrols = {};
void InitDynamicPatrols() { for (int i = 0; i < patrol_list.Count(); i++) { string loadout = "SoldadosBlack.json"; // default if (i < patrol_loadouts.Count()) loadout = patrol_loadouts[i]; autoptr CustomPatrol pat = new CustomPatrol(patrol_list[i][0], patrol_list[i], loadout, NUMBER_PER_PATROL, MINR, MAXR, DESPAWNR, RESPAWN_SECONDS); patrols.Insert(pat); pat.UpdateTriggers(); } }
void SpawnSentry(vector pos, string loadout = "SoldadosBlack.json") { eAIGame game = MissionServer.Cast(GetGame().GetMission()).GetEAIGame(); eAIBase ai = game.SpawnAI_Sentry(pos, loadout); }
modded class CustomMission { void StartingEquipSetup(PlayerBase player, bool clothesChosen) { m_eaiGame.GetGroupByLeader(player); super.StartingEquipSetup(player, clothesChosen); } };
{ "Shirts": [ "MMG_combatshirt_dark_woodland" ], "Pants": [ "MMG_combatpants_dark_woodland" ], "Shoes": [ "MMG_boots_dark_woodland" ], "BackPacks": [ "MMG_camelback_dark_woodland" ], "Vests": [ "MMG_MK_V_Armor_dark_woodland" ], "Headgear": [ "MMG_striker_helmet_dark_woodland" ], "Gloves": [ "mmg_tactical_gloves_dark_woodland" ], "Misc": [ "MMG_balaclava_dark_woodland" ], "ClothesHealth": [ 70, 100 ], "WeaponMelee": [ "MeleeBat" ], "WeaponRifle": [ "Snafu_ScarH_DKMC_GUN", "GCGN_M11_Barret", "Snafu_pkp_Black_GUN" ], "WeaponRifleMagCount": [ 1, 3 ], "WeaponHandgun": [ "SN_Glock19" ], "WeaponHandgunMagCount": [ 1, 3 ], "WeaponHealth": [ 70, 100 ], "Loot": [ "SodaCan_Cola", ], "LootRandom": [ "SodaCan_Cola" ], "LootChance": [ 50, 50, 50, 50, 50, 50, 50, 50 ], "LootHealth": [ 70, 100 ], "Locked": 0 }
Even if I edit the default SoldierLoadout.json file it doesn't load, if I just change the weapon, it continues to come with the default weapon, if I delete the SoldierLoadout.json file the system creates another file... I don't know what to do anymore ..
First point is the your JSON: "Loot": [ "SodaCan_Cola", ], "LootChance": [ 50, 50, 50, 50, 50, 50, 50, 50 ];
Loot has 1 item, when LootChance has 8 items 1 not equal to 8, so correct way should be
"Loot": [ "SodaCan_Cola", ], "LootRandom": [ "SodaCan_Cola" ], "LootChance": [ 50 ];
Even if I edit the default SoldierLoadout.json file it doesn't load, if I just change the weapon, it continues to come with the default weapon, if I delete the SoldierLoadout.json file the system creates another file... I don't know what to do anymore ..
To the hell I made some changes based on my file Mission\eAI\eAI_Init.c:
`ref array
// you may change these quantities const int NUMBER_PER_PATROL = 10; // Number of AI per patrol const int MAXR = 1200; // This is the main spawn radius- how close a player needs to be to spawn them in. const int MINR = 400; // If a player is this close to the patrol start point, it is too close for them to spawn const int DESPAWNR = 1400; // If all players are this far away, they despawn. const int RESPAWN_SECONDS = 900; // The amount of seconds before a new patrol will spawn, after they both die
autoptr array<autoptr eAIDynamicPatrol> patrols = {};
class CustomPatrol : eAIDynamicPatrol { override void OnPatrolSpawn(eAIGroup patrol) { // Uncomment this line to change the faction of the patrol from Raiders (default) // eAIFactionGuards for example is a faction which only kills players who have their weapons out // patrol.SetFaction(new eAIFactionGuards()); // Uncomment this line to slow down or speed up the patrol (1.0 to 3.0) // patrol.SetSpeedLimit(1.0); } override void OnUnitSpawn(eAIBase unit) { // Uncomment this to give the AI unlimited magazines (new one is added on reload) unit.SetUnlimitedMags(true); // You can also do anything you would do in the StartingEquipSetup() for players here // These lines will add attachments the same way you would for a player. However, the AI must have the M4A1 class in the Loadout.json file already for it to work. //Weapon_Base weapon = Weapon_Base.Cast(unit.GetItemInHands()); //weapon.GetInventory().CreateAttachment("M4_PlasticHndgrd"); //weapon.GetInventory().CreateAttachment("M4_OEBttstck"); //weapon.GetInventory().CreateAttachment("M4_CarryHandleOptic"); } }; void InitDynamicPatrols() { for (int i = 0; i < patrol_list.Count(); i++) { string loadout = "SoldadosBlack.json"; if (i < patrol_loadouts.Count()) { loadout = patrol_loadouts[i]; } else { loadout = "SoldadosBlack.json"; } autoptr CustomPatrol pat = new CustomPatrol(patrol_list[i][0], patrol_list[i], loadout, NUMBER_PER_PATROL, MINR, MAXR, DESPAWNR, RESPAWN_SECONDS); patrols.Insert(pat); pat.UpdateTriggers(); } } void SpawnSentry(vector pos, string loadout = "SoldadosBlack.json") { eAIGame game = MissionServer.Cast(GetGame().GetMission()).GetEAIGame(); eAIBase ai = game.SpawnAI_Sentry(pos, loadout); } modded class CustomMission { override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { m_eaiGame.GetGroupByLeader(player); super.StartingEquipSetup(player, clothesChosen); } };`
Paste it after ending of the ref array<array> patrol_list =
and I hope it will help you to fix your mission.
Friend, unfortunately it didn't work, I changed the amount of drop chance, and also the entire modified list that you envied, and now you can't access the server, it's online but you can't connect...
First point is the your JSON: "Loot": [ "SodaCan_Cola", ], "LootChance": [ 50, 50, 50, 50, 50, 50, 50, 50 ];
Loot has 1 item, when LootChance has 8 items 1 not equal to 8, so correct way should be
"Loot": [ "SodaCan_Cola", ], "LootRandom": [ "SodaCan_Cola" ], "LootChance": [ 50 ];
Dang it. May you chekout the logs you need to checkout the crash_ file and DayZServer_x64_*.rpt, there should be a reason why the server is kicked down.
Any way I'll try to attach the .txt file with full version of that script, maybe it will help you...
SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,297": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,311": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,325": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaidynamicpatrol.c,66": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (E): @"$CurrentDir:mpmissions/dayzOffline.chernarusplus/eAI/AI_init.c,46": Wrong number of template parameters SCRIPT (E): Can't compile mission init script'!
I didn't find this other file DayZServer_x64_*.rpt
SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,297": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,311": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,325": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaidynamicpatrol.c,66": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (E): @"$CurrentDir:mpmissions/dayzOffline.chernarusplus/eAI/AI_init.c,46": Wrong number of template parameters SCRIPT (E): Can't compile mission init script'!
I'd found that githab had had been fu**ed up my code. I'd rewritten it under your solutions and will sent you as text file attachment.
SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,297": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,311": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,325": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaidynamicpatrol.c,66": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (E): @"$CurrentDir:mpmissions/dayzOffline.chernarusplus/eAI/AI_init.c,46": Wrong number of template parameters SCRIPT (E): Can't compile mission init script'!
I'd found that githab had had been fu**ed up my code. I'd rewritten it under your solutions and will sent you as text file attachment.
ok, thanks
Where do I see attachments?
SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,297": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,311": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaigame.c,325": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (W): @"eAI/Scripts/5_Mission/eai\eaidynamicpatrol.c,66": Unsafe down-casting, use 'PlayerBase.Cast' for safe down-casting SCRIPT (E): @"$CurrentDir:mpmissions/dayzOffline.chernarusplus/eAI/AI_init.c,46": Wrong number of template parameters SCRIPT (E): Can't compile mission init script'!
I'd found that githab had had been fu**ed up my code. I'd rewritten it under your solutions and will sent you as text file attachment.
ok, thanks
Done.
Please be careful, don't direct copy the json file from here or attachments. Was error in json code: Line 55, there's ',' in array with one single item.
Was: "Loot": [ "SodaCan_Cola", ],
Correct is:
"Loot": [ "SodaCan_Cola" ], eAI_Init.txt SoldadosBlack.txt
Wish you luck!
I did everything here, the server is online but I can't connect, I'm going to uninstall everything and redo it to see...
I did everything here, the server is online but I can't connect, I'm going to uninstall everything and redo it to see...
Let's try in other way.
1st close the DayZ Launcher 2nd - Open windows CMD
And one by one enter next commands: ipconfig /release ipconfig /flushdns ipconfig /renew
And star over the launcher
My server is on gportal, funny that yesterday it was working normally, and out of nowhere the bot mod stopped working, but any equipment I want to put on the bot doesn't work...
My server is on gportal, funny that yesterday it was working normally, and out of nowhere the bot mod stopped working, but any equipment I want to put on the bot doesn't work...
That's really odd. About that you could not connect:
1st check versions of server mods and client mods 2 ways to solve it: A) Clear cash of dns for windows (previous CMD commands) B) In launcher select Direct Connection and input IP amd Port - that's actually working!
Log D:\home\sid_1167897\dayz\config\crash_2023-09-12_15-38-20.log started at 12.09. 15:38:39
M22685, 12.09 2023 15:38:39 Can't compile mission init script'!
$CurrentDir:mpmissions\dayzOffline.chernarusplus\init.c(1): Can't find file '$CurrentDir:mpmissions/dayzOffline.chernarusplus/eAI/AI_init.c'
Runtime mode CLI params: config config\server.cfg cfg config\basic.cfg profiles config cpuCount 1 ip 194.140.197.85 port 28000 mod @zSpawnSelectionFixed;@VanillaPlusPlusMap;@Cabin_Mod_RaGed;@Cabin_Mod_CodeLock_RaGed;@CodeLock;@CodeLockCraft;@DayZ-Dog;@FlyingBirds!;@MMGBaseStorage;@MuchCarKey;@DurableToolsPlus;@Ear-Plugs;@BuildingFortifications;@AmmoStackBullet;@BuildEverywhere;@PristineRepair;@SchanaModParty;@ZensTireRack;@PVEZReloaded;@PVEZMarkersOnVPPMap;@VPPAdminTools;@CF;@Community-Online-Tools;@MMG-MightysMilitaryGear;@SNAFUWeapons;@BuilderItems;@DabsFramework;@AirRaid;@GAREA_Leaderboard;@LootBarrelTransfer;@RepairAttachments;@FuelConsumption;@VanillaCarsUp;@ZombieRunOverSound;@BlackoutsScorpion;@InediaStamina;@InediaInfectedAI;@eAI_Reloaded servermod @SurvivorMissions loadMissionToMemory enableHT
Log D:\home\sid_1167897\dayz\config\crash_2023-09-12_15-38-20.log started at 12.09. 15:38:39
M22685, 12.09 2023 15:38:39 Can't compile mission init script'!
$CurrentDir:mpmissions\dayzOffline.chernarusplus\init.c(1): Can't find file '$CurrentDir:mpmissions/dayzOffline.chernarusplus/eAI/AI_init.c'
Runtime mode CLI params: config config\server.cfg cfg config\basic.cfg profiles config cpuCount 1 ip 194.140.197.85 port 28000 mod @zSpawnSelectionFixed;@VanillaPlusPlusMap;@Cabin_Mod_RaGed;@Cabin_Mod_CodeLock_RaGed;@CodeLock;@CodeLockCraft;@DayZ-Dog;@FlyingBirds!;@MMGBaseStorage;@MuchCarKey;@DurableToolsPlus;@Ear-Plugs;@BuildingFortifications;@AmmoStackBullet;@BuildEverywhere;@PristineRepair;@SchanaModParty;@ZensTireRack;@PVEZReloaded;@PVEZMarkersOnVPPMap;@VPPAdminTools;@CF;@Community-Online-Tools;@MMG-MightysMilitaryGear;@SNAFUWeapons;@BuilderItems;@DabsFramework;@AirRaid;@GAREA_Leaderboard;@LootBarrelTransfer;@RepairAttachments;@FuelConsumption;@VanillaCarsUp;@ZombieRunOverSound;@BlackoutsScorpion;@InediaStamina;@InediaInfectedAI;@eAI_Reloaded servermod @SurvivorMissions loadMissionToMemory enableHT
Dang... Are you just copied the .txt not even renamed from .txt into .c am I right?
Sorry, I copied it wrong, my head is already spinning here
Ok, I managed to enter the game and the bots spawned in the default settings, 2 default bots appeared, now I'm going to copy the files and edit, let's see..
Sorry, I copied it wrong, my head is already spinning here
How dang I understand you man :)
Ok, I managed to enter the game and the bots spawned in the default settings, 2 default bots appeared, now I'm going to copy the files and edit, let's see..
Wait if i understood you right then your new settings already shall working. But instead of 2 units shall be 4 if i didn't miss anything...
Yes, if I install the mod, and I enter the server and go to the air base, the default bots, which are 2, appear normal, but if I apply your configuration the server comes online but I can't enter the server... it's as if there was something wrong with the configuration
So, I can enter the server, but the bots I configured do not work, only the default one, which is SoldierLoadout.json or HumanLoadout.json
// Patrol 1 = Balota strip
ref array
// Patrol 2 = SW Rail Line
ref array
// Patrol 3 = Cherno Port
ref array
// Patrol 4 = Elektro Yard
ref array
// Patrol 5 = Solnechny south
ref array
// Patrol 6 = Rify Trail
ref array
// Patrol 7 = Nizhneye
ref array
// Patrol 8 = NWAF North
ref array
// Patrol 9 = NWAF south
ref array
// Patrol 10 = Tisy
ref array
// If you add another patrol array, add it to this list
ref array<array
// IMPORTANT: If you add an entry to the above list, pick the loadout for it by adding the loadout filename to this list
ref array
// you may change these quantities const int NUMBER_PER_PATROL = 2; // Number of AI per patrol const int MAXR = 800; // This is the main spawn radius- how close a player needs to be to spawn them in. const int MINR = 250; // If a player is this close to the patrol start point, it is too close for them to spawn const int DESPAWNR = 1000; // If all players are this far away, they despawn. const int RESPAWN_SECONDS = 300; // The amount of seconds before a new patrol will spawn, after they both die
class CustomPatrol : eAIDynamicPatrol { override void OnPatrolSpawn(eAIGroup patrol) { // Uncomment this line to change the faction of the patrol from Raiders (default) // eAIFactionGuards for example is a faction which only kills players who have their weapons out // patrol.SetFaction(new eAIFactionGuards());
// Uncomment this line to slow down or speed up the patrol (1.0 to 3.0)
// patrol.SetSpeedLimit(1.0);
}
override void OnUnitSpawn(eAIBase unit) {
// Uncomment this to give the AI unlimited magazines (new one is added on reload)
// unit.SetUnlimitedMags(true);
// You can also do anything you would do in the StartingEquipSetup() for players here
// These lines will add attachments the same way you would for a player. However, the AI must have the M4A1 class in the Loadout.json file already for it to work.
//Weapon_Base weapon = Weapon_Base.Cast(unit.GetItemInHands());
//weapon.GetInventory().CreateAttachment("M4_PlasticHndgrd");
//weapon.GetInventory().CreateAttachment("M4_OEBttstck");
//weapon.GetInventory().CreateAttachment("M4_CarryHandleOptic");
}
};
autoptr array<autoptr eAIDynamicPatrol> patrols = {};
void InitDynamicPatrols() { for (int i = 0; i < patrol_list.Count(); i++) { string loadout = "SoldierLoadout.json"; // default if (i < patrol_loadouts.Count()) loadout = patrol_loadouts[i]; autoptr CustomPatrol pat = new CustomPatrol(patrol_list[i][0], patrol_list[i], loadout, NUMBER_PER_PATROL, MINR, MAXR, DESPAWNR, RESPAWN_SECONDS); patrols.Insert(pat); pat.UpdateTriggers(); } }
void SpawnSentry(vector pos, string loadout = "SoldierLoadout.json") { eAIGame game = MissionServer.Cast(GetGame().GetMission()).GetEAIGame(); eAIBase ai = game.SpawnAI_Sentry(pos, loadout); }
modded class CustomMission { void StartingEquipSetup(PlayerBase player, bool clothesChosen) { m_eaiGame.GetGroupByLeader(player); super.StartingEquipSetup(player, clothesChosen); } };
Look what I did, I took all the information in the SoldadosBlack.json file, opened the HumanLoadout.json file, deleted everything inside and replaced it... and it worked... but I wanted the name of my file to work to put it different patrols across the map.. but if I use the term SoldadosBlack.json it doesn't work
Look what I did, I took all the information in the SoldadosBlack.json file, opened the HumanLoadout.json file, deleted everything inside and replaced it... and it worked... but I wanted the name of my file to work to put it different patrols across the map.. but if I use the term SoldadosBlack.json it doesn't work
Loadouts are described in eAI-Init.c, you shall there replace the names and please use only English letters in names. One before i got the same error with Russian names of files.
That could be a possible issue why it's not working...