Example Code: Reveal Units Temporarily: Difference between revisions
Jump to navigation
Jump to search
m (typo) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{GVI|arma3|1.92}} | {{GVI|arma3|1.92}} | ||
< | <sqf> | ||
/* | |||
Author: Revo | Author: Revo | ||
Line 13: | Line 14: | ||
*/ | */ | ||
// | // replace here | ||
#define CENTER player // | #define CENTER player // the area around this object will be scanned | ||
#define RADIUS 100 | #define RADIUS 100 // radius of the area | ||
#define DELETE_TIME 5 // | #define DELETE_TIME 5 // how long will the units be revealed in seconds | ||
#define TOLERANCE 5 | #define TOLERANCE 5 // accuracy of the units positions in meters | ||
#define DELAY 1 | #define DELAY 1 // delay in between reveal of units in seconds (60 units take 60 seconds to show) | ||
// | // replace end | ||
[CENTER,RADIUS,DELETE_TIME,TOLERANCE] spawn | [CENTER, RADIUS, DELETE_TIME, TOLERANCE, DELAY] spawn | ||
{ | { | ||
params ["_center","_radius","_deleteTime","_tolerance"]; | params ["_center", "_radius", "_deleteTime", "_tolerance", "_delay"]; | ||
_nearestUnits = nearestObjects [_center, ["CAManBase"], _radius]; | private _nearestUnits = nearestObjects [_center, ["CAManBase"], _radius]; | ||
systemChat "Scanning in progress..."; | systemChat "Scanning in progress..."; | ||
Line 30: | Line 31: | ||
createMarker ["areaBorderTemp", _center]; | createMarker ["areaBorderTemp", _center]; | ||
"areaBorderTemp" setMarkerShape "ELLIPSE"; | "areaBorderTemp" setMarkerShape "ELLIPSE"; | ||
"areaBorderTemp" setMarkerSize [_radius,_radius]; | "areaBorderTemp" setMarkerSize [_radius, _radius]; | ||
"areaBorderTemp" setMarkerBrush "Border"; | "areaBorderTemp" setMarkerBrush "Border"; | ||
{ | { | ||
_marker = createMarker [format ["tempMarker_%1",_forEachIndex],_x getPos [_tolerance,random 360]]; | private _marker = createMarker [format ["tempMarker_%1", _forEachIndex], _x getPos [_tolerance, random 360]]; | ||
_marker setMarkerType "o_unknown"; | _marker setMarkerType "o_unknown"; | ||
_marker setMarkerColor "ColorUNKNOWN"; | _marker setMarkerColor "ColorUNKNOWN"; | ||
_marker setMarkerSize [0.5,0.5]; | _marker setMarkerSize [0.5, 0.5]; | ||
sleep | sleep _delay; | ||
} forEach _nearestUnits; | } forEach _nearestUnits; | ||
systemChat format ["%1 entities found.",count _nearestUnits]; | systemChat format ["%1 entities found.", count _nearestUnits]; | ||
systemChat format ["Position tolerance: %1 m",_tolerance]; | systemChat format ["Position tolerance: %1 m", _tolerance]; | ||
sleep _deleteTime; | sleep _deleteTime; | ||
Line 48: | Line 49: | ||
for "_i" from 0 to (count _nearestUnits) - 1 do | for "_i" from 0 to (count _nearestUnits) - 1 do | ||
{ | { | ||
deleteMarker format ["tempMarker_%1",_i]; | deleteMarker format ["tempMarker_%1", _i]; | ||
sleep | sleep _delay; | ||
}; | }; | ||
Line 55: | Line 56: | ||
}; | }; | ||
true</ | true; | ||
</sqf> | |||
[[Category: Example Code]] | [[Category: Example Code]] |
Latest revision as of 22:18, 20 August 2022
/*
Author: Revo
Description:
Reveals units in a defined area temporarily.
Parameter(s):
See defines below
Returns:
BOOLEAN - true
*/
// replace here
#define CENTER player // the area around this object will be scanned
#define RADIUS 100 // radius of the area
#define DELETE_TIME 5 // how long will the units be revealed in seconds
#define TOLERANCE 5 // accuracy of the units positions in meters
#define DELAY 1 // delay in between reveal of units in seconds (60 units take 60 seconds to show)
// replace end
[CENTER, RADIUS, DELETE_TIME, TOLERANCE, DELAY] spawn
{
params ["_center", "_radius", "_deleteTime", "_tolerance", "_delay"];
private _nearestUnits = nearestObjects [_center, ["CAManBase"], _radius];
systemChat "Scanning in progress...";
createMarker ["areaBorderTemp", _center];
"areaBorderTemp" setMarkerShape "ELLIPSE";
"areaBorderTemp" setMarkerSize [_radius, _radius];
"areaBorderTemp" setMarkerBrush "Border";
{
private _marker = createMarker [format ["tempMarker_%1", _forEachIndex], _x getPos [_tolerance, random 360]];
_marker setMarkerType "o_unknown";
_marker setMarkerColor "ColorUNKNOWN";
_marker setMarkerSize [0.5, 0.5];
sleep _delay;
} forEach _nearestUnits;
systemChat format ["%1 entities found.", count _nearestUnits];
systemChat format ["Position tolerance: %1 m", _tolerance];
sleep _deleteTime;
for "_i" from 0 to (count _nearestUnits) - 1 do
{
deleteMarker format ["tempMarker_%1", _i];
sleep _delay;
};
deleteMarker "areaBorderTemp";
};
true;