Files
DayZ-Epoch/SQF/dayz_code/compile/player_animalCheck.sqf
icomrade c3ed4e49e1 Replace sleep with uiSleep
see the below links for more info. uiSleep is based off of a more
accurate method of tracking time, whereas sleep can fluctuate depending
on application performance since it is based on framerate.
https://community.bistudio.com/wiki/uiSleep
https://community.bistudio.com/wiki/sleep_vs_uiSleep
https://community.bistudio.com/wiki/sleep
2016-02-17 13:03:17 -05:00

46 lines
2.0 KiB
Plaintext

private ["_animalssupported","_type","_agent","_favouritezones","_randrefpoint","_PosList","_PosSelect","_Pos","_list"];
_list = (getposATL player) nearEntities [["CAAnimalBase"],dayz_animalDistance];
if ((count _list) < dayz_maxAnimals) then {
_animalssupported = ["Chicken","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit","Dog"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
Switch (_type) do {
case "Cow" : {
_animalssupported = ["Cow01","Cow02","Cow03","Cow04","Cow01_EP1"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Goat" : {
_animalssupported = ["Goat01_EP1","Goat02_EP1","Goat"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Sheep" : {
_animalssupported = ["Sheep","Sheep02_EP1","Sheep01_EP1"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Chicken" : {
_animalssupported = ["Hen","Cock"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Dog" : {
_animalssupported = ["DZ_Fin","DZ_Pastor"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
};
_favouritezones = getText (configFile >> "CfgVehicles" >> _type >> "favouritezones");
_randrefpoint = getposATL player;
_PosList = selectBestPlaces [_randrefpoint,dayz_animalDistance,_favouritezones,10,5];
_PosSelect = _PosList select (floor(random(count _PosList)));
_Pos = _PosSelect select 0;
_list = _Pos nearEntities [["CAAnimalBase","Man"],50];
if (((player distance _Pos) < dayz_animalDistance) && {!(surfaceIsWater _Pos)} && {(count _list) <= 1}) then {
if (_type == "DZ_Pastor") then { _agent = createAgent [_type, _Pos, [], 0, "NONE"]; } else { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; };
uiSleep 0.001;
_agent setPos _Pos;
_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
PVDZE_zed_Spawn = [_agent];
publicVariableServer "PVDZE_zed_Spawn";
};
uiSleep 1;
};