Advertisement
Guest User

Tavi 2.0 - Player Check Stealth

a guest
Sep 18th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. private["_vel","_speed","_scalePose","_scaleMvmt","_scaleLight","_scaleAlert","_anim","_anim4","_initial","_isDay","_nearFlare","_scaler","_pos"];
  2. _vel = velocity (vehicle player);
  3. _speed = (_vel distance [0,0,0]);
  4. _pos = getPosATL player;
  5. _scalePose = 0.9;
  6. _scaleMvmt = 0.2; //0.4;
  7. _scaleLight = 0.5;
  8. _scaleAlert = 1;
  9.  
  10. //Assess Players Position
  11. _anim = animationState player;
  12. _anim4 = toArray _anim;
  13. _anim4 resize 4;
  14. _anim4 = toString _anim4;
  15.  
  16. if (["pknl",_anim] call fnc_inString) then {
  17. _scaleMvmt = 0.2; //0.1;
  18. _scalePose = 0.6; //0.4
  19. } else {
  20. if (["ppne",_anim] call fnc_inString) then {
  21. _scaleMvmt = 0.3;
  22. _scalePose = 0.14;
  23. };
  24. };
  25.  
  26. if (_anim4 == "aswm") then {
  27. _scaleMvmt = 0.3;
  28. dayz_isSwimming = true;
  29. } else {
  30. dayz_isSwimming = false;
  31. };
  32.  
  33. _initial = 20 + (sunOrMoon * 20);
  34.  
  35. _scaleLight = (
  36. (sunOrMoon * 2) //add sunlight
  37. + moonIntensity //add moonlight
  38. - (overcast * 0.2) //remove for cloud state
  39. - (rain * 0.2) //remove for rain state
  40. - (fog * 0.5)); //remove for fog state
  41.  
  42. dayz_scaleLight = _scaleLight;
  43.  
  44. _scaleSound = (1
  45. - (rain * 0.3) //remove for rain state
  46. //+ (fog * 0.3) //add for fog state
  47. )
  48. max 0;
  49.  
  50. if (_scaleLight < 0.9) then {
  51. //Assess if near lightsource
  52. _nearFlare = nearestObject [getPos (vehicle player),"RoadFlare"];
  53. if (!isNull _nearFlare) then {
  54. _scaler = (_nearFlare distance (vehicle player));
  55. if (_scaler <= 30) then {
  56. _scaler = 30 - _scaler;
  57. _scaleLight = ((_scaler / 30) * 2) + _scaleLight;
  58. };
  59. };
  60. _nearFire = nearestObject [getPos (vehicle player),"Land_Fire"];
  61. if (!isNull _nearFire) then {
  62. _scaler = 50 - (_nearFire distance (vehicle player));
  63. _scaleLight = ((_scaler / 50) * 2) + _scaleLight;
  64. };
  65. };
  66.  
  67. //Ensure zero or above
  68. _scaleLight = _scaleLight max 0;
  69.  
  70. //Terrain Visibility
  71. if (["grass",dayz_surfaceType] call fnc_inString) then {
  72. _initial = _initial * 0.75;
  73. _scaleMvmt = _scaleMvmt - 0.05;
  74. } else {
  75. if (["forest",dayz_surfaceType] call fnc_inString) then {
  76. _initial = _initial * 0.5;
  77. _scaleMvmt = _scaleMvmt - 0.1;
  78. } else {
  79. if (["concrete",dayz_surfaceType] call fnc_inString) then {
  80. _initial = _initial * 1.2;
  81. _scaleMvmt = _scaleMvmt + 0.1;
  82. } else {
  83. if (["rock",dayz_surfaceType] call fnc_inString) then {
  84. _initial = _initial * 1.1;
  85. _scaleMvmt = _scaleMvmt + 0.05;
  86. };
  87. };
  88. };
  89. };
  90.  
  91. if (isOnRoad _pos) then {
  92. _initial = _initial * 1.3;
  93. _scaleMvmt = _scaleMvmt + 0.2;
  94. //dayz_surfaceNoise = dayz_surfaceNoise + 10;
  95. };
  96. /*
  97. if (_speed > 5) then {
  98. _speed = _speed * 1;
  99. } else {
  100. if (_speed > 3) then {
  101. _speed = _speed * 0.7;
  102. } else {
  103. _speed = _speed * 0.3;
  104. };
  105. };
  106. */
  107.  
  108. //Are they inside a building
  109. _building = nearestObject [getPos (vehicle player), "Building"];
  110. _isPlayerInside = [(vehicle player),_building] call fnc_isInsideBuilding;
  111. if (_isPlayerInside) then {
  112. _initial = 5;
  113. };
  114.  
  115. //Work out result
  116. _audial = round(_speed * dayz_surfaceNoise * _scaleMvmt * _scaleSound);
  117. if ((_audial > DAYZ_disAudial) or ((time - dayz_firedCooldown) > 0.3)) then {
  118. DAYZ_disAudial = _audial;
  119. };
  120. DAYZ_disVisual = (round((_initial + (_speed * 3)) * _scalePose * _scaleLight)) * 1.5;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement