OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Luke on 24 Dec 2008, 05:07:47
-
How does one go about grabbing a designator's laser target and saving it as a variable/in an array?
Or am I a dog just chasing the laser pointer dot? :D :P
Luke
-
Use nearObjects to detect objects of types "LaserTargetC", "LaserTargetE" or "LaserTargetW".
-
In my idiocy I still can get it to work,\.
two things:
Can you search for just "LaserTarget" without a side?
and
Can someone give a script for my to do this?
I cant make it work for the life of me. :weeping:
Luke
-
try something like:
init.sqf
LaserCheck =
{
private ["_laserPos"];
_source = _this select 0;
_weapon = _this select 1;
_ammo = _this select 4;
if (_weapon == "Laserdesignator") then
{
LaserTarget = objNull;
_laser = nearestObject [_source, _ammo];
while {!isNull _laser} do
{
_laserPos = getPos _laser;
Sleep 0.001;
};
_targets = nearestObjects [_laserPos, ["LaserTargetC", "LaserTargetE" , "LaserTargetW"], 1.5];
_target = _targets select 0;
LaserTarget = _target;
//Now you can use LaserTarget in other scripts or stuff
hint format ["%1",LaserTarget];
};
};
player addEventHandler ["Fired", {_this spawn LaserCheck}];