I have written a Script to use the D30 as Anti-Tank-Gun.
It's just for fun but i can't delete the Shell that the D30 has fired.
I want the D30 to point at the target directly.
_p = _this select 0;
_w= _this select 1;
_x = getpos _w select 0;
_y = getpos _w select 1;
_z = (getpos _w select 2);
?not alive (gunner _p):exit;
_p disableAI "Target"
_p DoWatch [ _x, _y , _z];
~2
_p DoWatch [ _x, _y , _z];
_p Fire "D30";
_N = nearestObject [_p,"D30"];
_N setvelocity [0,0,0];
_N SetPos [(getpos _p select 0),(getpos _p select 1),2];
//_x = _x+((random 5)-2.5)
//_y = _y+((random 5)-2.5)
_x = getpos _w select 0;
_y = getpos _w select 1;
_z = (getpos _w select 2) +3;
_e = _x - (getpos _p select 0);
_d = _y - (getpos _p select 1);
_a = (velocity _w select 0);
_b = (velocity _w select 1);
_distance = sqrt ((_e ^ 2) + (_d ^ 2));
_time= _distance / 600;
~_time
//_x = _x + (_a * _time );
//_y = _y + (_b * _time);
_x = (getpos _w select 0) + (_a/2);
_y = (getpos _w select 1) + (_b/2);
_z = (getpos _w select 2) +3;
"SH_125_HE" createVehicle [_X, _Y, _Z];
?_a >0 :hint "hans";
_p enableAI "Target";