Advertisement
Guest User

Tavi 2.0 - Animal Fix

a guest
Sep 18th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. private["_list","_Pos","_randrefpoint","_PosList","_PosSelect","_Pos","_list","_animalssupported","_type","_root","_favouritezones","_GroupMarker","_agent","_id","_tame"];
  2. _list = getposATL player nearEntities [["CAAnimalBase"],dayz_animalDistance];
  3.  
  4. if (count _list < dayz_maxAnimals) then {
  5. //Find where animal likes
  6. _animalssupported = ["hen","hen","hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit"];
  7. //_animalssupported = ["DZ_Pastor"];
  8. _type = (_animalssupported select floor(random(count _animalssupported)));
  9. if (_type == "Cow") then {
  10. _animalssupported = ["Cow01","Cow02","Cow03","Cow04"];
  11. _type = (_animalssupported select floor(random(count _animalssupported)));
  12. };
  13. _root = configFile >> "CfgVehicles" >> _type;
  14. _favouritezones = getText ( _root >> "favouritezones");
  15. //_randrefpoint = [position player, 10, dayz_animalDistance, 1, 0, 50, 0] call BIS_fnc_findSafePos;
  16. _randrefpoint = getposATL player;
  17. _PosList = selectbestplaces [_randrefpoint,dayz_animalDistance,_favouritezones,10,5];
  18. _PosSelect = _PosList select (floor random (count _PosList));
  19. _Pos = _PosSelect select 0;
  20. _list = _Pos nearEntities [["CAAnimalBase","Man"],50];
  21.  
  22.  
  23. if (player distance _Pos < dayz_animalDistance and NOT surfaceIsWater _Pos and (count _list <= 1)) then {
  24. if (_type == "DZ_Pastor") then { _agent = createAgent [_type, _Pos, [], 0, "NONE"]; } else { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; };
  25. _agent setpos _Pos;
  26. _id = [_pos,_agent] execFSM "fixes\system\animal_agent.fsm";
  27. };
  28. sleep 1;
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement