Difference between revisions of "VN ms fnc tracker getHiddenPos"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - " {{Function" to "Category:TODO {{Function")
(Page filling)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:TODO]]
 
 
{{Function
 
{{Function
  
Line 6: Line 5:
 
|author= Wyqer, veteran29
 
|author= Wyqer, veteran29
  
|a=
+
|a= global
  
 
|e=
 
|e=
Line 12: Line 11:
 
|g1= tracker
 
|g1= tracker
  
|d= <pre>/*
+
|d= Search for hidden postion around target position.
    File: fn_tracker_getHiddenPos.sqf
 
    Author: Wyqer, veteran29
 
    Date: 2019-12-04
 
    Last Update: 2020-11-13
 
    Public: Yes
 
  
    Description:
+
|s= [pos, minDistance] call [[VN_ms_fnc_tracker_getHiddenPos]]
        Search for hidden postion around target position.
 
  
    Parameter(s):
+
|p1n= pos
        _target      - Target position                          [ARRAY or STRING, defaults to nil]
+
|p1t= {{Biki|String}} or {{Biki|Position}} or {{Biki|Object}}
        _minDistance - Wanted position distance from target pos [NUMBER, defaults to nil]
+
|p1d= target position
 
 
    Example:
 
        [getPos player, 150] call vn_ms_fnc_tracker_getHiddenPos;
 
 
 
    Returns:
 
        Found position [ARRAY]
 
*/
 
#define SEARCH_RADIUS  50
 
 
 
params ["_target", "_minDistance"];
 
 
 
if (isNil "_target" || isNil "_minDistance") exitWith {
 
    (format ["[VN] Invalid parameters, _target - %1, _minDistance - %2", _target, _minDistance]) call BIS_fnc_error;
 
    false
 
};
 
 
 
if (_target isEqualType "") then {
 
    _target = markerPos _target;
 
};
 
 
 
private _spawnPos = [];
 
waitUntil {
 
    sleep 1;
 
    private _spawns = selectBestPlaces [
 
        _target getPos [_minDistance + SEARCH_RADIUS, random 360],
 
        SEARCH_RADIUS,    //radius
 
        "forest + (1 - meadow)",
 
        50,    // precision
 
        10      // count
 
    ];
 
 
 
    _spawnPos = (selectRandom _spawns) param [0, []];
 
 
 
    private _msg = format ["[VN] Searching for hidden pos - %1, tgt - %2", _spawnPos, _target];
 
    diag_log text _msg;
 
    #ifdef VN_DEBUG
 
        systemChat _msg;
 
    #endif
 
 
 
    // return
 
    !(_spawnPos isEqualTo []) && {
 
        !([allPlayers, _spawnPos] call vn_ms_fnc_tracker_positionVisible)
 
        && !surfaceIsWater _spawnPos
 
    }
 
};
 
 
 
_spawnPos
 
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
 
 
 
|s= [] call [[vn_ms_fnc_tracker_getHiddenPos]];
 
 
 
|p1n=
 
|p1t=
 
|p1d=
 
 
|p1v=
 
|p1v=
  
|p2n=
+
|p2n= minDistance
|p2t=
+
|p2t= number
|p2d=
+
|p2d= distance from ''pos''
 
|p2v=
 
|p2v=
  
|r1t=
+
|r1t= position
|r1d=
+
|r1d= found position
  
|x1= <code>-</code>
+
|x1= <code>[getPos player, 150] call [[VN_ms_fnc_tracker_getHiddenPos]];</code>
 
}}
 
}}

Latest revision as of 15:38, 26 February 2021

← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Wyqer, veteran29
Argument(s): global
Effect(s): unknown

Description

Search for hidden postion around target position.

Syntax

Syntax
[pos, minDistance] call VN_ms_fnc_tracker_getHiddenPos
Parameters
pos: String or Position or Object - target position
minDistance: Number - distance from pos
Return value
Position - found position

Examples

Example 1
[getPos player, 150] call VN_ms_fnc_tracker_getHiddenPos;