Epoch 1.0.3 Users - Please read.

Status
Not open for further replies.

Buttface

OpenDayZ Rockstar!
(Skip to the red text below).

The latest update to DayZ Epoch's loot table structure has broken DZAI's dynamic weapon list feature. A workaround for this problem is to disable the dynamic weapon list in your dzai_config and manually manage your weapon tables (the location of the files is in the config).

There is no ETA for a fix currently due to lack of free time on my end. A ballpark figure would be 2-3 weeks from the date of this post, but I will be working to ensure it happens sooner rather than later.

Edit: A hotfix in testing has been posted below.

Edit #2: The problem appears to be fixed, so I am closing this thread. If there are any other problems relating to the dynamic weapon list with Epoch 1.0.3, please make a new thread.
 
I am opening up this thread for user replies because I am releasing a test fix to work around Epoch's new loot table structure. However, this is completely untested and I am relying on users to test this out. Before you use this code, you must understand that I an extremely limited for time and this is all I could do in a moment's notice.

Only use this code if you understand and agree with everything on this list:

  1. This code is untested. You are the first to test this.
  2. This code is only for DayZ Epoch 1.0.3.
  3. This code is not guaranteed in any way to work.
  4. Do not PM me with anything related to this post or its code, please ask questions on this thread instead.
  5. If this code does not work, use your original buildWeaponArrays.sqf and go on with your life.
  6. Do not test this code on an active server. Your players will probably not appreciate the downtime if there is any.
  7. If my efforts to quickly fix this issue don't work, you will have to wait until I have time to do testing myself.
  8. If this thread is closed, it means I have postponed testing until further notice (read: given up).
Instructions:

  1. Locate your DZAI\scripts\buildWeaponArrays.sqf.
  2. Back up this file somewhere safe.
  3. Replace ALL the contents inside the file with what I posted below.
  4. Edit your dzai_config.sqf.
    • Ensure DZAI_debugLevel is 1 or 2.
    • Make sure DZAI_dynamicWeaponList is true.
  5. Repack your server (or mission) pbo and start your server.
  6. Check your RPT log for any errors. If there are no errors, report back in this thread if DZAI outputs the completed weapon arrays. If there are errors, please also report them in this thread.
Test code version: 3

Code:
/*
    buildWeaponArrays
 
    Description: Do not edit anything in this file unless instructed by the developer.
 
    Last updated: 4:07 PM 12/6/2013
*/
 
private ["_bldgClasses","_weapons","_lootItem","_aiWeaponBanList","_unwantedWeapons","_lootList","_cfgBuildingLoot","_lootListCheck","_startTime"];
 
if (!isNil "DZAI_weaponsInitialized") exitWith {};
 
_startTime = diag_tickTime;
diag_log "[DZAI] Building DZAI weapon arrays using CfgBuildingLoot data.";
 
_bldgClasses = [["Residential","Farm"],["Military"],["MilitarySpecial"],["HeliCrash"]];
_unwantedWeapons = _this select 0;        //User-specified weapon banlist.
 
_aiWeaponBanList = ["Crossbow_DZ","Crossbow","MeleeHatchet","MeleeCrowbar","MeleeMachete","MeleeBaseball","MeleeBaseBallBat","MeleeBaseBallBatBarbed","MeleeBaseBallBatNails","Chainsaw"];
 
//Add user-specified banned weapons to DZAI weapon banlist.
for "_i" from 0 to ((count _unwantedWeapons) - 1) do {
    _aiWeaponBanList set [(count _aiWeaponBanList),(_unwantedWeapons select _i)];
};
//diag_log format ["DEBUG :: List of weapons to be removed from DZAI classname tables: %1",_aiWeaponBanList];
 
//Compatibility with Namalsk's selectable loot table feature.
if (isNil "dayzNam_buildingLoot") then {
    _cfgBuildingLoot = "cfgBuildingLoot";
    if ((toLower worldName) == "trinity") then {
        //Fix for Trinity Island's Barracks loot table.
        _bldgClasses set [2,["Barracks"]];
    };
} else {
    _cfgBuildingLoot = dayzNam_buildingLoot;
    (_bldgClasses select 3) set [((_bldgClasses select 3) find "HeliCrash"),"HeliCrashNamalsk"];
};
//diag_log format ["DEBUG :: _cfgBuildingLoot: %1",_cfgBuildingLoot];
 
