Jump to content
Sign in to follow this  
thedarkbird

Lasertarget bombing script (working) - Improvement needed

Recommended Posts

The goal is to destroy all buildings of a base by lasing every building nearby. It works, however, the weak point is the laserpointer height: if it's located in a building (instead of on top), the bomber aircraft can't see it and it doesn't work.

So basically it would be necessary to place the laser exactly on top of buildings...

hideObject baselocation; //Hide base object
hideObject marker;	//Hide marker object
while {(getPos baselocation) distance (getPos marker) < 100} do //Only take out buildings near the baselocation object
{
_building = nearestBuilding baselocation; //Select the nearest building
marker setPos (getPos _building); //Move the marker object to that building
_lase = "LaserTargetW" createVehicle [getpos marker select 0, getPos marker select 1, 0]; //Make a laser
_lase attachTo [marker, [0,0,3]]; //Attach the laser to the marker object, but 3 units higher ([b]WEAK POINT[/b])
 waitUntil {!alive _building}; //Let air vehicles bomb it to pieces
 deleteVehicle _lase; //When destroyed delete the laser 
 //Rinse and repeat
};
hint "Done lasing";

Suggestions for improvement?

Edited by thedarkbird

Share this post


Link to post
Share on other sites

You can try this, (got the idea from another thread about soldiers on roof tops):

laserm setpos _laserpos;

laserm setPosATL [getPos laserm select 0,getPos laserm select 1,30];

laserm setPosATL [getPos laserm select 0,getPos laserm select 1,(getPosATL laserm select 2)-(getPos laserm select 2)];

This will more or less place the object to which you've attached the marker directly on the first point of contact down from 30 meters. (I assume most buildings in A2 are under 30 meters but there are some exceptions like mosques in OA etc. So adjust as you see fit.

Share this post


Link to post
Share on other sites

The laser must be visible or it won't work, I'll have to check the above post as it looks easier than what I did a while back.

I'll pot the script in a spoiler as no to take up space.

Problems I had in the past was with multiple planes, they would all fire at the same target and wast bombs.

I also tried to add some fire that would burn for a while after the hit.

For the height of the building I just found the actual hight and place the laser a fraction above it, too high and it will hit something else.

Also _plane dotarget lase improves it's chance of a first time strike.

The script was never really polished though.

/

/ plane = name of aircraft

// location = name of gamelogic

// 100 = targets area radius

// 60 = how long target remains selected

// nul=[plane,location,100,60] execVM "lasertargets.sqf";

// For OPFOR Aircraft you will need to replace free fall bombs with laser guided bombs

// this addWeapon "BombLauncher"; this addMagazine "6Rnd_GBU12_AV8B";

//

_plane = _this select 0;

_targetarea = _this select 1;

_radius = _this select 2;

_times = _this select 3;

_targ1 = 0;

_loops = 0;

_clock = 0 ;

_bboxheight = 0;

_loops = 0;

while { (_loops <= 60) and (alive _plane) or (_plane ammo "BombLauncher" != 0 ) or (_plane ammo "BombLauncherA10" !=0 ) or (_plane ammo "BombLauncherF35" !=0 ) } do

{

_targetarray = nearestobjects [_targetarea,["house"],_radius];

_many = count _targetarray;

_loops=_loops + 1;

_clock = time;

_bboxheight = 0;

hint format["%1",_loops];

sleep 0.3;

while {_bboxheight < 2.5} do

{

_choose = floor (random _many);

_targ1 = _targetarray select _choose;

_bbox = boundingBox _targ1;

_bboxh = _bbox select 1;

_bboxheight = (_bboxh select 2)+1;

};

if (alive _targ1) then

{

//hint format ["%1 %2",typeof _targ1,_bboxheight];

_place = "paleta1" createVehicle [getpos _targ1 select 0,getpos _targ1 select 1,0];

_place setpos [getpos _targ1 select 0,getpos _targ1 select 1,_bboxheight];

_place hideobject true;

_laze = "LaserTargetWstatic" createVehicle [getpos _targ1 select 0,getpos _targ1 select 1,0];

_laze attachTo [_place,[0,0,0.1]];

_plane dotarget _laze;// improves first time bombing

waitUntil {(!alive _targ1) or (!alive _plane) };

if (!alive _targ1 and floor random 5 >3) then

{

_fire = "paleta1" createVehicle [getpos _targ1 select 0,getpos _targ1 select 1,-1];

null = [_fire,floor random 13,0,false,true] spawn BIS_Effects_Burn;

hint format["Target %1 Destroyed",typeof _targ1];

};

sleep 1;

};

deleteVehicle _laze;

deleteVehicle _place;

_targ1 = 0;

};

// or (time >= _clock+_times)

hint format[" %1 out of LGB's",_plane];

_plane land "land";

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Hi F2k Sel. Yeah I know what you mean about the laser. The command I gave you will stop the laser from going inside the building and will have it rest on the rooftop. This isn't a perfect setup but its the best I can do at the moment. Its better suited for hellfire rockets but I haven't tested it with jet bombs yet.

Here's a video of mine using the command for hellfire laser target designation (note that the laser doesn't spawn on the building centers which leaves me free to manually place the lasers whereas you will probably want to setpos it onto the building center):

Share this post


Link to post
Share on other sites

That looks really good if I get chance I'll try and swap bounding box for setposASL.

Share this post


Link to post
Share on other sites

I ran some brief tests with the AI and they seem to be hitting the buildings with their bomblaunchers. However I think they do it only once. Which is fine, I think you end up having to respawn the marker in order to get them to target a new building/location.

What are your findings?

Also if your interested, this is my hellfire mission using the laser targeting system (ASL): http://www.armaholic.com/page.php?id=14584

Edited by Rejenorst

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  

×