Jump to content
Sign in to follow this  
scroll_tro0l

Help with ULB Laser

Recommended Posts

Hola!

To start with, I must say I'm utterly disappointed with the fact that you cannot use the in-game radio function (1-9,0 keys) While in a UAV or ULB.

Objective:

Be able to spawn a laser guided missile/bomb/mortar that will follow the Designator of the ULB (I'm sick of the UAV).

What I've Done:

1- On-ground "spotter" calls in Laser Guided HE rounds near target via SOM Module, ULB Observer puts up his laser and waits a sh-t long a$$ time to a great Anti-Personal explosion that does absolutely nothing to the tank. Also this requires heavy coordination between the SOM manager and the ULB pilot.

2- Lazy genes disallow from posting a help request on BIS forums

3- After 5 Hours of trial and error, finds amazing script that spawns a missile that follows handheld laser designator (Script doesn't work with ULB or UAV)

5- After 1 more hour of trying to make it work with the ULB and/or UAV, totally frustrated and decides to post on BIS forums.

I do realize that the ULB was made to be with the AH strike and that Mando let's you shoot the UAV Hellfires like it should. But I still need something where there's some kind of "process" involved in firing the ordinance so that it is not overused and the round can be selected (The primary function of the ULB Operator is to provide oversight for this mission). Also, AC-130 is overkill and I'm not interested in SATCOM

Any and all help, questions, comments, and trolling are appreciated! (I take that back for trolling)

Share this post


Link to post
Share on other sites

I guess I got a bit carried away with the LGB idea, I think the AH-64's Hellfire or whatever it fires is more than enough. The 2nd thing is that I don't want the ULB Operator to be going thru a whole arty sequence to fire 1 rocket. It should be a addAction that puts up a "Fire Missile" and send a cruiser that follows where the ULB designates.

I Realize that this is a little...abstract, this should be the UAV's job but I'm very unsatisfied with it's movement scheme. A static view of the ground is what I need.

BTW this is the epic script I was talking about!

Share this post


Link to post
Share on other sites

LGB from ULB the easy way.

Setup the ULB

ULB and player (does not need to be in vehicle) synced to ULB module (F7)

Put an F35B on the map or spawn it, give it waypoints etc..

Put this in the script so it is only armed with LGBs (It is named F35B in this example):

F35B setVehicleAmmo 0.0;
{F35B removeMagazines _x} forEach (magazines F35B);
{F35B removeWeapon _x} forEach (weapons F35B);
{F35B addMagazine "2Rnd_GBU12"} forEach [1,2,3,4];
F35B addWeapon "BombLauncherF35";
{F35B addMagazine "120Rnd_CMFlare_Chaff_Magazine"} forEach [1,2];
F35B addWeapon "CMFlareLauncher";
F35B setFuel 1;

You chould have the ULB in your action menu - go to it and target anything.

Click your left and right mouse buttons so TGT and LSR is illuminated. There should be a small square between the crosshairs.

The F35B will bomb where your crosshair is pointing. Don't swing the laser around or the F35B will get confused and crash. Remeber to turn it off before moving it.

Edit:

If you just want the Bomb there is this post:

http://forums.bistudio.com/showthread.php?t=99492

It is designed to work on players with laser designator and creates the bomb above the nearest laser target within 2000m.

If you replace:

_lasertargets = nearestObjects[player,["LaserTarget"],2000];

with

_lasertargets = nearestObjects[uLB1,["LaserTarget"],2000];

Where the ULB is named ULB1 that should work. You would also need to change the getdir of player and laser designator to getDir of ULB1. Also you need to change the weapon to "Laserdesignator_mounted".

LGB from ULB SOLVED

Just tried it and I can confirm it works perfectly - lase something and choose "Drop Bomb on Laser" from the action menu.. Not my work - thanks to Bon and Fuzzy Bandit - I just changed a few lines.

Name your AH-6X ULB1 and put this in the init:

this addAction ["Drop Bomb on Laser", "bombit.sqf"];

init.sqf

getMyLaserTarget = compile (preprocessFileLineNumbers "func_getMyLaserTarget.sqf");

bombit.sqf

_myLaserTarget = [player] call getMyLaserTarget;
bomb = "Bo_GBU12_LGB" createVehicle [(getPos _myLaserTarget select 0),(getPos _myLaserTarget select 1), 100];]

func_getMyLaserTarget.sqf

//by Bon_Inf*

/** returns the laser target the player is lasering at, or ObjNull if it does not exist **/

private ["_xpos","_ypos","_myLaserTarget","_lasertargets","_dir","_distance","_min","_target","_targetpos","_targetdistance","_aimpos"];

_lasertargets = nearestObjects[uLB1,["LaserTarget"],2000];

if(count _lasertargets == 0) exitWith{ObjNull};

_xpos = getPos ULB1 select 0;

_ypos = getPos ULB1 select 1;

_myLaserTarget = ObjNull;

_dir = ULB1 weaponDirection "Laserdesignator_mounted";

_dir = (_dir select 0) atan2 (_dir select 1); // get direction of the lasermarker aiming at

_distance = 99;

_min =99;

for "_i" from 0 to (count _lasertargets - 1) do{

_target = _lasertargets select _i;

_targetpos = [getPos _target select 0,getPos _target select 1,0];

_targetdistance = _targetpos distance [getPos ULB1 select 0, getPos ULB1 select 1, 0];

_aimpos = [_xpos + _targetdistance*sin(_dir), _ypos + _targetdistance*cos(_dir),0];

if((_targetpos distance _aimpos)<_min) then{

_myLaserTarget=_target;

_min = _targetpos distance _aimpos;

};

};

if(_min>2) then{_myLaserTarget = ObjNull};

_myLaserTarget

Edited by PELHAM

Share this post


Link to post
Share on other sites

Hmm, I'm honestly the worst scripter known to mankind. I'm trying to figure out how to replace the handheld laser designator with the ULB laser here.

_primaryTarget = lasertarget (_this select 1); //target for the missile
_missileStart = getPos ((_this select 3) select 1); //position where te missile will be spawned
_missileType = (_this select 3) select 2; //type of the missile
_missileSpeed = (_this select 3) select 3; //speed of the missile
_defaultTargetPos = (_this select 3) select 4; //default position where unguided missiles will fly

if (isNull _primarytarget) exitWith {hintSilent "No Target Found!"};

_perSecondChecks = 25; //direction checks per second
_getPrimaryTarget = {if (typeName _primaryTarget == typename {}) then {call _primaryTarget} else {_primaryTarget}}; //code can be used for laser dots
_target = call _getPrimaryTarget;

_missile = _missileType createVehicle _missileStart;
_missile setPos _missileStart;

//secondary target used for random trajectory when laser designator is turned off prematurily
_secondaryTarget = "HeliHEmpty" createVehicle _defaultTargetPos;
_secondaryTarget setPos _defaultTargetPos;

_guidedRandomly = FALSE;

//procedure for guiding the missile
_homeMissile = {

//here we switch to secondary target at random position if the laser dot no longer exists
//if the designator is turned on again, the missile will return to it's original target (providing it hadn't flown too far)
private ["_velocityX", "_velocityY", "_velocityZ", "_target"];
_target = _secondaryTarget;
if (!(_guidedRandomly) && _missile distance _target > _missileSpeed * 1.5) then {
_guidedRandomly = TRUE;
_target = _secondaryTarget;
_dispersion = (_missile distance _defaultTargetPos) / 20;
_dispersionMin = _dispersion / 10;
_target setPos [(_defaultTargetPos select 0) + _dispersionMin - (_dispersion / 2) + random _dispersion, (_defaultTargetPos select 1) + _dispersionMin - (_dispersion / 2) + random _dispersion, 0];
};
if (!(isNull (call _getPrimaryTarget))) then {_target = call _getPrimaryTarget; _defaultTargetPos = position _target; _guidedRandomly = FALSE};

//altering the direction, pitch and trajectory of the missile
if (_missile distance _target > (_missileSpeed / 20)) then {
_travelTime = (_target distance _missile) / _missileSpeed;
_steps = floor (_travelTime * _perSecondChecks);

_relDirHor = [_missile, _target] call BIS_fnc_DirTo;
_missile setDir _relDirHor;

_relDirVer = asin ((((getPosASL _missile) select 2) - ((getPosASL _target) select 2)) / (_target distance _missile));
_relDirVer = (_relDirVer * -1);
[_missile, _relDirVer, 0] call BIS_fnc_setPitchBank;

_velocityX = (((getPosASL _target) select 0) - ((getPosASL _missile) select 0)) / _travelTime;
_velocityY = (((getPosASL _target) select 1) - ((getPosASL _missile) select 1)) / _travelTime;
_velocityZ = (((getPosASL _target) select 2) - ((getPosASL _missile) select 2)) / _travelTime;

//_defaultTargetPos = position _target;
};

[_velocityX, _velocityY, _velocityZ]
};

call _homeMissile;

//fuel burning should illuminate the landscape
_fireLight = "#lightpoint" createVehicle position _missile;
_fireLight setLightBrightness 0.5;
_fireLight setLightAmbient [1.0, 1.0, 1.0];
_fireLight setLightColor [1.0, 1.0, 1.0];
_fireLight lightAttachObject [_missile, [0, -0.5, 0]];

//missile flying
while {alive _missile} do {
_velocityForCheck = call _homeMissile;
if ({(typeName _x) == (typeName 0)} count _velocityForCheck == 3) then {_missile setVelocity _velocityForCheck};
sleep (1 / _perSecondChecks)
};

deleteVehicle _fireLight;
deleteVehicle _secondaryTarget;

Also, Is there a way to spawn something (like lets say smoke ordinance) right 500m above the ULB's Laser designator?

Share this post


Link to post
Share on other sites
Hmm, I'm honestly the worst scripter known to mankind. I'm trying to figure out how to replace the handheld laser designator with the ULB laser here.

You were supposed to use the func_getMyLaserTarget.sqf in that post. Anyway - it's done for you above :)

Share this post


Link to post
Share on other sites

has anyone managed to get a working laser tracking bomb (apart from the nefariously complex mando)? i spent thebest part of today usingthis thread and a few others to no avail...

Share this post


Link to post
Share on other sites

PELHAM's post works perfectly! (sorry for not posting this earlier)

I actually used that script to spawn smoke instead of a LGB, I instead made a crazy setup that sets up the AH64 with only 1 Hellfire at a time and It takes a minute to reload once depleted.

But coming back to Bon and Fuzzy's Script...

The important part is hidden in the spoiler:

//by Bon_Inf*
/** returns the laser target the player is lasering at, or ObjNull if it does not exist **/

private ["_xpos","_ypos","_myLaserTarget","_lasertargets"," _dir","_distance","_min","_target","_targetpos","_ targetdistance","_aimpos"];


_lasertargets = nearestObjects[uLB1,["LaserTarget"],2000];
if(count _lasertargets == 0) exitWith{ObjNull};

_xpos = getPos ULB1 select 0;
_ypos = getPos ULB1 select 1;

_myLaserTarget = ObjNull;

_dir = ULB1 weaponDirection "Laserdesignator_mounted";
_dir = (_dir select 0) atan2 (_dir select 1); // get direction of the lasermarker aiming at

_distance = 99;
_min =99;

for "_i" from 0 to (count _lasertargets - 1) do{
_target = _lasertargets select _i;
_targetpos = [getPos _target select 0,getPos _target select 1,0];

_targetdistance = _targetpos distance [getPos ULB1 select 0, getPos ULB1 select 1, 0];

_aimpos = [_xpos + _targetdistance*sin(_dir), _ypos + _targetdistance*cos(_dir),0];

if((_targetpos distance _aimpos)<_min) then{
_myLaserTarget=_target;
_min = _targetpos distance _aimpos;
};
};

if(_min>2) then{_myLaserTarget = ObjNull};

_myLaserTarget

The above defines where the ULB laser is pointed.

You then need the init to include:

getMyLaserTarget = compile (preprocessFileLineNumbers "func_getMyLaserTarget.sqf");

And then a script to spawn the bomb itself:

_myLaserTarget = [player] call getMyLaserTarget;
bomb = "Bo_GBU12_LGB" createVehicle [(getPos _myLaserTarget select 0),(getPos _myLaserTarget select 1), 100];]

The above portion can be edited to drop whatever u want, as I mentioned earlier mine spawns Smoke Shells.

Once you have all that you need to give the ULB the ability to call the script by adding the following to its init:

this addAction ["Drop Bomb on Laser", "bombit.sqf"];

For the purpose of my mission, having a ULB call a Bomb was a bit overkill (since most of the players were in infantry roles). The Hellfire method I'm using seems to be more ideal.

Good Luck!

Edited by Scroll_Tro0L

Share this post


Link to post
Share on other sites
_distance = 99;

_min =99;

what are these all about? any idea?

Share this post


Link to post
Share on other sites

Idk, test em out and let us all know =P

I believe it's to prevent the Bomb from spawning too close to the ULB

if((_targetpos distance _aimpos)<_min...

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  

×