//Compatibility with DayZ 1.7.7's new HeliCrash tables
if ((isClass (configFile >> _cfgBuildingLoot >> "HeliCrashWEST")) && (isClass (configFile >> _cfgBuildingLoot >> "HeliCrashEAST"))) then {
    _bldgClasses set [3,["HeliCrashWEST","HeliCrashEAST"]];
    //diag_log format ["DEBUG :: HeliCrash tables modified: %1",(_bldgClasses select 3)];
};
 
//Fix for CfgBuildingLoot structure change in DayZ 1.7.7
_lootList = "";
_lootListCheck = isArray (configFile >> _cfgBuildingLoot >> "Default" >> "lootType");
//diag_log format ["DEBUG :: _lootListCheck: %1",_lootListCheck];
if (_lootListCheck) then {
    _lootList = "lootType";
} else {
    _lootList = "itemType";
};
//diag_log format ["DEBUG :: _lootList: %1",_lootList];
 
//Declare all DZAI weapon arrays. DO NOT EDIT.
DZAI_Pistols0 = [];
DZAI_Pistols1 = [];
DZAI_Pistols2 = [];
DZAI_Pistols3 = [];
 
DZAI_Rifles0 = [];
DZAI_Rifles1 = [];
DZAI_Rifles2 = [];
DZAI_Rifles3 = [];
 
//Build the weapon arrays.
for "_i" from 0 to (count _bldgClasses - 1) do {                    //_i = weapongrade
    for "_j" from 0 to (count (_bldgClasses select _i) - 1) do {    //If each weapongrade has more than 1 building class, investigate them all
        private["_bldgLoot"];
        _bldgLoot = [] + getArray (configFile >> _cfgBuildingLoot >> ((_bldgClasses select _i) select _j) >> _lootList);
        for "_k" from 0 to (count _bldgLoot - 1) do {             
            _lootItem = _bldgLoot select _k;
            if ((_lootItem select 1) == "weapon") then {            //Build an array of "weapons", then categorize them as rifles or pistols, then sort them into the correct weapon grade.
                private ["_weaponItem","_weaponMags"];
                _weaponItem = _lootItem select 0;
                _weaponMags = count (getArray (configFile >> "cfgWeapons" >> _weaponItem >> "magazines"));
                if ((_weaponMags > 0) && !(_weaponItem in _aiWeaponBanList)) then {                            //Consider an item as a "weapon" if it has at least one magazine type.
                    if ((getNumber (configFile >> "CfgWeapons" >> _weaponItem >> "type")) == 1) then {
                        call compile format ["DZAI_Rifles%1 set [(count DZAI_Rifles%1),'%2'];",_i,_weaponItem];
                    } else {
                        if ((getNumber (configFile >> "CfgWeapons" >> _weaponItem >> "type")) == 2) then {
                            call compile format ["DZAI_Pistols%1 set [(count DZAI_Pistols%1),'%2'];",_i,_weaponItem];
                        };
                    };
                };
            } else {
                if ((_lootItem select 1) == "cfglootweapon") then {
                    private ["_weapons"];
                    _weapons = [] + getArray (configFile >> "cfgLoot" >> (_lootItem select 0));
                    {
                        if (!(_x in _aiWeaponBanList)) then {
                            if ((getNumber (configFile >> "CfgWeapons" >> _x >> "type")) == 1) then {
                                call compile format ["DZAI_Rifles%1 set [(count DZAI_Rifles%1),'%2'];",_i,_x];
                            } else {
                                if ((getNumber (configFile >> "CfgWeapons" >> _x >> "type")) == 2) then {
                                    call compile format ["DZAI_Pistols%1 set [(count DZAI_Pistols%1),'%2'];",_i,_x];
                                };
                            };
                        };
                    } forEach (_weapons select 0);
                };
            };
        };
    };
};
 
