G'day, I have been trying at this for a few days. What I have is a script I made for a gasbomb, while I am happy with the effects I would like it to look as though the initial missile strike comes in on an angle say of above 45degrees.
I have been reading the maths sections on the wiki and looking at Mandos scripts but I am truly at a loss.
Here is the missile part of my script and with the maths I have added.
#start
_array1 = []
_cnt = 0
_deg = random (359)
;missile part
_shell = "Barrel1" Createvehicle getMarkerPos "gas"
_shell setPosAsl [(getPos _shell select 0)+sin(_deg)*3 ,(getPos _shell select 1)+cos(_deg)*3,(getPos _shell select 2)+150 ]
"gas" setMarkerPos (getPos _shell)
#cinders
_PS4 = "#particlesource" createVehicleLocal getpos _shell
_PS4 setParticleCircle [0, [0, 0, 0]];
_PS4 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_PS4 setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\FireAnim.p3d", 9, 2, 2], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.066, [1.2, 2, 4], [[1.99, 1.1, 1.1, 10], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_PS4 setDropInterval 0.02
#Fire
_ps3 = "#particlesource" createVehicleLocal getpos _shell
_ps3 setParticleCircle [0, [0, 0, 0]];
_ps3 setParticleRandom [0.2, [0.1, 0.1, 0], [0.5, 0.5, 0], 0, 1, [0.5, 0, 0, 0.1], 0, 0];
_ps3 setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 2, 6], "", "Billboard", 1, 1, [0, 0, 0.5], [0.25, 0.25, 0], 0.3, 1, 7.9, 9, [0.5, 2, 4], [[0.7, 0.7, 0.7, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_ps3 setDropInterval 0.009;
#lightTrail
_traillight = "#lightpoint" createVehicleLocal getpos _shell
_traillight setLightColor [0,0.3,1];
_traillight setLightAmbient [0.1,3,1];
_traillight setLightBrightness 0.02;
_traillight LightAttachObject [_shell,[0,0,0]];
#trail1
_ps = "#particlesource" createVehicleLocal getpos _shell
_ps setParticleCircle [0, [0, 0, 0]];
_ps setParticleRandom [10, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps setParticleParams [["\Ca\Data\missileSmoke", 8, 1, 8], "", "Billboard", 10, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.075, [0.2, 2, 4], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [10], 1, 0, "", "", _shell];
_ps setDropInterval 0.001;
~0.1
#trail1a
_ps1 = "#particlesource" createVehicleLocal getpos _shell
_ps1 setParticleCircle [0, [0, 0, 0]];
_ps1 setParticleRandom [10, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setParticleParams [["\Ca\Data\ParticleEffects\RocketSmoke\RocketSmoke.p3d", 8, 3, 8], "", "Billboard", 0.1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.075, [0.2, 2, 4], [[0.1, 0.1, 0.1, 0.1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_ps1 setDropInterval 0.005;
~0.1
~5
#trail2
_ps2 = "#particlesource" createVehicleLocal getpos _shell
_ps2 setParticleCircle [2, [-1, -1, -1]];
_ps2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps2 setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\FireAnim.p3d", 8, 1, 8], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10, 7.9, 0.075, [1.2, 2, 4], [[0.5, 0.5, 0.1, 0.5], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _shell];
_ps2 setDropInterval 0.05;
~0.5
; Delete Missile particle effects
deletevehicle _traillight
deletevehicle _ps
deletevehicle _ps1
deletevehicle _ps2
; Explosion part
_obj = "LOGIC" createVehicle position _shell;
~0.2
_posx = getpos _obj select 0
_posy = getpos _obj select 1
_posz = (getpos _obj select 2) - 2
drop ["\Ca\Data\kouleSvetlo.p3d","","Billboard",1,1.0,[_posx,_posy,_posz],[0,0,0],1,1.3,1.0,0.0,[50],[[1.0,0.7,0.4,0.8],[1.0,0.6,0.4,0.001]],[0],0.0,0.0,"","",""]
~0.1
#bomber=
_gas = "M_Maverick_AT" createVehicle position _obj;
deletevehicle _shell;
~0.5
;Destuction level
_seek = random 30
_xxpos = (getMarkerPos "gas" select 0)
_yypos = (getMarkerPos "gas" select 1)
_veharray = [_xxpos,_yypos,0] nearObjects ["Land", (15 + _seek)]
{_x setdammage ((getdammage _x) + 1)} forEach _veharray
_bldarray = [_xxpos,_yypos,0] nearObjects ["Static", (25 + _seek)]
{_x setdammage ((getdammage _x) + 1)} forEach _bldarray
~1
I get no errors, but also no change in the angle of decent. I do get movement on the position of the shell adjusting the cos/sin No. or if I use the Deg or Rad operators but then it wont hit the mark. Luke also provided me with these codes
_height =(getposasl shell select 2) - (getposasl target select 2);
_timetoimpact=sqrt(_height/4.9);
?_timetoimpact < 0:goto "lookout!"
_xdistance= (_getpos shell select 0) - (_getpos target select 0);
_ydistance= (_getpos shell select 1) - (_getpos target select 1);
shell setvelocity[(_xdistance/_timetoimpact),(_ydistance/_timetoimpact),0];
exit
#lookout!
hint "TOO LOW!!"
and
#height_provided
_targetheight= getposasl target select 2
_shellheight =_targetheight + _height
_distance = (_height * sin (90 - _angle))/(sin (_angle))
shell setpos [_distance * cos(_direction),_distance * sin(_direction), _height];
_timetoimpact=sqrt(_height/4.9);
_xdistance= (_getpos shell select 0) - (_getpos target select 0);
_ydistance= (_getpos shell select 1) - (_getpos target select 1);
shell setvelocity[(_xdistance/_timetoimpact),(_ydistance/_timetoimpact),0];
exit
#Distance_provided
_height=(_distance * sin (_angle))/(sin (90 - _angle))
_targetheight= getposasl target select 2
_shellheight =_targetheight + _height
shell setpos [_distance * cos(_direction),_distance * sin(_direction), _height];
_timetoimpact=sqrt(_height/4.9);
_xdistance= (_getpos shell select 0) - (_getpos target select 0);
_ydistance= (_getpos shell select 1) - (_getpos target select 1);
shell setvelocity[(_xdistance/_timetoimpact),(_ydistance/_timetoimpact),0];
exit
But again I can't seem to get them to work
If you need to see the entire script let me know
Any help appreciated
Odin