VN_ms_fnc_tracker_receiveNoise

From Savage Game Design Wiki
Revision as of 21:21, 20 January 2021 by Lou Montana (talk | contribs) (Text replacement - "]]; |p1n=" to "]] |p1n=")
Jump to navigation Jump to search
← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Wyqer, veteran29
Argument(s): n/a
Effect(s): unknown

Description

/*
    Author: Wyqer, veteran29
    Date: 2019-08-10

    Description:
        Handle client generated noise.

    Parameter(s):
        _shooter    - Unit that made the noise  [OBJECT, defaults to objNull]
        _distance   - Hearable noise distance   [NUMBER, defaults to 0]

    Returns:
        Function reached the end [BOOL]
*/
params [
    ["_shooter", objNull, [objNull]],
    ["_distance", 100, [0]]
];

private _nearbyUnits = allUnits inAreaArray [getPos _shooter, _distance, _distance];
private _nearbyGroups = _nearbyUnits apply {group _x};

{
    // we can consider moving AIs on top of heard shot,
    // would need a exclude for static sentries (eg. on trees)
    // units _x doMove position _shooter;

    // we can consider something more complex here,
    // current tests show that even giving little info about player makes AI a lot more aggresive
    [_x, [_shooter, 0.01]] remoteExec ["reveal", _x];
} forEach (_nearbyGroups arrayIntersect _nearbyGroups);

#ifdef VN_DEBUG
    systemChat format ["[Tracker] Noise propagated: %1, %2", _shooter, _distance];
#endif

true
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)

Syntax

Syntax
[] call vn_ms_fnc_tracker_receiveNoise
Return value
Nothing

Examples

Example 1
-