//Because heli-crash sites don't usually have pistol loot, it may be necessary to populate it with pistol classnames from the MilitarySpecial table.
if ((count DZAI_Pistols3) == 0) then {
    diag_log "DZAI_Pistols3 is empty. Populating with entries from DZAI_Pistols2.";
    DZAI_Pistols3 = [] + DZAI_Pistols2;
};
 
//In case the mod has no HeliCrash loot tables...
if ((count DZAI_Rifles3) == 0) then {
    diag_log "DZAI_Rifles3 is empty. Populating with entries from DZAI_Rifles2.";
    DZAI_Rifles3 = [] + DZAI_Rifles2;
};
 
if (DZAI_debugLevel > 0) then {
    //Display finished weapon arrays
    diag_log format ["Contents of DZAI_Pistols0: %1",DZAI_Pistols0];
    diag_log format ["Contents of DZAI_Pistols1: %1",DZAI_Pistols1];
    diag_log format ["Contents of DZAI_Pistols2: %1",DZAI_Pistols2];
    diag_log format ["Contents of DZAI_Pistols3: %1",DZAI_Pistols3];
 
    diag_log format ["Contents of DZAI_Rifles0: %1",DZAI_Rifles0];
    diag_log format ["Contents of DZAI_Rifles1: %1",DZAI_Rifles1];
    diag_log format ["Contents of DZAI_Rifles2: %1",DZAI_Rifles2];
    diag_log format ["Contents of DZAI_Rifles3: %1",DZAI_Rifles3];
};
 
diag_log format ["[DZAI] DZAI weapon classname tables created in %1 seconds.",(diag_tickTime - _startTime)];
 
DZAI_weaponsInitialized = true;
 
  • Test code has been updated to version 2 to prevent DZAI-banned and user-banned weapons from being added to the DZAI weapon tables.
  • Updated to version 3 to solve an undefined variable error.
 
Testing right now and will report the results.

Debug output:

