Jump to content
Sign in to follow this  
granQ

Any missile scripts for using with map?

Recommended Posts

I am looking for something really simple to have a missile hit where I point on map.

Using something similar to Mandole missiles, isn't an option even if it is awesome.. (also not yet ported/tested with a3?)

A cheating version that just "hit" where I press (spawn a bomb) isn't an option either..

I need a low flying missile that goes to the point I pressed, is there any scripts around?

Share this post


Link to post
Share on other sites

I dont know if this is exactly what youre looking for, or if it will even work in A3, but its a script that we used in our A2F server to enforce a NO-FLY-ZONE. I creates a missile and locks on to a target to shoot it down and continues to loop as such until the target is destroyed. the only problem is its scripted so it tends to zigzag as well as the missile doesnt turn. it just stays pointed in one direction and slides. but it might be work a shot :)

this goes in the init line of a gamelogic anywhere on the map:

null = [starting position,target, missile class name,max speed] execVM "missile.sqf";

null = [missilestart,player, "M_R73_AA", 600] execVM "missile.sqf";

the M_R73_AA is a missile from arma 2 so youll have to find a different classname

this is the missile.sqf:

private ["_firer","_velocityX", "_velocityY", "_velocityZ", "_target","_missileSpeed","_maxVeloc","_primaryTarget","_missileStart","_missileType"];

_firer  			= _this select 0;
_primaryTarget 	= _this select 1;
_missileStart 		= [(getPos _firer select 0) - 1, (getPos _firer select 1) + 2, (getPos _firer select 2) + 1];
_missileType 		= _this select 2;
_missileSpeed 	= _this select 3;
_maxVeloc 		= 600;

if (_missileSpeed > _maxVeloc) then { _missileSpeed = _maxVeloc; };

_perSecondChecks = 1000; //direction checks per second
_getPrimaryTarget = {if (typeName _primaryTarget == typename {}) then {call _primaryTarget} else {_primaryTarget}};
_target = call _getPrimaryTarget;

_missile = _missileType createVehicle _missileStart;
_missile setPos _missileStart;
_missile setdir (getDir _firer);

//procedure for guiding the missile
_homeMissile = 
{
if (_missileSpeed < _maxVeloc) then { _missileSpeed = _missileSpeed + 10; };
_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;

[_velocityX, _velocityY, _velocityZ]

};

call _homeMissile;

//fuel burning should illuminate the landscape
_fireLight = "#lightpoint" createVehiclelocal 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;
loop;

again, it may need some tweeking for A3 and it may not even be what you want! but its a start.

I didnt write this script...and I have no idea where I found it, its been several years. But thanks to whoever did!

Share this post


Link to post
Share on other sites

try this :

null = [missilestart,player, "Land_Bucket_F", 600] execVM "missile.sqf";

just to see if the script works fine. After, you may want to find a better classname than the one for a Bucket :).

What I personally do is hide the object (no 3D model for the missile) as you almost never see it. To do so, after the line

_missile = _missileType createVehicle _missileStart; 

, you can add:

hideobject _missile;

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  

×