Author: Rydygier
Author Website:

Requirements: No addons required

Version: update 2

Short description: This extracted from HAC files pack of functions will choose array of up to 100 from 100 randomly chosen spots around sniper position.

Date: 2013-01-16 07:59


Comments: (0)
Rating:



 

Sneaky Finder of Unfair Positions - script for snipers

by
Rydygier


Description:
Recently created a piece of code for next HAC release (probably will be used also for planned guerilla mode), that made me quite happy as performs suprisingly well and can be useful also outside HAC, as another proposition of usage "intersect" commands family combined with selectBestPlaces. So here it is.

This extracted from HAC files pack of functions will choose array of up to 100 (usually less than half of that) from 100 randomly chosen spots around sniper position. For each is calculated LOS check between pos and target pos and elevation/coverage (trees, buildings) values. Then calculates "a quality" for each such positions and returns an array of 2D positions sorted from finest to the worst (but still good). This allows for any mission situation and positions to choose in 90% of cases really sniper-effective positions in the area against given target position - if possible good covered, elevated, and with not disrupted LOS. Often chosen for me positions was not worse, than I would choose by my own... Sometimes not, sometimes some bush or tree may disrupt LOS (for me, maybe for AI not, after all - position passed LOS check provided by introduced in 1.62 for this purpose scripting commands), and sometimes there is not possible to find LOS-proved positions, but even then usual such positions can be considered as reasonable (or at least not so stupid) choose for sniper hideout;


Installation / Usage:
Here is demo mission, see Init.sqf, where is shown in details, how to use this:
Main code is contained in "SnpPos_fnc.sqf".
Syntax:
_positions = [sniper position ATL,target position ATL,"radius" around sniper to search
- in fact searches a square area with size of doubled this value,(optional - default 1)
- multiplier of elevation factor,(optional - default 1)
- multiplier of coverage factor] call RYD_FindOverwatchPos;

Optional parameters may be used for tweaking (not tested yet). The bigger value, the more impact on position's rating will have given factor.

Script will sift-off sea surface positions, if there is no position with not obstructed LOS, instead will return all other positions sorted by its elevation and coverage values.

Target will be marked after search by a flag, red particles (clouds going up) and light source. Player has to his disposal map-click teleport, so can quicly check each of marked positions (the lesser number, the better (according to the script) position). To precise check may be useful temporarily turned off grass (lowest terrain details). Included also secondary functions for debug.


Known issues:
AI likes perform some rope-less bungee jumps from elevated building positions as rooftops...


Changelog:
SFUP demo 2
- slightly tweaked;
- takes into account and favors positions inside buildings (if found any, not so often, as there is no too many good positions inside buildings usual, but demo is set up in manner, that should return some interior positions from time to time. Radius for house search (50) perhaps can be wider);
- player is moved to the first position (will be in the building, if possible);
- couple of bonus functions, that allow with some (un)comments use same demo for test, where enemy sniper is created and placed using SFUP. Its position can be marked in 3D, also can be displayed his actual knowledge about player.


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Position,   Sniper