Jump to content
Sign in to follow this  

Script Target laser

Recommended Posts

based on the


in spanish, https://www.ffaamod.es/wiki/Script_Target_laser_v2



The script simulates a laser pointer, a trigger that includes the targets to eliminate, marking the units one by one with a laser marker. Eliminate one goal marks the next, up to a maximum of 10 targets.

It also works with groups.

The weapons that work with the scrpt are the maverick laser, LJDAM, GBU, EGBU. I have not tested it with OPFORCE weapons

It consists of two scripts that should go in the mission folder:

- The script that marks the targets as laser targets: Target_LASER_V2.sqf

- The script that checks for enemy units live and that is invoked from the previous script: findLiveGroundTarget.sqf


The variables are from the script, [thislist, time] execVM "Target_LASER_V2.sqf"; are:

 thislist, check enemy targets in the trigger.
 time, check time it takes to review a new objective.  By default 1, it can be increased to increase the testing times between eliminated targets.


Syntax / Code / Explanation:
In a zone of the map there is a trigger that encompasses the objective units, in the trigger it should be:

as activator: OPFOR

Type of activation: PRESENT

When activated: script = [thislist, 1] execVM "Target_LASER_V2.sqf";

In the mission folder, you should put the two script:








/ Then in your trigger's on act put this:
// script = [thislist, 1] execVM "Target_LASER_V2.sqf";
_targetArray = _this select 0;
_shellTravelTime = _this select 1;

_lazer = 0;

_tgtScript = [_targetArray] execVM "findLiveGroundTarget.sqf";

waitUntil {scriptDone _tgtScript};

_target = liveGroundTarget;

if (! isNull _target) then {

_idx = 0;

_shellCount = 10;

while {(_idx <_shellCount)} do {

_isAlive = alive _target;

if (! _ isAlive) then {
// Target is dead, find another
        deletemarker "laserMarker";
        deleteVehicle _lazer;
_idx = _shellCount;
script = [_targetArray, _shellTravelTime] execVM "Target_LASER_V2.sqf";

} else {


_targer_marker = createMarker ["laserMarker", [0,0,0]];
_targer_marker setMarkerColor "ColorYellow";
_targer_marker setMarkerShape "icon";
_targer_marker setMarkerSize [1,1];
_targer_marker setMarkerType "mil_destroy"; 
_targer_marker setMarkerText "LASER TGT POS";
_lazer = "LaserTargetW" createVehicle position _target;
_lazer attachto [_target, [0,0,1]];
 _targer_marker setMarkerPos getpos _target;
 sleep _shellTravelTime;



_idx = _idx + 1;




// The original script above works fine, but I've refined it and made it a little "smarter".
// This script will:
// Fire on any enemy ground unit (set in the trigger) that strays into it's target area.
// Re-adjust it's aim before each shot.
// Does not fire at aircraft.
// Acquire a new target if the current target is dead.
// Allows for shell transit time before checking if the target is still alive and re-adjusting aim.
// This is a little more complicated than the one above, but it makes for smarter AI artillery.
// There is a new variable you'll pass in from the trigger for shell transit time. What is the force of the artillery piece to wait for the shell to arrive at the target before checking to see if it's still alive. You'll need to tinker around with this number to get it right for the range and artillery piece. Or just set it to one second and let it fire immediately after it // reloads like before.
// This involves 2 scripts. I wanted to break the functionality for finding live ground targets into another script so it could be used for mortars (or anything else).
// This one I called "findLiveGroundTarget.sqf" "

// nul = [thislist] execVM "findLiveGroundTarget.sqf";

// script = [thislist] execVM "findLiveGroundTarget.sqf";

_targetArray = _this select 0;

// Reset the global variable to null
// to make sure we start fresh every check.
liveGroundTarget = objNull;
_idx = 0;
_targetCount = count _targetArray;

while {(_idx <_targetCount)} do {
 _someTarget = _targetArray select _idx;
 _isAlive = alive _someTarget;

  if (isTouchingGround _someTarget && _isAlive) then {
  // live ground target found, get out of the loop
  liveGroundTarget = _someTarget;
  _idx = _targetCount;

  _idx = _idx +1;


Edited by AtomicBoy

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this