Jump to content
Sign in to follow this  
lawndartleo

laser marked target marker

Recommended Posts

I'm looking at https://community.bistudio.com/wiki/laserTarget and trying to determine of it can be used to create a script that spawns a marker on the map where a player (multiplayer) has a target lased. If it could be done I'd have thought it would have by now but... maybe I had an riginal thought for once. I've been searching for a while and come up empty.

Share this post


Link to post
Share on other sites

A little example

api_MarcarLaserDesignator = {
_param = _this;
_uav = _param select 0;

_position = position _uav;
_xt = nearestobjects [position player,["LaserTarget"],6000];

if (! ( name_makergloball=="")) then
{
	deleteMarker name_makergloball;
};

{
	_position =  _x;

	name_makergloball = format["laserpoint_%1", _position];
	_marker = createmarker[name_makergloball, _position];
	_marker setmarkeralpha 1;
	_marker setmarkershape "ICON";
	_marker setmarkercolor "ColorRed";
	_marker setmarkertype "selector_selectedEnemy";
	_marker setMarkerText "";

} foreach _xt;



};

Share this post


Link to post
Share on other sites

Or a trigger version:

- Create a trigger with REPEATEDLY condition.

- in CONDITION row put (LaserTargetE for OPFOR units):

count (allMissionObjects "LaserTargetW") > 0

- in ON ACT. row put:

nul=[] spawn { if (isNil "laserMarker") then {laserMarker = ""}; if !(laserMarker=="") then {deleteMarker laserMarker}; laserMarker = format["laserpoint_%1", position ((allMissionObjects 'LaserTargetW') select 0)]; _m = createMarker [laserMarker, position ((allMissionObjects 'LaserTargetW') select 0)]; _m setmarkeralpha 1; _m setmarkershape "ICON"; _m setmarkercolor "ColorRed"; _m setmarkertype "selector_selectedEnemy"; _m setMarkerText ""; };

  • Like 1

Share this post


Link to post
Share on other sites

I'm working on a mod that will place a map marker on an observed position using a laser designator or rangefinder. When you're looking through either one of these optics, you can press a hot-key that will mark the map. It also provides precise (i.e. 5-digit) easting and northing coordinates of the observed position on the display of the optic so you can call in an artillery strike or air strike verbally without opening your map.

Here's a sneak preview of the image.. The arrows up top are added in photoshop afterward... don't mind them.

-Zehn

Share this post


Link to post
Share on other sites

Thank you, Buli. Very simple and effective. Question... my understanding of scripting says that the marker should only be on when something is lased but it is a permanent marker until something else is designated. Am I reading the script wrong?

Looks very cool, Zehn

Share this post


Link to post
Share on other sites

The marker is on as long as you mark the next target. If you want a marker on every target you mark you have to create a dynamic variable instead of "laserMarker".

Share this post


Link to post
Share on other sites

I think we are saying the same thing.... not multiple target marks.... when does the mark disappear? Currently the mark stays until another target is lased but my interpretation of the script is that it should disappear if the laser is no longer marking.

Trying to determine where I might add a sleep command so that after 30 seconds or so the marker is deleted.

Share this post


Link to post
Share on other sites

ah ok.. misunderstood.. if you want to have the marker deleted when you turn off the laser, then put in the ON DEACT. row:

deleteMarker laserMarker

But you can also put a script in the ON DEACT. row and add a timer to delete the marker after deactivation of laser:

nul=[] spawn { sleep 30;  deleteMarker laserMarker};

Share this post


Link to post
Share on other sites

Thanks Buli. I was putting that exact code at the end of the activation script... sleep and then delete... but that was just me being a dope.

Duh! Deactivation... sometimes I miss the easiest stuff.

Share this post


Link to post
Share on other sites

Hey Buli,

Working as advertised. One oddity, however. We always see multiples of the icon on the map. During proofing of the mission I see one icon. If I am in our dedicated MP server alone, one icon. As soon as more people join, we get multiple icons, pretty much all stacked up on each other. Doesn't affect functionality, just looks a little funny. Sure makes targeting arty easier.

Share this post


Link to post
Share on other sites

For multiplayer use add following in CONDITION row:

isServer and count (allMissionObjects "LaserTargetW") > 0

  • Like 1

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  

×