Jump to content
  • 0

zombie_generate.sqf Error


Markokil321

Question

Hello,

 

So after updating to 1.0.5.1 when the update was released i must have missed out to add 

DZE_MissionLootTable			= true;

to my mission.pbo, so i had lived under the illusion that my customized loot tables have been in use for the last several months... i know, GG.

Only found out about this today and corrected the issue, however now whenever i load into my testserver i get this error upon spawning in in my local .RPT: 

Error in expression <tNumber(configFile >> "CfgMagazines" >> _loot >> "count");
if(_loot_count>1) the>
  Error position: <_loot >> "count");
if(_loot_count>1) the>
  Error Undefined variable in expression: _loot
File z\addons\dayz_code\compile\zombie_generate.sqf, line 100
Error in expression <CLChances select _index;
_loot = _array select (_weights select (floor(random (c>
  Error position: <select (_weights select (floor(random (c>
  Error Zero divisor
File z\addons\dayz_code\compile\zombie_generate.sqf, line 98

Now i have not noticed this causing any problems yet however would like to ask whether this is an error people may have experienced before when enabling DZE_MissionLootTable, and/or if there is a fix out there?

All i did to enable the missionloot in the past was to add: ( "CfgBuildingLoot.hpp","CfgBuildingPos.hpp","CfgLoot.hpp","CfgLootSmall.hpp" ) to a folder in my mission.pbo, #include "Configs\CfgBuildingLoot.hpp" in description.ext and add the DZE_Missionloot variable to init.sqf.

 

I take it this would be the standard procedure?  Can i safely ignore this or could anyone help out with a fix.

Thnx

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Hello,

 

So after updating to 1.0.5.1 when the update was released i must have missed out to add 

DZE_MissionLootTable			= true;

to my mission.pbo, so i had lived under the illusion that my customized loot tables have been in use for the last several months... i know, GG.

Only found out about this today and corrected the issue, however now whenever i load into my testserver i get this error upon spawning in in my local .RPT: 

Error in expression <tNumber(configFile >> "CfgMagazines" >> _loot >> "count");
if(_loot_count>1) the>
  Error position: <_loot >> "count");
if(_loot_count>1) the>
  Error Undefined variable in expression: _loot
File z\addons\dayz_code\compile\zombie_generate.sqf, line 100
Error in expression <CLChances select _index;
_loot = _array select (_weights select (floor(random (c>
  Error position: <select (_weights select (floor(random (c>
  Error Zero divisor
File z\addons\dayz_code\compile\zombie_generate.sqf, line 98

Now i have not noticed this causing any problems yet however would like to ask whether this is an error people may have experienced before when enabling DZE_MissionLootTable, and/or if there is a fix out there?

All i did to enable the missionloot in the past was to add: ( "CfgBuildingLoot.hpp","CfgBuildingPos.hpp","CfgLoot.hpp","CfgLootSmall.hpp" ) to a folder in my mission.pbo, #include "Configs\CfgBuildingLoot.hpp" in description.ext and add the DZE_Missionloot variable to init.sqf.

 

I take it this would be the standard procedure?  Can i safely ignore this or could anyone help out with a fix.

Thnx

zombie_generate throw in mpmission and make corrections

 

private ["_position","_unitTypes","_radius","_method","_agent"];

_position = _this select 0;
_doLoiter = _this select 1; // wander around
_unitTypes = _this select 2; // class of wanted models
_maxControlledZombies = round(dayz_maxLocalZombies);

_cantSee = {
	private ["_isok"];

	_isok = true;
	_zPos = +(_this select 0);
	if (count _zPos < 3) exitWith {
		diag_log format["%1::_cantSee illegal pos %2", __FILE__, _zPos];
		false
	};
	_zPos = ATLtoASL _zPos;
	_fov = _this select 1; // players half field of view
	_safeDistance = _this select 2; // minimum distance. closer is wrong
	_farDistance = _this select 3; // distance further we won't check
	_zPos set [2, (_zPos select 2) + 1.7];
	{
		_xasl = getPosASL _x;
		if (_xasl distance _zPos < _farDistance) then {
			if (_xasl distance _zPos < _safeDistance) then {
				_isok = false;
			}
			else {
				_eye = eyePos _x; // ASL
				_ed = eyeDirection _x;
				_ed = (_ed select 0) atan2 (_ed select 1);
				_deg = [_xasl, _zPos] call BIS_fnc_dirTo;
				_deg = (_deg - _ed + 720) % 360;
				if (_deg > 180) then { _deg = _deg - 360; };
				if ((abs(_deg) < _fov) && {( // in right angle sector?
						(!(terrainIntersectASL [_zPos, _eye]) // no terrain between?
						&& {(!(lineIntersects [_zPos, _eye]))}) // && no object between?
					)}) then {
					_isok = false;
				};
			};
		};
		if (!_isok) exitWith {false};
	} count playableUnits;

	_isok
};

if ((dayz_spawnZombies < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
	if ([_position, dayz_cantseefov, 10, dayz_cantseeDist] call _cantSee) then {
		//Check if anyone close
		_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
		if (_tooClose) exitwith {
			// diag_log ("Zombie_Generate: was too close to player.");
		};

		//Add zeds if unitTypes equals 0
		if (count _unitTypes == 0) then {
			if (DZE_MissionLootTable) then {
				_unitTypes = []+ getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
			} else {
				_unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
			};
		};

		// lets create an agent
		_type = _unitTypes call BIS_fnc_selectRandom;
		_radius = 5;
		_method = "NONE";
		if (_doLoiter) then {
			_radius = 40;
			_method = "CAN_COLLIDE";
		};

		//Check if point is in water
		if (surfaceIsWater _position) exitwith {  };

		_agent = createAgent [_type, _position, [], _radius, _method];
		sleep 0.001;

		//add to global counter
		dayz_spawnZombies = dayz_spawnZombies + 1;

		//Add some loot
		_loot = "";
		_array = [];
		_rnd = random 1;
		if (_rnd < 0.2) then {
			_lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
			if (isText _lootType) then {
				_array = [];
				if (DZE_MissionLootTable) then {
					{
						_array set [count _array, _x select 0] 
					} forEach getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType));
				} else {
					{
						_array set [count _array, _x select 0] 
					} forEach getArray (configFile >> "cfgLoot" >> getText(_lootType));
				};
				if (count _array > 0) then {
					_index = dayz_CLBase find getText(_lootType);
					_weights = dayz_CLChances select _index;
					_loot = _array select (_weights select (floor(random (count _weights))));
					if(!isNil "_array") then {
						_loot_count =	getNumber(configFile >> "CfgMagazines" >> _loot >> "count");
						if(_loot_count>1) then {
							_agent addMagazine [_loot, ceil(random _loot_count)];
						} else {
						_agent addMagazine _loot;
						};
					};
				};
			};
		};

		_agent setVariable["agentObject",_agent];

		if (!isNull _agent) then {
			// sometime Z can be seen flying in very high speed while tp. Its altitude is set underground to hide that.
			/*
			_agtPos = getPosASL _agent;
			_agtPos set [2, -3];
			_agent setPosASL _agtPos;
			sleep 0.001;
			_agtPos = +(_position);
			_agtPos set [2, -3];
			_agent setPosASL _agtPos;
			sleep 0.001;
			*/
			_agent setDir random 360;
			//_agent setPosATL _position;
			sleep 0.001;

			_position = getPosATL _agent;

			_favStance = (
				switch ceil(random(3^0.5)^2) do {
					//case 3: {"DOWN"}; // prone
					case 2: {"Middle"}; // Kneel
					default {"UP"} // stand-up
				}
			);
			_agent setUnitPos _favStance;

			_agent setVariable ["stance", _favStance];
			_agent setVariable ["BaseLocation", _position];
			_agent setVariable ["doLoiter", true]; // true: Z will be wandering, false: stay still
			_agent setVariable ["myDest", _position];
			_agent setVariable ["newDest", _position];
			[_agent, _position] call zombie_loiter;
		};
		//add to monitor
		//dayz_zedMonitor set [count dayz_zedMonitor, _agent];

		//Disable simulation
		PVDZE_Server_Simulation = [_agent, false];
		publicVariableServer "PVDZE_Server_Simulation";

		//Start behavior
		_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
	};
}; 

 

there were

			_array = [];


				{
					_array set [count _array, _x select 0]




				} count getArray (configFile >> "cfgLoot" >> getText(_lootType));

rectification

	_array = [];
				if (DZE_MissionLootTable) then {
					{

						_array set [count _array, _x select 0] 
					} forEach getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType));
				} else {
					{
						_array set [count _array, _x select 0] 
					} forEach getArray (configFile >> "cfgLoot" >> getText(_lootType));
				};
Link to comment
Share on other sites

  • 0

I was getting the exact same message - word for word. I made the change suggested and still get the same message - word for word.  No additional errors.   Did I miss something?

 

Here's my zombie_generate.sqf:

 

private ["_position","_unitTypes","_radius","_method","_agent","_loot_count","_index","_weights","_loot","_array","_lootType","_favStance","_tooClose","_type","_rnd","_id","_doLoiter","_maxControlledZombies","_cantSee"];



_position = _this select 0;
_doLoiter = _this select 1; // wander around
_unitTypes = _this select 2; // class of wanted models
_maxControlledZombies = round(dayz_maxLocalZombies);

_cantSee = {
private ["_isok","_deg","_eye","_ed","_xasl","_zPos","_fov","_safeDistance","_farDistance"];

_isok = true;
_zPos = +(_this select 0);
if (count _zPos < 3) exitWith {
diag_log format["%1::_cantSee illegal pos %2", __FILE__, _zPos];
false
};
_zPos = ATLtoASL _zPos;
_fov = _this select 1; // players half field of view
_safeDistance = _this select 2; // minimum distance. closer is wrong
_farDistance = _this select 3; // distance further we won't check
_zPos set [2, (_zPos select 2) + 1.7];
{
_xasl = getPosASL _x;
if (_xasl distance _zPos < _farDistance) then {
if (_xasl distance _zPos < _safeDistance) then {
_isok = false;
}
else {
_eye = eyePos _x; // ASL
_ed = eyeDirection _x;
_ed = (_ed select 0) atan2 (_ed select 1);
_deg = [_xasl, _zPos] call BIS_fnc_dirTo;
_deg = (_deg - _ed + 720) % 360;
if (_deg > 180) then { _deg = _deg - 360; };
if ((abs(_deg) < _fov) && {( // in right angle sector?
(!(terrainIntersectASL [_zPos, _eye]) // no terrain between?
&& {(!(lineIntersects [_zPos, _eye]))}) // && no object between?
)}) then {
_isok = false;
};
};
};
if (!_isok) exitWith {false};
} count playableUnits;

_isok
};

if ((dayz_spawnZombies < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
if ([_position, dayz_cantseefov, 10, dayz_cantseeDist] call _cantSee) then {
//Check if anyone close
_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
if (_tooClose) exitwith {
// diag_log ("Zombie_Generate: was too close to player.");
};

//Add zeds if unitTypes equals 0
if (count _unitTypes == 0) then {
if (DZE_MissionLootTable) then {
_unitTypes = []+ getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
} else {
_unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
};
};

// lets create an agent
_type = _unitTypes call BIS_fnc_selectRandom;
_radius = 5;
_method = "NONE";
if (_doLoiter) then {
_radius = 40;
_method = "CAN_COLLIDE";
};

//Check if point is in water
if (surfaceIsWater _position) exitwith { };

_agent = createAgent [_type, _position, [], _radius, _method];
sleep 0.001;

//add to global counter
dayz_spawnZombies = dayz_spawnZombies + 1;

//Add some loot
_loot = "";
_array = [];
_rnd = random 1;
if (_rnd < 0.2) then {
_lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
if (isText _lootType) then {


_array = [];
if (DZE_MissionLootTable) then {
{

_array set [count _array, _x select 0]
} forEach getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType));
} else {
{
_array set [count _array, _x select 0]
} forEach getArray (configFile >> "cfgLoot" >> getText(_lootType));
};


// _array = [];
// {
// _array set [count _array, _x select 0]
// } count getArray (configFile >> "cfgLoot" >> getText(_lootType));


if (count _array > 0) then {
_index = dayz_CLBase find getText(_lootType);
_weights = dayz_CLChances select _index;
_loot = _array select (_weights select (floor(random (count _weights))));
if(!isNil "_array") then {
_loot_count = getNumber(configFile >> "CfgMagazines" >> _loot >> "count");
if(_loot_count>1) then {
_agent addMagazine [_loot, ceil(random _loot_count)];
} else {
_agent addMagazine _loot;
};
};
};
};
};

_agent setVariable["agentObject",_agent];

if (!isNull _agent) then {
// sometime Z can be seen flying in very high speed while tp. Its altitude is set underground to hide that.
/*
_agtPos = getPosASL _agent;
_agtPos set [2, -3];
_agent setPosASL _agtPos;
sleep 0.001;
_agtPos = +(_position);
_agtPos set [2, -3];
_agent setPosASL _agtPos;
sleep 0.001;
*/
_agent setDir random 360;
//_agent setPosATL _position;
sleep 0.001;

_position = getPosATL _agent;

_favStance = (
switch ceil(random(3^0.5)^2) do {
//case 3: {"DOWN"}; // prone
case 2: {"Middle"}; // Kneel
default {"UP"} // stand-up
}
);
_agent setUnitPos _favStance;

_agent setVariable ["stance", _favStance];
_agent setVariable ["BaseLocation", _position];
_agent setVariable ["doLoiter", true]; // true: Z will be wandering, false: stay still
_agent setVariable ["myDest", _position];
_agent setVariable ["newDest", _position];
[_agent, _position] call zombie_loiter;
};
//add to monitor
//dayz_zedMonitor set [count dayz_zedMonitor, _agent];

//Disable simulation
PVDZE_Server_Simulation = [_agent, false];
publicVariableServer "PVDZE_Server_Simulation";

//Start behavior
_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
};
};

 

The new lines are in green, starting at line 93 and the original lines are in red and commented out.

Thanks,

Bob

Link to comment
Share on other sites

  • 0

Would it have to do with these lines?

 

if (DZE_MissionLootTable) then {
    _unitTypes = []+ getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
   } else {
    _unitTypes = []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");

 

Should CfgBuildingLoot be the entire path?

 

Bob

Link to comment
Share on other sites

  • 0

Here's the errors:

 

Strange convex component12 in rh_m14\rh_sc2eot.p3d:geometry


Error in expression > "CfgMagazines" >> _loot >> "count");
if(_loot_count>1) the>
Error position: <_loot >> "count");
if(_loot_count>1) the>
Error Undefined variable in expression: _loot
File z\addons\dayz_code\compile\zombie_generate.sqf, line 100
Error in expression _loot = _array select (_weights select (floor(random (c>
Error position: Error Zero divisorFile z\addons\dayz_code\compile\zombie_generate.sqf, line 98Error in expression > "CfgMagazines" >> _loot >> "count");if(_loot_count>1) the> Error position: <_loot >> "count");if(_loot_count>1) the> Error Undefined variable in expression: _lootFile z\addons\dayz_code\compile\zombie_generate.sqf, line 100Error in expression _loot = _array select (_weights select (floor(random (c> Error position:
Error Zero divisor
File z\addons\dayz_code\compile\zombie_generate.sqf, line 98
Error in expression _losCheck = 0;
_cantSee = [_agent,_target] call dayz_losCheck;
};
>
Error position: <_target] call dayz_losCheck;
};
>
Error Undefined variable in expression: _target
Error in expression < = alive _agent;
_targetPos = getPosATL _target;



_agent moveTo _targetPos;
_a>
Error position: <_target;



_agent moveTo _targetPos;
_a>
Error Undefined variable in expression: _target

(configfile>

 

I get that maybe 6 or 8 times in the .rpt file.  There are no other errors in my .rpt.

 

Thanks,

Bob

Link to comment
Share on other sites

  • 0

Bob are you sure you are actually calling the new file in your compiles.sqf? You should not be seeing any dayz_code\ zombie_generate messages if it is told to use your custom one.

zombie_generate = compile preprocessFileLineNumbers "YOURPATHORFOLDER\zombie_generate.sqf";

Sent from a mobile device

Link to comment
Share on other sites

  • 0

I actually don't call an external zombie_generate.sqf.  I edited the one in dayz_code.pbo/compile/bis_fnc.

 

I just did a global search and there is no other zombie_generate.sqf on my system.  So I'm still at a loss.

Bob

 

Try to do it this way (by putting it in mission, calling the file from compiles.sqf in mission) and i would like to bet it fixes it.  :)

Do you have any specific reason as to why you did it the way you did, just curious?

Link to comment
Share on other sites

  • 0

Well, I'm finally getting back to this.   I changed it so it's calling the zombie_generate.zqf in my custom folder.   I also set DZE_Mission loot to true since it appears I had missed that.  My server .rpt runs clean but my client .rpt gets:

 

File mpmissions\__CUR_MP.Tavi\custom\fixes\zombie_generate.sqf, line 90
Error in expression <m 1;
if (_rnd < 0.2) then {
(
_lootType = configFile >> "CfgVehicles" >> _type >>
  Error position: <= configFile >> "CfgVehicles" >> _type >>
  Error Missing )
File mpmissions\__CUR_MP.Tavi\custom\fixes\zombie_generate.sqf, line 90

Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81
Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81
Strange convex component01 in rh_m14\rh_sc2eot.p3d:geometry
Strange convex component07 in rh_m14\rh_sc2eot.p3d:geometry
Strange convex component12 in rh_m14\rh_sc2eot.p3d:geometry
UH1Wreck_DZ: MainTurret - unknown animation source MainTurret
UH1Wreck_DZ: MainGun - unknown animation source mainGun
UH1Wreck_DZ: Gatling - unknown animation source Gatling
Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81
Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81
Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81
Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81
Error in expression <ind _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weig>
  Error position: <select _index;
_cntWeights = count _weig>
  Error Zero divisor
File z\addons\dayz_code\compile\spawn_loot_small.sqf, line 81

 

Also, I didn't play for very long but for the short time I was on, in a major city, no zombies appeared.

 

Bob

ps. how do you add in spoilers now... I didn't see an option.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...