Jump to content
Sign in to follow this  
thegunnysgt

Laser designator to control a marker

Recommended Posts

How can I designate targets via the Laser Designator to control a markers position to be moved to where the Designator is designating a target. Say I "fire" it as a building and I want a maker to be moved to that building? How can this be possible? Is this possible?

Share this post


Link to post
Share on other sites

It would be possible.

The laser designator creates an object of class "laserSomething" where it's beam hits (sorry, can't remember the class. Check the BI wiki or search these forums).

You can find and refer to the object using one of the nearestObject commands (check wiki for the exact command).

You can then set the marker position to the position of the laser object.

Repeat...

When the laser object is not found, you can either destroy the marker or leave it in it's last position.

Sorry, can't help much now, me tired.. goodnight.gif

Share this post


Link to post
Share on other sites

I know the Laser Marker is called "Laserdesignator", but you say there is a "Laser???" that refers to its target? Thank you I will look for that object class.

Update

I have looked for that object class and have not found any reference to it? Do you remember anything more about it?

thanks.

Share this post


Link to post
Share on other sites

http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?act=ST;f=71;t=61406;hl=laser+and+object

class "laserTarget" is the generic parent class.

class "laserTargetW" is the laser object created by blu/west units (the object is actually on East side)

class "laserTargetE" is the laser object created by opfor/east units (the object is actually on West side)

class "laserTargetC" is the laser object created by civilian/independent/guerilla units (the object is actually on civ side???)

All this info is defined in the game's configs - they make good reference material. Off to work... smile_o.gif

Share this post


Link to post
Share on other sites

Can you explain what you mean by "the object is actually on Ease side"?

Thanks for helping by the way!

Right now I have onmapsingleclick to move the marker, I have read the post you gave me and don't quite understand fully what I need to do? Can you help clarify some of this? Thank you again.

Share this post


Link to post
Share on other sites

The easiest way is to create a trigger that covers the entire map, set to detect anybody (or perhaps OPFOR). Call it MyTrigger.

Then run this script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Target=ObjNull;

WaitUntil

       {

       //Wait until a target it created

       WaitUntil

               {

               _List=List MyTrigger;

               {If ((_TypeOf _x)=="laserTargetW") Then {_Target=_x}} ForEach _List;

             

               !(IsNull _Target)

               };

       //Update marker position here

       //Wait until the designator is turned off        

       WaitUntil

               {

               IsNull _Target

               };

       //Update marker position here

       //Repeat unless the Player (guy carrying the designator?) is killed

       !(Alive Player)

       };

Of course the above code only covers one laser target per mission for side west. Like I said, it's just a simple example.

Quote[/b] ]Can you explain what you mean by "the object is actually on Ease side"?

The laser target created by a unit on side west, is set to hostile (side east) so other west units will attack it.

Share this post


Link to post
Share on other sites

I know this seems a little bit crude, but I tried to piece the code together and I am just missing something or I just simply out of my league. Can you help? It give me an error.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

player sideChat "Awaiting Target Coordinates..."

#Wait

"wTarget" setMarkerPos (getPos player nearObjects ["laserTargetW",5000])

?((getMarkerPos "wTarget") == (getPos player nearObjects ["laserTargetW",5000])): goto "Ready"

goto "Wait"

#Ready

player sideChat "Acquiring Target Corrdinates Now. Standby..."

~10

"wTarget" setMarkerPos (getPos player nearObjects ["laserTargetW",5000])

player sideChat "Target Coordinates Acquired. Ready to Fire."

Basically here is what I want to happen:

** When the artillery is called via radio, I want it to wait until the Laser Designator is activated and once it is activated (that is what "Awaiting Target Coordinates..." is for). Then it will say "Acquiring Target Coordinates Now. Standby...".

**Then once that time goes by, the marker needs to be moved to the designated target.

** As it says "Target Coordinates Acquired" I want it to say "Target Coordinates Acquired at [position of target]"

I know it sounds complicated and I explained it as clear as I could, hope you can understand what I would like. Thanks for the help.

Update

I think I may have something:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_tpos = position ((position player nearObjects ["LaserTarget", 1000]) select 0)

_x=_tpos select 0

_y=_tpos select 1

wTarget setPos _tpos

I need a line of code that will check the current position of wTarget against the position of _tpos and if they are the same then proceed with the rest of the script. If they are not the same then this portion of the script will just repeat until the two positions are the same.

Share this post


Link to post
Share on other sites

Anyone have any thoughts on what could be the issue with this section of code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#Wait

_tpos = position ((position player nearObjects ["LaserTarget", 1000]) select 0);

wTarget setPos _tpos

if ((getMarkerPos "wTarget") == (position ((position player nearObjects ["LaserTarget", 1000]) select 0)) then {goto "Ready"};

goto "Wait"

Any help would be appreciated. Also, how can a position be written into the sideChat command. Say the position of wTarget when it gets set.

Update

Got it to work using the following:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_pos = getpos ((getpos player nearObjects ["LaserTarget", 1000]) select 0)

wTarget setpos _pos

if ((((getpos wTarget) select 0) == ( _pos select 0)) and (((getpos wTarget) select 1) == ( _pos select 1))) then {goto "Ready"}

goto "Wait"

It basically sets the position of wTarget when the Laser Designator targets the object you want. Then it checks if the position of wTarget has moved to the position that you targeted. If not then it just continues to wait until the position is correct of the Laser Designator's target.

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  

×