Example Code: Reveal Units Temporarily: Difference between revisions
Jump to navigation
Jump to search
m (description) |
m (added template) |
||
Line 5: | Line 5: | ||
Description: | Description: | ||
Reveals units in a defined area temporarily | Reveals units in a defined area temporarily. | ||
Parameter(s): | Parameter(s): | ||
Line 14: | Line 14: | ||
//Replace here | //Replace here | ||
#define CENTER player | #define CENTER player {{cc|The area around this object will be scanned}} | ||
#define RADIUS 100 | #define RADIUS 100 {{cc|Radius of the area}} | ||
#define DELETE_TIME 5 | #define DELETE_TIME 5 {{cc|How long will the units be revealed in seconds}} | ||
#define TOLERANCE 5 | #define TOLERANCE 5 {{cc|Accuracy of the units positions in meters}} | ||
#define DELAY 1 {{cc|Delay in between reveal of units in seconds (60 units take 60 seconds to show) }} | |||
//Replace end | //Replace end | ||
Line 37: | Line 38: | ||
_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; | ||
Line 48: | Line 49: | ||
{ | { | ||
deleteMarker format ["tempMarker_%1",_i]; | deleteMarker format ["tempMarker_%1",_i]; | ||
sleep | sleep DELAY; | ||
}; | }; | ||
Revision as of 01:59, 18 August 2019
/*
Author: Revo
Description:
Reveals units in a defined area temporarily.
Parameter(s):
See defines below
Returns:
BOOLEAN - true
*/
//Replace here
#define CENTER player {{cc|The area around this object will be scanned}}
#define RADIUS 100 {{cc|Radius of the area}}
#define DELETE_TIME 5 {{cc|How long will the units be revealed in seconds}}
#define TOLERANCE 5 {{cc|Accuracy of the units positions in meters}}
#define DELAY 1 {{cc|Delay in between reveal of units in seconds (60 units take 60 seconds to show) }}
//Replace end
[CENTER,RADIUS,DELETE_TIME,TOLERANCE] spawn
{
params ["_center","_radius","_deleteTime","_tolerance"];
_nearestUnits = nearestObjects [_center, ["man"], _radius];
systemChat "Scanning in progress...";
createMarker ["areaBorderTemp", _center];
"areaBorderTemp" setMarkerShape "ELLIPSE";
"areaBorderTemp" setMarkerSize [_radius,_radius];
"areaBorderTemp" setMarkerBrush "Border";
{
_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