Code:
22:17:32 "[DZAI] Building DZAI weapon arrays using CfgBuildingLoot data."
22:17:32 "Contents of DZAI_Pistols0: ["Makarov","Colt1911","revolver_EP1","glock17_EP1","MakarovSD","M9","M9SD","revolver_gold_EP1"]"
22:17:32 "Contents of DZAI_Pistols1: ["Makarov","Colt1911","revolver_EP1","glock17_EP1","MakarovSD","M9","M9SD","revolver_gold_EP1","UZI_EP1","Sa61_EP1","UZI_SD_EP1"]"
22:17:32 "Contents of DZAI_Pistols2: ["Makarov","Colt1911","revolver_EP1","glock17_EP1","MakarovSD","M9","M9SD","revolver_gold_EP1","UZI_EP1","Sa61_EP1","UZI_SD_EP1"]"
22:17:32 "Contents of DZAI_Pistols3: ["UZI_EP1","Sa61_EP1","UZI_SD_EP1"]"
22:17:32 "Contents of DZAI_Rifles0: ["Winchester1866","LeeEnfield","MR43","Saiga12K","Remington870_lamp","M1014","Winchester1866","LeeEnfield","MR43","Saiga12K","Remington870_lamp","huntingrifle"]"
22:17:32 "Contents of DZAI_Rifles1: ["AKS_74_kobra","AKS_74_U","AKS_GOLD","AK_47_M","AK_74","FN_FAL","FN_FAL_ANPVS4","G36A_camo","G36C","G36C_camo","G36K_camo","G36_C_SD_camo","M16A2","M16A2GL","M16A4_ACG","M4A1","M4A1_Aim","M4A1_AIM_SD_camo","M4A1_HWS_GL_camo","M4A3_CCO_EP1","Sa58P_EP1","Sa58V_CCO_EP1","Sa58V_EP1","Sa58V_RCO_EP1","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","BAF_L85A2_RIS_SUSAT","BAF_L85A2_RIS_Holo","M4A1_HWS_GL_SD_Camo","AK_107_PSO","M4SPR","M40A3","SVD_CAMO","SVD_des_EP1","SVD","huntingrifle","M24_des_EP1","M24","BAF_LRR_scoped","KSVK_DZE","VSS_vintorez","SCAR_H_LNG_Sniper_SD","M14_EP1","DMR","Winchester1866","LeeEnfield","MR43","Saiga12K","Remington870_lamp","M1014","bizon","MP5A5","bizon_silenced","MP5SD","RPK_74","M8_SAW","Pecheneg_DZ","MG36_camo","M60A4_EP1_DZE","MG36","M249_m145_EP1_DZE","m240_scoped_EP1_DZE","M240_DZ","M249_DZ","Mk_48_DZ"]"
22:17:32 "Contents of DZAI_Rifles2: ["AKS_74_kobra","AKS_74_U","AKS_GOLD","AK_47_M","AK_74","FN_FAL","FN_FAL_ANPVS4","G36A_camo","G36C","G36C_camo","G36K_camo","G36_C_SD_camo","M16A2","M16A2GL","M16A4_ACG","M4A1","M4A1_Aim","M4A1_AIM_SD_camo","M4A1_HWS_GL_camo","M4A3_CCO_EP1","Sa58P_EP1","Sa58V_CCO_EP1","Sa58V_EP1","Sa58V_RCO_EP1","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","BAF_L85A2_RIS_SUSAT","BAF_L85A2_RIS_Holo","M4A1_HWS_GL_SD_Camo","RPK_74","M8_SAW","Pecheneg_DZ","MG36_camo","M60A4_EP1_DZE","MG36","M249_m145_EP1_DZE","m240_scoped_EP1_DZE","M240_DZ","M249_DZ","Mk_48_DZ","AK_107_PSO","M4SPR","M40A3","SVD_CAMO","SVD_des_EP1","SVD","huntingrifle","M24_des_EP1","M24","BAF_LRR_scoped","KSVK_DZE","VSS_vintorez","SCAR_H_LNG_Sniper_SD","M14_EP1","DMR","Saiga12K","Remington870_lamp","M1014","bizon","MP5A5","bizon_silenced","MP5SD"]"
22:17:32 "Contents of DZAI_Rifles3: ["AKS_74_kobra","AKS_74_U","AKS_GOLD","AK_47_M","AK_74","FN_FAL","FN_FAL_ANPVS4","G36A_camo","G36C","G36C_camo","G36K_camo","G36_C_SD_camo","M16A2","M16A2GL","M16A4_ACG","M4A1","M4A1_Aim","M4A1_AIM_SD_camo","M4A1_HWS_GL_camo","M4A3_CCO_EP1","Sa58P_EP1","Sa58V_CCO_EP1","Sa58V_EP1","Sa58V_RCO_EP1","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","BAF_L85A2_RIS_SUSAT","BAF_L85A2_RIS_Holo","M4A1_HWS_GL_SD_Camo","bizon","MP5A5","bizon_silenced","MP5SD","AK_107_PSO","M4SPR","M40A3","SVD_CAMO","SVD_des_EP1","SVD","huntingrifle","M24_des_EP1","M24","BAF_LRR_scoped","KSVK_DZE","VSS_vintorez","SCAR_H_LNG_Sniper_SD","M14_EP1","DMR","RPK_74","M8_SAW","Pecheneg_DZ","MG36_camo","M60A4_EP1_DZE","MG36","M249_m145_EP1_DZE","m240_scoped_EP1_DZE","M240_DZ","M249_DZ","Mk_48_DZ"]"
22:17:32 "[DZAI] DZAI weapon classname tables created in 0.0469971 seconds."
22:17:32 "[DZAI] DZAI is verifying all tables for banned or invalid classnames..."
22:17:32 "[DZAI] All tables have been verified. No invalid entries found."
22:17:32 "[DZAI] Table verification completed in 0.0850067 seconds."
22:17:32 "[DZAI] 77 locations gathered in 0.0330048 seconds."
22:17:32 "Starting DZAI Scheduler in 30 seconds."
22:17:33 "Starting DZAI Server Monitor in 60 seconds."

