Use playersNumber for player count in sched_animals #1889

This won't count AI units unless they are spawned on side west.
This commit is contained in:
ebaydayz
2017-01-30 13:41:19 -05:00
parent 2ecb614534
commit 752ed00566
2 changed files with 17 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
sched_animals = {
HIDE_FSM_VARS
private ["_min","_count","_global","_obj","_x","_animalssupported","_type","_root","_favouritezones","_angle","_radius","_randrefpoint","_PosList","_Pos","_agent","_pos", "_vehicle", "_speed", "_i"];
private ["_min","_count","_global","_obj","_x","_animalssupported","_type","_root","_favouritezones","_angle","_radius","_randrefpoint","_PosList","_Pos","_agent","_pos", "_vehicle", "_speed"];
_min = diag_fpsmin;
_vehicle = vehicle player;
_count = 0;
@@ -43,31 +43,25 @@ sched_animals = {
if (_speed distance [0,0,0] > 12) exitWith {objNull};
if ((_vehicle != player) AND {((count crew _vehicle > 1) AND {(driver _vehicle != player)})}) exitWith {objNull};
//diag_log [ dayz_maxGlobalAnimals / (1 max count playableUnits), ceil(1.2*(dayz_maxGlobalAnimals - _global) / (1 max count playableUnits)) min (dayz_maxAnimals - _count), _global,dayz_maxAnimals, _count, dayz_maxGlobalAnimals, _global ];
for "_x" from 0 max (2 min (ceil(1.5*(dayz_maxGlobalAnimals - _global) / (1 max count playableUnits)) min (dayz_maxAnimals - _count))) to 1 step -1 do {
_animalssupported = ["hen","hen","hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit"];
//diag_log [ dayz_maxGlobalAnimals / (1 max (playersNumber west)), ceil(1.2*(dayz_maxGlobalAnimals - _global) / (1 max (playersNumber west))) min (dayz_maxAnimals - _count), _global,dayz_maxAnimals, _count, dayz_maxGlobalAnimals, _global ];
for "_x" from 0 max (2 min (ceil(1.5*(dayz_maxGlobalAnimals - _global) / (1 max (playersNumber west))) min (dayz_maxAnimals - _count))) to 1 step -1 do {
_animalssupported = ["Hen","Hen","Hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit"];
if (dayz_tameDogs) then {_animalssupported set [count _animalssupported,"Dog"];};
_type = _animalssupported select floor random count _animalssupported;
if (_type == "Cow") then {
_animalssupported = ["Cow01","Cow02","Cow03","Cow04","Cow01_EP1"];
_type = _animalssupported select floor random count _animalssupported;
};
if (_type == "Goat") then {
_animalssupported = ["Goat","Goat01_EP1","Goat02_EP1"];
_type = _animalssupported select floor random count _animalssupported;
};
if (_type == "Sheep") then {
_animalssupported = ["Sheep","Sheep01_EP1","Sheep02_EP1"];
_type = _animalssupported select floor random count _animalssupported;
};
if (_type == "hen") then {
_animalssupported = ["hen","Cock"];
_type = _animalssupported select floor random count _animalssupported;
};
if (_type == "Dog") then {
_animalssupported = ["Fin","Pastor"];
_animalssupported = switch _type do {
case "Hen": {["Hen","Cock"]};
case "Cow": {["Cow01","Cow02","Cow03","Cow04","Cow01_EP1"]};
case "Goat": {["Goat","Goat01_EP1","Goat02_EP1"]};
case "Sheep": {["Sheep","Sheep01_EP1","Sheep02_EP1"]};
case "Dog": {["Fin","Pastor"]};
default {_animalssupported};
};
if (count _animalssupported < 6) then {
_type = _animalssupported select floor random count _animalssupported;
};
_root = configFile >> "CfgVehicles" >> _type;
_favouritezones = getText ( _root >> "favouritezones");
_angle = (random 120) - 60;

View File

@@ -27,7 +27,7 @@
5 lbCurSel !="_selectedMissionIndex = lbCurSel _lbMissionsControl;" !="_selectedUserIndex = lbCurSel _lbUsersControl;" !="profileNamespace setVariable ['streamerMode',(lbCurSel (_this select 0))];" !="_index = lbCurSel _lbcontrol;" !="_selected = lbCurSel _list;" !="_friendName = _userList lbText (lbCurSel _userList);" !")] call Z_" !"(lbCurSel 7421) call Z_fillCategoryList" !"] call Door" !"] call Plot" !")] spawn TraderDialog" !="[(lbCurSel 21000), ((ctrlParent (_this select 0)) displayCtrl 21001)] spawn EpochDeathBoardClick;" !"((ctrlParent (_this select 0)) closeDisplay 2);" !="_uid = _playerList lbData (lbCurSel _playerList);" !"_myGroup lbData (lbCurSel _myGroup);"
5 lbSet !="_lbUsersControl lbSetColor [_x, [1,0,0,1]];" !="_lbUsersControl lbSetValue [_x, _rating];" !="_control lbSetColor [_x, _color];" !"_weaponsLBSetFocus" !="(_this select 0) displayCtrl 140 lbSetCurSel (profileNamespace getVariable ['streamerMode',0]);" !="(_display displayCtrl 105) lbSetColor [_i, [0.06, 0.05, 0.03, 1]];" !"[7421," !"lbSetPicture [7422, _index" !"lbSetPicture [7402, _index" !"lbSetPicture [7401, _index" !="_userList lbSetData [(lbSize _userList) -1,_friendUID];" !" [TraderDialogItemList, _index, " !"_myGroup lbSetData [_index,getPlayerUID _x];"
5 onMapSingleClick
5 playableUnits !"for [{_y=0},{_y < count(playableUnits)},{_y=_y+1}] do {" !"typeName player == \"OBJECT\" && {(player in playableUnits" !"(1 max count playableUnits)) min (dayz_maxAnimals - _count))) to 1 step -1 do {" !"AND {((alive _x) AND {((vehicle _x) distance _obj < 150)})}} count playableUnits)}) then {" !="_local = { _unit distance _x < _dis; } count playableUnits <= 1;" !"if (!_isOk) exitWith {false};\nuiSleep 0.001;\n} forEach playableUnits;" !"ManagementMustBeClose) then { player nearEntities [\"CAManBase\", 10] } else { playableUnits };"
5 playableUnits !"for [{_y=0},{_y < count(playableUnits)},{_y=_y+1}] do {" !"typeName player == \"OBJECT\" && {(player in playableUnits" !"AND {((alive _x) AND {((vehicle _x) distance _obj < 150)})}} count playableUnits)}) then {" !="_local = { _unit distance _x < _dis; } count playableUnits <= 1;" !"if (!_isOk) exitWith {false};\nuiSleep 0.001;\n} forEach playableUnits;" !"ManagementMustBeClose) then { player nearEntities [\"CAManBase\", 10] } else { playableUnits };"
5 selectPlayer !"dayz_originalPlayer enableSimulation true;\naddSwitchableUnit dayz_originalPlayer;\nsetPlayable dayz_originalPlayer;\nselectPlayer dayz_originalPlayer;" !"addSwitchableUnit _newUnit;\nsetPlayable _newUnit;\nselectPlayer _newUnit;"
5 serverCommand !="_character = if (serverCommandAvailable \"#kick\") then { call sched_tg_follow } else { player };" !"serverCommand (\"#kick \" + _selectedName);"
5 setDamage !"([4654,9595,0] nearestObject 145259) setDamage 1;\n([4654,9595,0] nearestObject 145260) setDamage 1;" !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"_tree setDamage 1;\ndayz_choppedTrees set [count dayz_choppedTrees,_tree];" !"player setDamage 1;\n\nif (dayz_onBack != \"\") then {\n_body addWeapon dayz_onBack;" !"\n_obj setDamage (damage _obj) + _damage;\n" !"if(\"\" == typeOf _tree) then {\n_tree setDamage 1;\n};" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;"