Update player_checkStealth.sqf

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-05-16 09:25:14 +02:00
parent 989e918821
commit 1de402185a

View File

@@ -1,30 +1,31 @@
private["_vel","_speed","_pos","_isPZombie","_anim","_anim4","_scaleSound","_nearFlare","_scaler","_nearLight","_nearFire","_building","_isPlayerInside","_audial"]; if (player isKindOf "PZombie_VB") exitWith {
_vel = velocity (vehicle player);
_speed = (_vel distance [0,0,0]);
_pos = getPosATL player;
_scalePose = 0.9;
_scaleMvmt = 0.2; //0.4;
_scaleLight = 0.5;
//_scaleAlert = 1;
_isPZombie = player isKindOf "PZombie_VB";
if (_isPZombie) exitWith {
DAYZ_disAudial = 0; DAYZ_disAudial = 0;
DAYZ_disVisual = 0; DAYZ_disVisual = 0;
player_zombieAttack = {}; // Other zombies don't attack player zombies player_zombieAttack = {}; // Other zombies don't attack player zombies
player_zombieCheck = {}; player_zombieCheck = {};
}; };
//Assess Players Position ///////////////////////////////////////////////////////////////////////////////////////////////////
_anim = animationState player;
_anim4 = toArray _anim; local _vp = vehicle player;
local _speed = (velocity _vp) distance [0,0,0];
local _scalePose = 0.9;
local _scaleMvmt = 0.2; //0.4;
///////////////////////////////////////////////////////////////////////////////////////////////////
// Assess Players Position
local _anim = animationState player;
local _anim4 = toArray _anim;
_anim4 resize 4; _anim4 resize 4;
_anim4 = toString _anim4; _anim4 = toString _anim4;
if (["pknl",_anim] call fnc_inString) then { if (["pknl",_anim] call fnc_inString) then { // kneeling
_scaleMvmt = 0.2; //0.1; _scaleMvmt = 0.2; //0.1;
_scalePose = 0.6; //0.4 _scalePose = 0.6; //0.4
} else { } else {
if (["ppne",_anim] call fnc_inString) then { if (["ppne",_anim] call fnc_inString) then { // prone
_scaleMvmt = 0.3; _scaleMvmt = 0.3;
_scalePose = 0.14; _scalePose = 0.14;
}; };
@@ -37,96 +38,107 @@ if (_anim4 == "aswm") then {
dayz_isSwimming = false; dayz_isSwimming = false;
}; };
_initial = 20 + (sunOrMoon * 20); ///////////////////////////////////////////////////////////////////////////////////////////////////
_scaleLight = ( local _initial = 20 + (sunOrMoon * 20);
(sunOrMoon * 2) //add sunlight
+ moonIntensity //add moonlight
- (overcast * 0.2) //remove for cloud state
- (rain * 0.2) //remove for rain state
- (fog * 0.5)); //remove for fog state
local _scaleLight = (
(sunOrMoon * 2) // add sunlight
+ moonIntensity // add moonlight
- (overcast * 0.2) // remove for cloud state
- (rain * 0.2) // remove for rain state
- (fog * 0.5) // remove for fog state
);
dayz_scaleLight = _scaleLight; dayz_scaleLight = _scaleLight;
_scaleSound = (1 local _scaleSound = (
- (rain * 0.3) //remove for rain state 1
//+ (fog * 0.3) //add for fog state - (rain * 0.3) // remove for rain state
) ) max 0;
max 0;
///////////////////////////////////////////////////////////////////////////////////////////////////
// Assess if near light source
if (_scaleLight < 0.9) then { if (_scaleLight < 0.9) then {
//Assess if near lightsource local _scaler = 0;
_nearFlare = nearestObject [getPosATL (vehicle player),"RoadFlare"]; local _nearFlare = nearestObject [getPosATL _vp,"RoadFlare"];
if (!isNull _nearFlare) then { if (!isNull _nearFlare) then {
_scaler = (_nearFlare distance (vehicle player)); _scaler = (_nearFlare distance _vp);
if (_scaler <= 30) then { if (_scaler <= 30) then {
_scaler = 30 - _scaler; _scaler = 30 - _scaler;
_scaleLight = ((_scaler / 30) * 2) + _scaleLight; _scaleLight = ((_scaler / 30) * 2) + _scaleLight;
}; };
}; };
_nearLight = nearestObject [(vehicle player),"StreetLamp"];
//if (!isNull _nearLight && (lightIsOn _nearLight == "ON")) then { local _nearLight = nearestObject [_vp,"StreetLamp"];
if (!isNull _nearLight) then { if (!isNull _nearLight) then {
_scaler = 50 - (_nearLight distance (vehicle player)); _scaler = 50 - (_nearLight distance _vp);
_scaleLight = ((_scaler / 50) * 2) + _scaleLight; _scaleLight = ((_scaler / 50) * 2) + _scaleLight;
}; };
_nearFire = nearestObject [getPosATL (vehicle player),"Land_Fire"];
local _nearFire = nearestObject [getPosATL _vp,"Land_Fire"];
if (!isNull _nearFire) then { if (!isNull _nearFire) then {
_scaler = 50 - (_nearFire distance (vehicle player)); _scaler = 50 - (_nearFire distance _vp);
_scaleLight = ((_scaler / 50) * 2) + _scaleLight; _scaleLight = ((_scaler / 50) * 2) + _scaleLight;
}; };
}; };
//Ensure zero or above _scaleLight = _scaleLight max 0; // Ensure zero or above
_scaleLight = _scaleLight max 0;
//Terrain Visibility ///////////////////////////////////////////////////////////////////////////////////////////////////
if (["grass",dayz_surfaceType] call fnc_inString) then {
_initial = _initial * 0.65; //0.75 // Terrain Visibility
_scaleMvmt = _scaleMvmt - 0.05;
} else { call {
if (["forest",dayz_surfaceType] call fnc_inString) then { if (["grass",dayz_surfaceType] call fnc_inString) exitWith {
_initial = _initial * 0.65;
_scaleMvmt = _scaleMvmt - 0.05;
};
if (["forest",dayz_surfaceType] call fnc_inString) exitWith {
_initial = _initial * 0.5; _initial = _initial * 0.5;
_scaleMvmt = _scaleMvmt - 0.1; _scaleMvmt = _scaleMvmt - 0.1;
} else { };
if (["concrete",dayz_surfaceType] call fnc_inString) then { if (["concrete",dayz_surfaceType] call fnc_inString) exitWith {
_initial = _initial * 0.85; //1.2 _initial = _initial * 0.85;
_scaleMvmt = _scaleMvmt + 0.1; _scaleMvmt = _scaleMvmt + 0.1;
} else { };
if (["rock",dayz_surfaceType] call fnc_inString) then { if (["rock",dayz_surfaceType] call fnc_inString) exitWith {
_initial = _initial * 0.80; //1.1 _initial = _initial * 0.80;
_scaleMvmt = _scaleMvmt + 0.05; _scaleMvmt = _scaleMvmt + 0.05;
};
};
}; };
}; };
if (isOnRoad _pos) then { ///////////////////////////////////////////////////////////////////////////////////////////////////
if (isOnRoad (getPosATL player)) then {
_initial = _initial * 1.3; _initial = _initial * 1.3;
_scaleMvmt = _scaleMvmt + 0.2; _scaleMvmt = _scaleMvmt + 0.2;
//dayz_surfaceNoise = dayz_surfaceNoise + 10;
}; };
/*
if (_speed > 5) then { ///////////////////////////////////////////////////////////////////////////////////////////////////
_speed = _speed * 1;
// Are they inside a building
dayz_inside = [vehicle player] call fnc_isInsideBuilding;
if (dayz_inside) then {
_initial = round (5 + (20 * (1 - DZE_sheltered))); // inside building
} else { } else {
if (_speed > 3) then { if (DZE_sheltered > 0.75) then {
_speed = _speed * 0.7; _initial = round (5 + (60 * (1 - DZE_sheltered))); // possibly inside base or sheltered by other objects
} else {
_speed = _speed * 0.3;
}; };
}; };
*/
//Are they inside a building ///////////////////////////////////////////////////////////////////////////////////////////////////
dayz_inside = [(vehicle player)] call fnc_isInsideBuilding;
if (dayz_inside) then { // Work out result
_initial = 5;
}; local _audial = round (_speed * dayz_surfaceNoise * _scaleMvmt * _scaleSound);
//Work out result
_audial = round(_speed * dayz_surfaceNoise * _scaleMvmt * _scaleSound);
if ((_audial > DAYZ_disAudial) or ((time - dayz_firedCooldown) > 0.3)) then { if ((_audial > DAYZ_disAudial) or ((time - dayz_firedCooldown) > 0.3)) then {
DAYZ_disAudial = _audial; DAYZ_disAudial = _audial;
}; };
DAYZ_disVisual = (round((_initial + (_speed * 3)) * _scalePose * _scaleLight)) * 1.5; DAYZ_disVisual = (round ((_initial + (_speed * 3)) * _scalePose * _scaleLight)) * 1.5;