Jump to content

Recommended Posts

Anyone know of a script that allows you to lase targets for an AI controlled gunship overhead to fire at? I have a decent script made but for some reason some of the guns wont fire or miss the target completely. Any suggestions and help is welcome.

Share this post


Link to post
Share on other sites

I remember I tried to do something for that, years ago. Not sure I found a solution, just adding some immersive fires, but poor success.
I added this kind of code:

if (!isNull (_gunship findNearestEnemy _pos)) then {
  gunner _gunship lookAt (_gunship findNearestEnemy _pos);
  group _gunship reveal [(_gunship findNearestEnemy _pos),4];
  _gunship doWatch (_gunship findNearestEnemy _pos);
  gunner _gunship doTarget (_gunship findNearestEnemy _pos);
  if (_gunship aimedAtTarget [(_gunship findNearestEnemy _pos)] > 0) then {
    _gunship fireAtTarget [(_gunship findNearestEnemy _pos)]};
    };
};

You can spawn a laser target, but not sure that will help for precision.

see:

That works also for AIs, and:

laserTarget

 

Hope someone has better way for this aim!

 

Share this post


Link to post
Share on other sites
18 hours ago, pierremgi said:

I remember I tried to do something for that, years ago. Not sure I found a solution, just adding some immersive fires, but poor success.
I added this kind of code:


if (!isNull (_gunship findNearestEnemy _pos)) then {
  gunner _gunship lookAt (_gunship findNearestEnemy _pos);
  group _gunship reveal [(_gunship findNearestEnemy _pos),4];
  _gunship doWatch (_gunship findNearestEnemy _pos);
  gunner _gunship doTarget (_gunship findNearestEnemy _pos);
  if (_gunship aimedAtTarget [(_gunship findNearestEnemy _pos)] > 0) then {
    _gunship fireAtTarget [(_gunship findNearestEnemy _pos)]};
    };
};

You can spawn a laser target, but not sure that will help for precision.

see:

That works also for AIs, and:

laserTarget

 

Hope someone has better way for this aim!

 

Okay nice.

This is what I got and only one gun can actually hit the target.

 

_laser = laserTarget player;
_wPos = _laser;
selPos = createVehicle ["Sign_Arrow_Blue_F", _wPos, [], 0, "CAN_COLLIDE"];
_target = selPos;

sleep 1;

spotter doTarget _target;
gunship doTarget _target;
gunshipG doWatch _target;

[spotter, "Laserdesignator_mounted"] call BIS_fnc_fire;

sleep 4;

[gunship, "cannon_105mm_VTOL_01"] call BIS_fnc_fire;
sleep 1;
[gunship, "autocannon_40mm_VTOL_01"] call BIS_fnc_fire;
sleep 0.5;
[gunship, "autocannon_40mm_VTOL_01"] call BIS_fnc_fire;
sleep 0.5;
[gunship, "gatling_20mm_VTOL_01"] call BIS_fnc_fire;

Share this post


Link to post
Share on other sites

I'm afraid you can't do anything for precision, except modding another aircraft...

or struggling with the relative position of laser target if attached on a vehicle or anything...

or working around a fake impact/explosion as soon as a shell/bullet hit the ground (deflection) (see projectile event handlers)

 

Share this post


Link to post
Share on other sites

I found a solution. Not perfect but it works for my usage. Basically have a blackfish loiter around area and put a fired event handler to when it fires the projectile is deleted so the script can pawn the projectile.

 


_laser = laserTarget player;
_wPos = _laser;
selPos = createVehicle ["Sign_Arrow_Blue_F", _wPos, [], 0, "CAN_COLLIDE"];
_target = selPos;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

sleep 0.1;

[gunship, "cannon_105mm_VTOL_01", [1]] call BIS_fnc_fire;
_bomb1="Sh_105mm_HEAT_MP" createVehicle ([_target select 0, _target select 1, 800]);

_bomb1 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb1 setVelocity [0, 0, -60];

sleep 2;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "autocannon_40mm_VTOL_01"] call BIS_fnc_fire;
_bomb2="B_40mm_GPR_Tracer_Red" createVehicle ([_target select 0, _target select 1, 800]);

_bomb2 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb2 setVelocity [0, 0, -60];

sleep 0.5;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "autocannon_40mm_VTOL_01"] call BIS_fnc_fire;
_bomb2="B_40mm_GPR_Tracer_Red" createVehicle ([_target select 0, _target select 1, 800]);

_bomb2 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb2 setVelocity [0, 0, -60];

sleep 0.5;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "autocannon_40mm_VTOL_01"] call BIS_fnc_fire;
_bomb2="B_40mm_GPR_Tracer_Red" createVehicle ([_target select 0, _target select 1, 800]);

_bomb2 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb2 setVelocity [0, 0, -60];

sleep 9;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "gatling_20mm_VTOL_01"] call BIS_fnc_fire;
_bomb3="B_20mm" createVehicle ([_target select 0, _target select 1, 100]);

_bomb3 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb3 setVelocity [0, 0, -60];

sleep 0.2;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "gatling_20mm_VTOL_01"] call BIS_fnc_fire;
_bomb3="B_20mm" createVehicle ([_target select 0, _target select 1, 100]);

_bomb3 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb3 setVelocity [0, 0, -60];

sleep 0.2;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "gatling_20mm_VTOL_01"] call BIS_fnc_fire;
_bomb3="B_20mm" createVehicle ([_target select 0, _target select 1, 100]);

_bomb3 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb3 setVelocity [0, 0, -60];


sleep 0.2;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "gatling_20mm_VTOL_01"] call BIS_fnc_fire;
_bomb3="B_20mm" createVehicle ([_target select 0, _target select 1, 100]);

_bomb3 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb3 setVelocity [0, 0, -60];

sleep 0.2;

_target = [[[position selPos, 10]], []] call BIS_fnc_randomPos;

[gunship, "gatling_20mm_VTOL_01"] call BIS_fnc_fire;
_bomb3="B_20mm" createVehicle ([_target select 0, _target select 1, 100]);

_bomb3 setVectorDirAndUp [[0,0,-1], [0,1,0]];
_bomb3 setVelocity [0, 0, -60];

 

  • 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

×