mankyle 420 Posted August 12, 2009 (edited) I have taken a look at the code and scripts of the tomahawk missiles enabled in Arma 2 and I have finally enabled them launch.sqf /* File: launch.sqf Author: Joris-Jan van 't Land Description: Launching a cruisemissile from a submerged submarine. Parameter(s): _this select 0: the position from where to launch (should be in water). _this select 1: the target object. */ //ToDo: convert particle systems to particle sources. //ToDo: abort when launch position is not in water? private ["_posLaunch", "_target", "_path", "_pathS"]; _posLaunch = _this select 0; _target = _this select 1; _path = "\ca\air2\cruisemissile\"; //" _pathS = _path + "data\scripts\"; //" //Spawn the launch variant of the cruise missile and its flare. private ["_misL", "_misFlare"]; _misL = "CruiseMissile1" createVehicle [(_posLaunch select 0), (_posLaunch select 1), -1]; _misFlare = "CruiseMissileFlare1" createVehicle [(_posLaunch select 0), (_posLaunch select 1), -1]; _misFlare inflame true; //Start the launch. _misL setVelocity [0, 0, 20]; [_misL] execVM (_pathS + "watersplash.sqf"); //Unhide animated parts. _misL setObjectTexture [0, "#(argb,8,8,3)color(0.501961,0.501961,0.501961,1.0,CO)"]; _misL setObjectTexture [1, "#(argb,8,8,3)color(0.501961,0.501961,0.501961,1.0,CO)"]; _misL setObjectTexture [2, "#(argb,8,8,3)color(0.501961,0.501961,0.501961,1.0,CO)"]; _misL setObjectTexture [3, "#(argb,8,8,3)color(0,0,0,1.0,co)"]; _misL setVariable ["cruisemissile_level", false]; sleep 0.8; [_misL, _misFlare] execVM (_pathS + "cruisemissileflare.sqf"); _misL setObjectTexture [4, _path + "data\exhaust_flame_ca"]; _misFlare say "CruiseMissileLaunch"; [_misL] execVM (_pathS + "exhaust1.sqf"); [_misL] execVM (_pathS + "exhaust3.sqf"); sleep 0.3; [_misL] execVM (_pathS + "booster.sqf"); [_misL] execVM (_pathS + "vector_control.sqf"); sleep 1; _misL setObjectTexture [0, ""]; _misL animate ["Cover1", 1]; _misL animate ["Cover2", 1]; _misL animate ["Fin1", 1]; _misL animate ["Fin2", 1]; _misL animate ["Fin3", 1]; _misL animate ["Fin4", 1]; _misL animate ["Wing1", 1]; _misL animate ["Wing2", 1]; _misL animate ["Intake1", 1]; sleep 0.5; _misL setObjectTexture [1, ""]; _misL setObjectTexture [2, ""]; drop [_path + "cl_cover1", "", "SpaceObject", 1, 40, [-3, -3, -0.5], [-5, 0, 50], 2, 10.0, 1.0, 0, [1], [[1, 1, 1, 1]], [0, 1], 0, 0, "", "", _misL]; drop [_path + "cl_cover1", "", "SpaceObject", 1, 40, [3, 3, -0.5], [5, 0, 50], 2, 10.0, 1.0, 0, [1], [[1, 1, 1, 1]], [0, 1], 0, 0, "", "", _misL]; waitUntil {((vectorUp _misL) select 1) <= -0.9}; _misL setVariable ["cruisemissile_level", true]; _misL setObjectTexture [4, ""]; private ["_pos", "_vel", "_dir"]; _pos = position _misL; _vel = velocity _misL; _dir = direction _misL; deleteVehicle _misL; //Spawn the actual cruising missile. private ["_mis", "_pilot"]; _mis = "CruiseMissile2" createVehicle _pos; _pilot = (group player) createUnit ["USMC_soldier", _pos, [], 0, "NONE"]; PilotMis2 = _pilot; [_pilot] join grpNull; _mis setDamage 0; _mis setPos _pos; _pilot moveInDriver _mis; _mis engineOn true; _mis setDir 180; _pilot move [_pos select 0, (_pos select 1) - 100]; _mis flyInHeight (position _mis select 2); _mis setVelocity [0, -100, 30]; drop [_path + "cl_booster1", "", "SpaceObject", 1, 40, [0, -5, 0], [0, 40, 0], 2, 3.0, 1.0, 0, [1], [[1, 1, 1, 1]], [0, 1], 0, 0, "", "", _mis]; [_mis, _target] execVM "cruising.sqf"; true cruising.sqf /* File: cruising.sqf Author: Joris-Jan van 't Land Description: Cruising the missile to its target. Parameter(s): _this select 0: the cruisemissile object. _this select 1: the target object. */ private ["_mis", "_target"]; _mis = _this select 0; _target = _this select 1; private ["_path", "_pathS"]; _path = "\ca\air2\cruisemissile\"; //" _pathS = _path + "data\scripts\"; //" _mis setCombatMode "BLUE"; _mis setBehaviour "CARELESS"; _mis setSpeedMode "FULL" _mis disableAI "AUTOTARGET"; private ["_stagingPos"]; _stagingPos = [(position _target) select 0, ((position _target) select 0), 0]; _mis doMove _stagingPos; waitUntil {((position _mis) distance _stagingPos) < 1000}; while {alive _mis} do { _mis flyInHeight 50; _mis doMove (position _target); waitUntil {(_mis distance _target) <= 400}; _mis flyInHeight 5; _mis doMove (position _target); if ((_mis distance _target) < 100) then { deleteVehicle (driver _mis); deleteVehicle _mis; private ["_pos", "_shell"]; _pos = position _target; _shell = "Bo_Mk82" createVehicle _pos; _shell = "Bo_Mk82" createVehicle _pos; [_pos] execVM (_pathS + "explosion.sqf"); }; sleep 0.1; }; true Put these scripts in your mission folder and create a trigger radio Alpha, trigger, repeated. On activation write: xxx=[Getpos LAUNCH,TARGET] execVm "launch.sqf" choose an object, for example one of GNAT's subs and call it LAUNCH and call TARGET the object who's goone be the targeted unit activate your trigger and you will have a cruise missile launched from an simulated submerged submarine that will fly to the target and will detonate there If you want to refine the code, all tomahawk scripts are under CA\air2\CruiseMissile\Data\Scripts Hope you enjoy Now with demo mission http://www.megaupload.com/?d=PFZJMCA2 Edited August 13, 2009 by mankyle Adding a download link Share this post Link to post Share on other sites
sakura_chan 9 Posted August 12, 2009 (edited) I couldn't get it to work, it stops at the "waitUntil {((vectorUp _misL) select 1) <= -0.9};" part and I never see a missile spawned. Is there something I missed? //edit I got it to work, apparently it refused to use getmarkerpos, it always returned the positions as "any". changed the launch to a gamelogic and used getpos and it worked. The missile didn't try to fly into its target though and would only fly in a certain direction. Edited August 12, 2009 by Sakura_Chan Share this post Link to post Share on other sites
mankyle 420 Posted August 12, 2009 I got it to work, apparently it refused to use getmarkerpos, it always returned the positions as "any". changed the launch to a gamelogic and used getpos and it worked. Yep. I noticed when I posted that I had posted an incorrect info. I edited it inmediately. The missile didn't try to fly into its target though and would only fly in a certain direction. This method isn't perfect. Sometimes the missile doesn't fly to the target and just flies in circles. I suspect the pathing for the missile is screwed. But when it works it works flawlessly. Try putting a target in the middle of the sea. Usually it works better I have modified the code for substituting GNATs harpoon missiles so the missiles can be destroyed inflight and have used them to attack a Krivak. By playing with the config I have created a less vissible unit and the frigate attacks it with missiles and CIWS fire, resulting that you have to overwhelm the frigate defenses with missiles if you want to impact. For simulating SSMs this code could work quite well Share this post Link to post Share on other sites
nikita320106 0 Posted August 12, 2009 @mankyle thanx) thanx alot can you share example mission with last corrections?? Share this post Link to post Share on other sites
nominesine 0 Posted August 12, 2009 Sorry for my ignorance, but if I understand you correctly these cruise missiles are already available in ArmA2? They're just hidden and you've found a script that enables them. Am I assuming correctly? I have no testing opportunities at the moment. Share this post Link to post Share on other sites
mankyle 420 Posted August 12, 2009 Yes they are located in the air2.pbo The problems is that the scripts that activated them were a WIP and had some errors (biggest one was the crew, as the script pointed to SoldierWB, an arma 1 unit). As they were a WIP they were not refined and some things didn't work I just looked at them and refined them a bit. I have already modified the scripts so when you are using GNATs frigate and submarine packs you create these kind of missiles. Now when you are in your frigate and an enemy SSM comes you can try to destroy with SAMs or CIWS systems. So far first version is coming along well but I have to make the missiles more difficult to destroy Share this post Link to post Share on other sites
Schilly 10 Posted August 12, 2009 Do you have any example missions to demo this scripting? As much as I could probably manage to get it going with the scripts, it would be significantly easier if there was already a demo mission together. Share this post Link to post Share on other sites
[aps]gnat 28 Posted August 12, 2009 Nice job mankyle! Looking forward to further refinement. Share this post Link to post Share on other sites
vengeance1 50 Posted August 12, 2009 Yes they are located in the air2.pboThe problems is that the scripts that activated them were a WIP and had some errors (biggest one was the crew, as the script pointed to SoldierWB, an arma 1 unit). As they were a WIP they were not refined and some things didn't work I just looked at them and refined them a bit. I have already modified the scripts so when you are using GNATs frigate and submarine packs you create these kind of missiles. Now when you are in your frigate and an enemy SSM comes you can try to destroy with SAMs or CIWS systems. So far first version is coming along well but I have to make the missiles more difficult to destroy Subs and Frigates? To the best of my knowledge Gnat has not released these yet, damn I hope I didn't miss it? Share this post Link to post Share on other sites
mankyle 420 Posted August 12, 2009 Nope, he hasn't released them yet, but I have converted them for my own use. I have added standard missiles to the OHP, changed the scripts for securing the helicopters so the use the Attachto command and tweaked weapon values. I will try to release the converted missiles ASAP Share this post Link to post Share on other sites
mankyle 420 Posted August 12, 2009 (edited) Ok, I have refined the scripts a little bit (still a long way to go for synchronizing animations) and I have uploaded a demo mission in utes Doesn't use any addons, all edited scripts are inside the mission folder for you to tweak and edit as you wish enjoy it http://www.megaupload.com/?d=PFZJMCA2 Edited August 13, 2009 by mankyle repairing broken link Share this post Link to post Share on other sites
nominesine 0 Posted August 12, 2009 Very nice. Make sure to release them on Ofpec as well. A good place to get them beta tested and bug free. Share this post Link to post Share on other sites
Tinker 10 Posted August 13, 2009 Ok, I have refined the scripts a little bit (still a long way to go for synchronizing animations) and I have uploaded a demo mission in utesDoesn't use any addons, all edited scripts are inside the mission folder for you to tweak and edit as you wish enjoy it http://rs231l3.rapidshare.com/cgi-bin/upload.cgi?rsuploadid=139512030661883160 Error No file choosen. Share this post Link to post Share on other sites
PhelanKA7 10 Posted August 19, 2009 I wonder if anyone is planning on giving these missiles a texture? Lord knows I have no artistic skill whatsoever, or I would do it myself :D Share this post Link to post Share on other sites
Crazyfox 0 Posted October 21, 2009 It doesn't work for me on dedicated. Works when youself hosts a server. The missile get created and launches. Fly a bit, dont change direction then go down and crash. (Not close to target). After looking through the script it may be due to grouping it to a player in this line: _pilot = (group player) createUnit ["USMC_soldier", _pos, [], 0, "NONE"]; Since server is not a player? Works fine otherwise, but the missiles should go a bit higher. They usually crash into trees when there is a steep climb. Share this post Link to post Share on other sites
Lucky44 13 Posted October 23, 2009 This is very cool. Thanks for sharing your "research". I can get the missle to fly, but I can't get it to hit. I read above that it's kind of iffy. Can you suggest any tips for tweeking it to go to target? Is it better at a certain range or over/under a certain range? Does facing have anything to do with it? Intervening objects (like land or sea) help/hurt? BTW: I'm using in a multiplayer (non-dedicated) server. Thanks! Share this post Link to post Share on other sites
GDICommand 10 Posted January 13, 2011 This method isn't perfect. Sometimes the missile doesn't fly to the target and just flies in circles. I suspect the pathing for the missile is screwed. But when it works it works flawlessly. lol, i didn't fully read this thread, i just had to quote that...it made me giggle lol, sorry mankyle! Share this post Link to post Share on other sites