Jump to content

Recommended Posts

This script allows you to call a cruise missile on a target, in order to fire it, add a custom support and execute this file.   

To call accurately, use a laser designator, otherwise, the missile will "SNAP" on a nearby building/car/man.

You'll find more details inside the sqf file.

 

http://www.mediafire.com/file/ky9d722ii88c6if/Cruise_Missile.zip/file

 

New version.

  • Like 7
  • Thanks 2

Share this post


Link to post
Share on other sites

Thanks for sharing, but I have to ask - what is wrong with the Venator cruise missile? Works fine for me...

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for sharing.

 

I'll give it a try.

 

Cheers.

Share this post


Link to post
Share on other sites
2 hours ago, Harzach said:

what is wrong with the Venator cruise missile? Works fine for me...

 

Where do you find the venator cruise missile?

Share this post


Link to post
Share on other sites

Nice script! It's possible call script on laser designator target by player?

Share this post


Link to post
Share on other sites
17 minutes ago, cb65 said:

 

Where do you find the venator cruise missile?

It is fired by the MK41 VLS.

Share this post


Link to post
Share on other sites

Thanks again DankanX37,

 

I've tried out your code and it works really well.

 

Fits perfectly into my current mission.

 

Cheers mate.

Share this post


Link to post
Share on other sites

What license is it released under?  (Can it for example be used on monetized servers? Can it be altered and/or shared?  ...)

Share this post


Link to post
Share on other sites
9 hours ago, Harzach said:

Thanks for sharing, but I have to ask - what is wrong with the Venator cruise missile? Works fine for me...

 

Cruise missile by Bohemia requires you to lock with a laser, then you have to switch to the VLS, lock and fire, I created my version because I wanted a quick way of calling a strike.

Share this post


Link to post
Share on other sites

Thanks to everyone for the feedback, I will release a new version soon!

Share this post


Link to post
Share on other sites

Great script mate!

2 question:

-how do I activate this from a trigger? (tried with the proven " ExecVM "Scripts\CruiseMissile.sqf"  with no luck ).What I would like to do in my mission is to call the stryke from a radio trigger, and not from the support menu. Is it possible?

-could you add a delay/cool down between strykes? Just to avoid spamming missiles on targets...

 

Again, thank you and keep up the good work.

 

Share this post


Link to post
Share on other sites
On 19/8/2018 at 5:04 PM, zagor64bz said:

Great script mate!

2 question:

-how do I activate this from a trigger? (tried with the proven " ExecVM "Scripts\CruiseMissile.sqf"  with no luck ).What I would like to do in my mission is to call the stryke from a radio trigger, and not from the support menu. Is it possible?

-could you add a delay/cool down between strykes? Just to avoid spamming missiles on targets...

 

Again, thank you and keep up the good work.

 

 

Yes, take a look at my showcase mission, it's inside the description.ext, anyway, I'll leave it here.

 

"[] spawn fnc_CruiseMissile"

 

To avoid spamming, it's a bit more complicated if you use triggers.

  • Thanks 1

Share this post


Link to post
Share on other sites
16 hours ago, DankanX37 said:

Yes, take a look at my showcase mission, it's inside the description.ext, anyway, I'll leave it here.

 

"[] spawn fnc_CruiseMissile"

GOT IT WORKING, thank you.

 

For anyone interested  to duplicate :

On a radio trigger, ON ACT I put 

"[] spawn fnc_CruiseMissile"

In the INIT.sqf add the cruiseMissile.sqf script and erase the " ExecVM CruiseMissile.sqf" prompt.

in the description.ext erase the 

class CfgCommunicationMenu
{
    class missileBomb
    {
        text = "Cruise strike";
        expression = "[] spawn fnc_CruiseMissile";
        icon = "\a3\ui_f\data\map\markers\nato\b_inf.paa";
        removeAfterExpressionCall = 1;
   };
};

When  you call the trigger it fire the cruise missiles wherever your laser target is.

EDIT:

I managed to get a cooldown time to work with a trigger:

 

condition:

this and (trigger_name) getvariable ["delay",true];

on Act:

stryke_renull=[] spawn {sleep (600+(random 300));
trigger_name setvariable ["delay",true];
hint "MISSILE STRIKE IS NOW AVAILABLE"}; 
trigger_name setvariable ["delay",false];
hint "not available";  
[] spawn fnc_CruiseMissile;

I also added a little radio chat in the script with PlaySound3D;

Spoiler

fnc_cruiseMissile =
{
/*

    Author: Dankan37
    Function: This will call in a cruise missile where the player is watching, cruise missile has a 5+ meters miss radius, this is because of a simple math operation, I will update it soon.

    USAGE:
    Params:
    [speed, direction, height, distance, restriction] spawn Dan_fnc_CruiseMissile / or ExecVM "fn_cruiseMissile.sqf";

    -speed is the missile starting speed.
    -direction is the where the missile is gonna come from.
    -height is traver altitude ASL.
    -distance is how far away the missile will spawn.
    -restriction is used if you want the missile only to target objects (cars, apcs, men)...
    -radius is search radius from watched point.

    They are optional, as the missile has already some set up, in order to make it work under the best enviroment.


    TODO:
    Heigh following missile: Missile will follow a determined altitude, ie: fly over a mountain and then lower down.
    AI will target missile: Nearby AA assets will shoot the missile down if possible.
    Seeking missile: The missile will seek the target, and will track moving ones.
    Camera: Missile camera to see where it's going.
    Better missile math: Improve the math, in order to increase accuracy.
    Correct typos.


    NOTE: You may reuse this script in any of your missions or server, you may tweak this as you please and there's no need to credit me, as long as you don't claim it as yours.
*/
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
//sleep 5;
//playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
sleep 6;

_startSpeed = param [0, 150, [999]];
_direction = param [1, 180, [999]];
_height = param [2, 600, [999]];
_distance = param [3, 5000, [999]];
_restriction = param [4, false];
_radiusSearch = param [5,30,[999]];
_testing = param [6,false];

//Setting up ASL mode
flyMode = "ASL";
_wPos = nil;

//Detecting if player has laser
_laser = laserTarget player;
if(isNull _laser) then
{
    _wPos = screenToWorld [0.5,0.5];
}
else
{
    _wPos = _laser;
};

selPos = createAgent ["Logic", _wPos, [], 0, "FORM"];
_target = objNull;

if (!_restriction && isNull _laser) then
    {
    _nearObj = nearestObjects [selPos, ["Car","Tank","Man","Building"], _radiusSearch];

    if(count _nearObj == 0) then
    {
        strikeAllowed = false;
        hint "Strike not allowed...USE LASER DESIGNATOR";
    }
    else
    {
        strikeAllowed = true;
        //Selecting random target
        _target = selectRandom _nearObj;

        //Just for the showcas
        //player_boss sideChat "Strike position allowed, missile is incoming";
		playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
    };
}
else
{
    strikeAllowed = true;
    _target = selPos;
    //player_boss sideChat "Laser strike position received, missile is incoming.";
	playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
};

if(strikeAllowed) then
{
    

    //Setting up the starting pos for the missile.
    _startPos =  _target getRelPos [_distance, _direction];

    //Creating the missile entity
    _missile = "ammo_Missile_Cruise_01" createVehicle _startPos;

    //Placing the misssile at the desired height
    [_missile,_height, _startPos,"ASL"] call BIS_fnc_setHeight;

    //Making the missile point the target
    _dir = [_missile, _target] call BIS_fnc_DirTo;
    _missile setDir _dir;

    //Giving the missile the desired speed
    _vel = velocity _missile;
    _missile setVelocity 
    [
        (_vel select 0) + (sin _dir * _startSpeed), 
        (_vel select 1) + (cos _dir * _startSpeed), 
        (_vel select 2)
    ];

    //Loop starts here, and keeps running untill the explosion
    while {Alive _missile} do
    {
        //Collecting all the values for testing/debugging/operating
        _speed = speed _missile;
        _velocity = velocity _missile;
        _downSpeed = _velocity select 2;
        _altitudeMissileASL = (getPosASL _missile) select 2;
        _altitudeMissileATL = (getPosATL _missile) select 2;
        _distance = _missile distance _target;
        pitchMis = (_missile call BIS_fnc_getPitchBank) select 0;

        _pitchOne = [_missile,_target] call fnc_PitchtoTgt;

        //While the missile is far away
        if(_distance > 800 && flyMode == "ASL") then
        {
            //Keeping the missile at a costant altitude
            [_missile,_height,nil,"ATL"] call BIS_fnc_setHeight;
        };

        if(_distance < 1300 && flyMode != "STRIKING") then
        {
            flyMode = "COMBAT";

            _lastPitch = round -_pitchOne + 1;

            for "_i" from (pitchMis) to (_lastPitch) step -1 do 
            {
                [_missile, _i , 0] call BIS_fnc_setPitchBank;
                sleep 0.03;
            };

            //flyMode = "STRIKING";
        };
        sleep 0.005; 

        //In case of testing
        if(!_testing) then
        {
        hint format ["MODE IS: %1, \n Speed is: %2, \n Distance: %3, \n Pitch is %4, \n PitchToTgt is %5, \n ATL is %6, \n  ASL is %7",flyMode,_speed,_distance, pitchMis, _pitchOne, _altitudeMissileATL, _altitudeMissileASL];
        };
    };
};

sleep 5;
hint "MISSILE STRIKE WILL BE AVAILABLE AGAIN IN 2 MIN.";

sleep 5;

//This is just for my showcase, if you don't want it, remove it.
//[player, "missileBomb"] call BIS_fnc_addCommMenuItem; 

};

fnc_PitchtoTgt =
{
/*
    Author: Dankan37
    Function: Returns pitch needed to aim a target.
    USAGE:
    Params:
    [startingPoint, target] spawn Dan_fnc_CruiseMissile / or ExecVM "fn_cruiseMissile.sqf";

    -startingPoint i
    -direction is the where the missile is gonna come from.

    NOTE: You may reuse this script in any of your missions or server, you may tweak this as you please and there's no need to credit me, as long as you don't claim it as yours.
*/


_pointOne = param [0];
_pointTwo = param [1];

//Getting the altitudes
_altitudeOne = ((getPosASL _pointOne) select 2);
_altitudeTwo = ((getPosASL _pointTwo) select 2);

//Getting the greatest and lowest of the two
_greatest = [_altitudeOne,_altitudeTwo] call BIS_fnc_greatestNum;
_lowest = [_altitudeOne,_altitudeTwo] call BIS_fnc_lowestNum;

//Altitude diff.
_altittudeDiff = _greatest - _lowest;

//Getting distance
_distance = _pointOne distance _pointTwo;

//Calculating pitch
dist3d = sqrt (_distance ^ 2 + _altittudeDiff ^ 2); //Pytagora
pitchTgt = acos (_distance / dist3d); //Returning the angle 

pitchTgt;
};

 

I hope it's ok bud!

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

Could this be made to force a VLS launcher to fire the missile rather than have it spawn in midair?

Share this post


Link to post
Share on other sites
1 hour ago, Tankbuster said:

Could this be made to force a VLS launcher to fire the missile rather than have it spawn in midair?

Yes.....I have done that.... as soon that I'm home I'll give you the snippet.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 23/9/2018 at 2:52 PM, Tankbuster said:

Oh, great stuff. Thanks!

Here it is...

Spoiler

playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget player;
if(isNull _laser) then
{
    _wPos = screenToWorld [0.5,0.5];
}
else
{
    _wPos = _laser;
};

_target = objNull;

if (isNull _laser) then
    {
    _nearObj = nearestObjects ["Car","Tank","Man","Building"];

    if(count _nearObj == 0) then
    {
        strikeAllowed = false;
        hint "Strike not allowed...USE LASER DESIGNATOR";
    }
    else
    {
        strikeAllowed = true;
        //Selecting random target
        _target = selectRandom _nearObj;
		playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
    };
}
else
{
    strikeAllowed = true;
	playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
	hint "CRUISE MISSILE INBOUND..KEEP HEADS DOWN!!!!";
};
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
if(strikeAllowed) then
{
TARGET = createVehicle ["Land_HelipadEmpty_F" ,getPos laserTarget player, [],0,"CAN_COLLIDE"];
west reportRemoteTarget [TARGET, 3600]; 
TARGET confirmSensorTarget [west, true]; 
VLS fireAtTarget [TARGET, "weapon_vls_01"];
};
sleep 5;

 

 

.I added for my mission radio chat and laser check......but the last part is the only one you really need:

west reportRemoteTarget [TARGET, 3600]; 
TARGET confirmSensorTarget [west, true]; 
VLS fireAtTarget [TARGET, "weapon_vls_01"];

/// VLS is name of turret
/// TARGET is the name of object to be bombed.

Hope it help.

 

Cheers, Zagor.

 

EDIT: obviously you have to place down an AI  manned VLS turret for this to work...

 

  • Like 6

Share this post


Link to post
Share on other sites

EDIT 2: note that if you want it to work with laser designator as I did, so you don't have to create an object to be bombed before mission start, I strongly suggest this part

 

TARGET = createVehicle ["Land_HelipadEmpty_F" ,getPos laserTarget player, [],0,"CAN_COLLIDE"];

 

After some testing, although you could use "laserTarget player" instead of "TARGET/object name", which also work, the missile will follow your cursor so you have to keep laser on target, or it will deviate his course. With "createVehicle" you'll give a precise location at the strike. Downside is you cannot track a moving vehicle with that.Then again..."laserTarget player" will work wonder on that. It all come down to what you want in your mission.

perhaps this is what I came out with...and if there's a better solution I'm ready to learn it.

  • Like 3

Share this post


Link to post
Share on other sites
On 9/23/2018 at 9:49 PM, zagor64bz said:

Here it is...

  Hide contents


playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget player;
if(isNull _laser) then
{
    _wPos = screenToWorld [0.5,0.5];
}
else
{
    _wPos = _laser;
};

_target = objNull;

if (isNull _laser) then
    {
    _nearObj = nearestObjects ["Car","Tank","Man","Building"];

    if(count _nearObj == 0) then
    {
        strikeAllowed = false;
        hint "Strike not allowed...USE LASER DESIGNATOR";
    }
    else
    {
        strikeAllowed = true;
        //Selecting random target
        _target = selectRandom _nearObj;
		playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
    };
}
else
{
    strikeAllowed = true;
	playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
	hint "CRUISE MISSILE INBOUND..KEEP HEADS DOWN!!!!";
};
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
if(strikeAllowed) then
{
TARGET = createVehicle ["Land_HelipadEmpty_F" ,getPos laserTarget player, [],0,"CAN_COLLIDE"];
west reportRemoteTarget [TARGET, 3600]; 
TARGET confirmSensorTarget [west, true]; 
VLS fireAtTarget [TARGET, "weapon_vls_01"];
};
sleep 5;

 

 

.I added for my mission radio chat and laser check......but the last part is the only one you really need:


west reportRemoteTarget [TARGET, 3600]; 
TARGET confirmSensorTarget [west, true]; 
VLS fireAtTarget [TARGET, "weapon_vls_01"];

/// VLS is name of turret
/// TARGET is the name of object to be bombed.

Hope it help.

 

Cheers, Zagor.

 

EDIT: obviously you have to place down an AI  manned VLS turret for this to work...

 

Forgive me for my difficulty understanding how to do it, but if possible, would you be able to post a link from a demo mission?

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, snakeplissken said:

Forgive me for my difficulty understanding how to do it, but if possible, would you be able to post a link from a demo mission?

Sorry man, but it's been over a year, so no demo mission link on my end. I can walk you through if you like...

 

Share this post


Link to post
Share on other sites
On 10/8/2019 at 12:04 AM, snakeplissken said:

Forgive me for my difficulty understanding how to do it, but if possible, would you be able to post a link from a demo mission?

 

On 10/8/2019 at 1:51 PM, zagor64bz said:

Sorry man, but it's been over a year, so no demo mission link on my end. I can walk you through if you like...

 



Kinda lost me in the beginning when you said put the CruiseMissile.sqf script into the init.sqf... Are you talking about pasting it directly into the init.sqf??? or adding the ExecVM "CruiseMissile.sqf" ? 

Also when using the Radio Trigger plus forcing the VLS to launch a Cruise Missile, what must I do? I put the trigger down, added "[] spawn fnc_CruiseMissile" 
 in the activation box; what must I add to force VLS to use actual missiles and which init/activation box do i stick it in? 
Step by Step process would be very appreciated. I kinda new to all this so breaking it down is the easiest way for me to grasp it. 

Also i realized i nercro''d this thread but I NEED IT. 
 

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

×