Now will meet some Bandits :)
 
13:11:29 "Initializing DZAI version 1.8.1"
13:11:29 "[DZAI] Reading DZAI configuration file."
13:11:29 "[DZAI] DZAI Variables loaded."
13:11:29 "[DZAI] Compiling DZAI functions."
13:11:29 "[DZAI] Base classname tables loaded."
13:11:29 "DZAI Debug: Detected mod variant @DayZ_Epoch."
13:11:29 "[DZAI] Server is running map lingor. Loading static trigger and classname configs."
13:11:29 "DayZ Epoch loot tables loaded."
13:11:29 "[DZAI] AI to zombie hostility is enabled."
13:11:29 "[DZAI] Zombie hostility to AI is disabled."
13:11:29 "[DZAI] DZAI loaded with settings: Debug Level: 2. DebugMarkers: 2. ModName: epoch. DZAI_dynamicWeaponList: true. VerifyTables: true."
13:11:29 "[DZAI] DZAI loading completed in 0.0110016 seconds."
13:11:29 "Total Number of spawn locations 11"
13:11:30 "DEBUG VEIN: Too many objects at [8444.06,619.397]"
13:11:31 "DEBUG VEIN: Too many objects at [4944.08,9011.18]"
13:11:32 "DEBUG: Too many at [2267.58,2713.75]"
13:11:32 "DEBUG: Too many at [4179.78,7324.12]"
13:11:33 "DEBUG: Too many at [3542.41,6396.76]"
13:11:34 "DEBUG: Too many at [1773.65,8230.43]"
13:11:36 "DEBUG: Too many at [9167.89,4016.52]"
13:11:39 "EPOCH EVENTS INIT"
13:11:39 "[DZAI] Building DZAI weapon arrays using CfgBuildingLoot data."
13:11:39 "DZAI_Pistols3 is empty. Populating with entries from DZAI_Pistols2."
13:11:39 "DZAI_Rifles3 is empty. Populating with entries from DZAI_Rifles2."
13:11:39 "Contents of DZAI_Pistols0: []"
13:11:39 "Contents of DZAI_Pistols1: []"
13:11:39 "Contents of DZAI_Pistols2: []"
13:11:39 "Contents of DZAI_Pistols3: []"
13:11:39 "Contents of DZAI_Rifles0: []"
13:11:39 "Contents of DZAI_Rifles1: []"
13:11:39 "Contents of DZAI_Rifles2: []"
13:11:39 "Contents of DZAI_Rifles3: []"
13:11:39 "[DZAI] DZAI weapon classname tables created in 0.0039978 seconds."
13:11:39 "Starting DZAI Scheduler in 30 seconds."
13:11:39 "CLEANUP: INITIALIZING CLEANUP SCRIPT"
13:11:39 "Starting DZAI Server Monitor in 60 seconds."
13:11:39 "OBJECT PATCH :: Spawning in serverside objects... Reading from file CfgTownGenerator."
13:11:39 "[DZAI] DZAI is verifying all tables for banned or invalid classnames..."
13:11:39 "[DZAI] All tables have been verified. No invalid entries found."
13:11:39 "[DZAI] Table verification completed in 0.0479965 seconds."
13:11:39 "[DZAI] 124 locations gathered in 0.0149994 seconds."
13:11:39 Server: Object 3:7 not found (message 94)
13:11:40 "TIME SYNC: Local Time set to [2013,8,3,13,11]"
13:11:48 "Lingor static/dynamic trigger configuration loaded."
13:12:04 "DZAI Extended Debug: Spawning AI from building positions (spawnBandits)."
13:12:04 "DZAI Debug: Processed static trigger spawn data in 0.00698853 seconds (spawnBandits)."
13:12:04 "DZAI Extended Debug: Found spawn position at 4.67917 meters away at position [3661.88,1549.38,0] after 1 attempts."
13:12:04 "DZAI Extended Debug: Created weapon any and backpack DZ_Assault_Pack_EP1 for AI with weapongrade 0. (fn_unitSelectWeapon)"
13:12:04 "DZAI Extended Debug: Spawned AI Type Priest_DZ with weapongrade 0 for group O 1-1-A (fnc_createGroup)."
13:12:04 "DZAI Extended Debug: Created weapon any and backpack DZ_Czech_Vest_Puch for AI with weapongrade 0. (fn_unitSelectWeapon)"
13:12:04 "DZAI Extended Debug: Spawned AI Type SurvivorW2_DZ with weapongrade 0 for group O 1-1-A (fnc_createGroup)."
13:12:04 "DZAI Extended Debug: Group O 1-1-A has group size 2."
13:12:04 "DZAI Debug: Spawned 1 new AI groups (2 units total) in 0.07901 seconds at Calamar (spawnBandits)."
13:12:04 "DZAI Extended Debug: Initialized static trigger at Calamar. GroupArray: [O 1-1-A], PatrolDist: 250. GradeChances: [0.6,0.35,0.04,0.01]. LocationArray 81 positions, MaxUnits [2,1]."
13:12:04 "DZAI Extended Debug: AI resupply script active."
13:12:04 "DZAI Extended Debug: AI resupply script active."
13:12:06 "DZAI Extended Debug: Spawning AI from building positions (spawnBandits)."
13:12:06 "DZAI Debug: Processed static trigger spawn data in 0.0019989 seconds (spawnBandits)."
13:12:06 "DZAI Extended Debug: Found spawn position at 3.586 meters away at position [3270.63,1500.63,0] after 1 attempts."
13:12:06 "DZAI Extended Debug: Created weapon any and backpack DZ_Assault_Pack_EP1 for AI with weapongrade 0. (fn_unitSelectWeapon)"
13:12:06 "DZAI Extended Debug: Spawned AI Type Rocker1_DZ with weapongrade 0 for group O 1-1-B (fnc_createGroup)."
13:12:06 "DZAI Extended Debug: Group O 1-1-B has group size 1."
13:12:06 "DZAI Debug: Spawned 1 new AI groups (1 units total) in 0.053009 seconds at Ralon (spawnBandits)."
13:12:06 "DZAI Extended Debug: Initialized static trigger at Ralon. GroupArray: [O 1-1-B], PatrolDist: 150. GradeChances: [0.6,0.35,0.04,0.01]. LocationArray 27 positions, MaxUnits [0,2]."
13:12:06 "DZAI Extended Debug: AI resupply script active."
13:12:12 "OBJECT PATCH :: Serverside object patch completed in 32.968 seconds."
13:12:12 "Starting DZAI Dynamic Spawn Manager in 5 minutes."
13:12:12 "DZAI Extended Debug: _grpArray is [O 1-1-A]. _isCleaning is false."
13:12:12 "DZAI Extended Debug: No players remain in trigger area at Calamar. Deleting 1 AI groups in 120 seconds."
13:12:12 "DZAI Extended Debug: _grpArray is [O 1-1-B]. _isCleaning is false."
13:12:12 "DZAI Extended Debug: No players remain in trigger area at Ralon. Deleting 1 AI groups in 120 seconds."
13:12:13 "Spawned helicopter type UH60M_EP1_DZ for group R 1-1-A at 081088."
13:12:13 "DZAI Debug: Created AI helicopter crew group R 1-1-A is now active and patrolling."
13:12:13 "Helicopter is part of group R 1-1-A."
13:12:13 "DZAI Debug: Helicopter UH60M_EP1_DZ driver is R 1-1-A:1. Crew is [R 1-1-A:1,R 1-1-A:2,R 1-1-A:3]. Vehicle weapons: ["M134"]."
13:12:15 "DZAI Scheduler will continue tasks in 15 minutes."
 
@Polli: Thanks, the debug output looks good

@TheZog: Is that debug output with version 3 of the test code?
 
Thank you so much for helping with the testing. I'll push out the new dynamic weapon script to Github as a hotfix later as soon as I personally do some final checks.
 
Good to hear that everything is working out fine now. I'm pushing the updated script to Github now. If you already have test version 3 applied, you won't need the latest hotfix (1.8.1.1).
 
Status
Not open for further replies.
Back
Top