j0nes 194 Posted July 2, 2013 Well heres the final orbiting script! it now works in heavily scripted missions, although there is still some minor lag, it is very playable, the rotation is just slow. I will be creating a dialog shortly that will allow you to change the rotational speed of the aircraft, but not the height or radius. The radius is changeable through the variable DMM_radius = number; the default is 2000m. The height you have to be to start autopilot is determined by the radius +200m. this is to make sure the scripting works correctly in calculating the center (a failsafe).You must be the pilot to start and stop the script. The script will terminate if the crew of the plane is dead or empty, the plane is dead, or it is manually aborted via DMM_orbit_active = false; You must be within 15 degrees of level (pitch and bank) to start the script and be above the aforementioned height. The autopilot is not adjustable (aside from the rotation speed which is forthcoming) in flight, this will give the pilot the responsibility of lining the target up correctly for his gunners as well as monitoring the rotation speed an countermeasures during orbit. While I finish fine tuning some of the other model stuff Im giving you all the scripts. If anyone sees any improvements, feel free to make them and re-post! I will eventually be turning these scripts in to a module for use in the editor with any aircraft in both a pilot activated and gunner activated version. the scripts are called via the vehicle init: null = [this]execVM "scripts\orbit\init.sqf"; scripts\orbit\init.sqf DMM_plane = _this select 0; DMM_plane_active = isengineon DMM_plane; null = [DMM_plane]execVM "scripts\orbit\actions.sqf"; autopilot_allowed = true; DMM_fnc_getpitchbank = compile preprocessFileLineNumbers "scripts\orbit\getpitchbank.sqf"; while {(alive DMM_plane)} do { if (!DMM_plane_active) then { DMM_orbit_active = false; hint "your engines must be on!"; }; if (!DMM_orbit_active) then{ null = [DMM_plane] execVM "scripts\orbit\kill_orbit.sqf"; }; if ({alive _x} count crew DMM_plane == 0) then { DMM_orbit_active = false; }; sleep 0.01; }; scripts\orbit\actions.sqf while {(alive DMM_plane)} do { waituntil {autopilot_allowed}; if (autopilot_allowed) then{ DMM_plane removeaction _manualcontrol; DMM_plane removeaction _autopilot; _autopilot = DMM_plane addAction [("<t color=""#FE642E"">" + ("Autopilot") + "</t>"),"scripts\orbit\orbit_check.sqf",["Autopilot"], 5, false, false, "", "driver _target == _this"]; autopilot_allowed = false; }; waituntil {manualcontrol_allowed}; if (manualcontrol_allowed) then { DMM_plane removeaction _autopilot; DMM_plane removeaction _manualcontrol; _manualcontrol = DMM_plane addAction [("<t color=""#FE642E"">" + ("Manual Control") + "</t>"),"scripts\orbit\kill_orbit.sqf",["Manual Control"], 5, false, false, "", "driver _target == _this"]; manualcontrol_allowed = false; }; }; scripts\orbit\getpitchbank.sqf (this is BIS_fnc_getpitchbank, it just makes it usable without a functions module in the editor) private ["_obj","_pitch","_bank","_yaw","_vdir","_vup","_rotate","_sign"]; _obj = _this; _yaw = getdir _obj; _rotate = { private ["_v","_d","_x","_y"]; _v = +(_this select 0); //we don't want to modify the originally passed vector _d = _this select 1; _x = _v select 0; _y = _v select 1; _v set [0, (cos _d)*_x - (sin _d)*_y]; _v set [1, (sin _d)*_x + (cos _d)*_y]; _v }; _vdir = vectordir _obj; _vdir = [_vdir, _yaw] call _rotate; if ((_vdir select 1) != 0) then { _pitch = atan ((_vdir select 2) / (_vdir select 1)); } else { if ((_vdir select 2) >= 0) then {_pitch = 90} else {_pitch = -90}; }; _vup = vectorup _obj; _vup = [_vup, _yaw] call _rotate; _vup = [_vup select 0] + ([[_vup select 1, _vup select 2], 360-_pitch] call _rotate); if ((_vup select 2) != 0) then { _bank = atan ((_vup select 0) / (_vup select 2)); } else { if ((_vdir select 2) >= 0) then {_bank = 90} else {_bank = -90}; }; if((_vup select 2) < 0) then { _sign = [1,-1] select (_bank < 0); _bank = _bank - _sign*180; }; [_pitch, _bank]; scripts\orbit\orbit_check.sqf if(!isNil DMM_radius) then {DMM_radius = DMM_radius}else {DMM_radius = 2000;}; DMM_height = (getposATL DMM_plane select 2); DMM_pitch = DMM_plane call DMM_fnc_getPitchBank; if (DMM_height >= (DMM_radius +200) && ((DMM_pitch select 1) <= 15) && ((DMM_pitch select 1) >= -15) && ((DMM_pitch select 0) <= 15) && ((DMM_pitch select 0) >= -15)) then { null = [DMM_plane] execVM "scripts\orbit\orbit.sqf"; DMM_orbit_active = true; _id = _this select 2; DMM_plane removeaction _id; }else{ hint format ["you must be at least %1m above Terrain, and the aircraft must be within 15 degrees of level.",(DMM_radius +200)]; }; scripts\orbit\orbit.sqf DMM_orbit_angle = (getdir DMM_plane); DMM_orbit_center = "HeliHEmpty" createvehiclelocal [0,0,0]; titletext ["AUTOPILOT ACTIVATING","BLACK OUT"]; 1 fadeSound 0; sleep 1; _pos = DMM_plane modelToWorld [DMM_radius*-1,0,0]; DMM_orbit_center setPos [_pos select 0,_pos select 1,_pos select 2]; DMM_orbit_center setdir (getdir DMM_plane); DMM_plane attachto [DMM_orbit_center]; _dir = ((getdir DMM_orbit_center)-90); _pitch = 0; _bank = -15; _vecdx = sin(_dir) * cos(_pitch); _vecdy = cos(_dir) * cos(_pitch); _vecdz = sin(_angle); _vecux = cos(_dir) * cos(_pitch) * sin(_bank); _vecuy = sin(_dir) * cos(_pitch) * sin(_bank); _vecuz = cos(_pitch) * cos(_bank); DMM_plane setVectorDirAndUp [ [_vecdx,_vecdy,_vecdz], [_vecux,_vecuy,_vecuz] ]; DMM_orbit_center_marker = createmarkerlocal ["DMM_orbit_center",(getpos DMM_orbit_center)]; DMM_orbit_radius_marker = createmarkerlocal ["DMM_orbit_radius",(getpos DMM_orbit_center)]; DMM_orbit_plane_marker = createmarkerlocal ["DMM_plane_marker",(getpos DMM_plane)]; DMM_orbit_center_marker setmarkercolorlocal "colorblack"; DMM_orbit_center_marker setmarkershapelocal "ICON"; DMM_orbit_center_marker setmarkertextlocal "CENTER"; DMM_orbit_center_marker setmarkertypelocal "Select"; DMM_orbit_plane_marker setmarkercolorlocal "colorBLUE"; DMM_orbit_plane_marker setmarkershapelocal "ICON"; DMM_orbit_plane_marker setmarkertypelocal "b_plane"; DMM_orbit_plane_marker setmarkertextlocal "Aircraft"; DMM_orbit_radius_marker setmarkercolorlocal "colorblack"; DMM_orbit_radius_marker setmarkershapelocal "Ellipse"; DMM_orbit_radius_marker setmarkerbrushlocal "Border"; DMM_orbit_radius_marker setmarkersizelocal [DMM_radius,DMM_radius]; sleep 1; 1 fadeSound 1; titletext ["","BLACK IN"]; autopilot_allowed = false; manualcontrol_allowed = true; while {DMM_orbit_active && (alive DMM_plane)} do { sleep 0.001; DMM_orbit_angle = DMM_orbit_angle - 0.03; DMM_orbit_center setdir DMM_orbit_angle; DMM_orbit_plane_marker setmarkerposlocal (getpos DMM_plane); DMM_orbit_plane_marker setmarkerdirlocal (getdir DMM_plane); }; scripts\orbit\kill_orbit.sqf _id = _this select 2; DMM_plane removeaction _id; detach DMM_plane; deletevehicle DMM_orbit_center; deletemarkerlocal DMM_orbit_center_marker; deletemarkerlocal DMM_orbit_radius_marker; deletemarkerlocal DMM_orbit_plane_marker; autopilot_allowed = true; _v=1; while{_v<50}do{ (vehicle player) setvelocity [_v* sin (getdir (vehicle player)),_v * cos (getdir (vehicle player)),.1]; _v=_v+6; sleep 0.2; }; enjoy! and an update will be coming soon...I promise Share this post Link to post Share on other sites
j0nes 194 Posted July 8, 2013 (edited) well here it is!! version 1.2 is out!! https://www.youtube.com/watch?v=YZGsElniWQs&feature=c4-overview&list=UUHTZReFmZA_lBHH0Vas1jOw SEE POST #109 FOR DOWNLOAD CHANGELOG: -finalized autopilot -tested on dedicated server -AP now runs in heavily scripted missions -adjusted gun sounds -added USAF camo (unfinished) -changed weapon impact/explosion effects as well as readjusted the damages for each -fixed minor core bugs with AI -increased zoom -thermal imaging is now WHOT,BHOT,GHOT,RHOT -centered guns known issues: -may not work perfectly in multiplayer, havent done a ton of testing on it yet -autopilot script varables (height,radius) will effect all aircraft in the air -may encounter problems if more than one ac130 is using autopilot at once -misc. texture errors Edited July 9, 2013 by J0nes Share this post Link to post Share on other sites
Guest Posted July 9, 2013 Updated version frontpaged on the Armaholic homepage. Ac-130x v1.2 Share this post Link to post Share on other sites
legolasindar 3 Posted July 9, 2013 Good news, i test this new version. Share this post Link to post Share on other sites
rahmad_cakep46 10 Posted July 9, 2013 sory jones,,,i download ur AC-130X... after i try in editor but why i don't understand,i can't use ur AC 130x & kick me out to dekstop n say "confing: some input after End of file" ? what this bug? i try again not use any mod...but i only use ur mod but it's same? why jones ? can you help me? Share this post Link to post Share on other sites
Val 10 Posted July 9, 2013 I've noticed that there are some sensors are placed differently on real AC-130. Do you plan to change them? That would be really nice. http://img600.imageshack.us/img600/5430/o6fk.jpg Share this post Link to post Share on other sites
j0nes 194 Posted July 9, 2013 got the same problem.... Im re-packing everything now and Ill post the new link in a second. I guess it had something to do with when I compressed the file, because when i put it directly in my folder it works fine. never had this problem with a mod before, but ill fix it! ---------- Post added at 13:39 ---------- Previous post was at 13:33 ---------- found it! :) apparently the "binarize" button on my bin PBO got unchecked some how, ill be fixing the link here and updating foxhound when its done, thanks for finding this! this could have been a nightmare ---------- Post added at 13:57 ---------- Previous post was at 13:39 ---------- @Val I dont plan to change the sensors because even though this is an ac130, its not the AC130U. its the AC130X. this is a fictional plane for a couple reasons 1. it was originally intended only for ArmA III 2. at the time I mad the additions to CrashNZs C130H model I wasnt a very good 3d artist so I didnt want to try to make it look perfectly realistic the guns were originally going to retract as well, thas why theyre domes instead of the actual housing on the regular ac130s. I tried to base this off the actual plane as much as possible, however I wanted to add my own design elements to it as well. The main reason Im not changing the sensors is not so much cosmetically, but the bullets actually spawn right in front of the camera....spoiler... so changing the position of the camera itself messes with the firing dynamics of the aircraft. I dont mean any of this to be rude, just explaining my reasoning. ---------- Post added at 14:05 ---------- Previous post was at 13:57 ---------- new download link here: DOWNLOAD Share this post Link to post Share on other sites
rahmad_cakep46 10 Posted July 9, 2013 I was very confused jones ! ! ! I have downloaded 2 times again, but still the same result , and again I was thrown out to the desktop with the words "confing :some input after end of FILE " i hope you are Fix it Share this post Link to post Share on other sites
j0nes 194 Posted July 9, 2013 make sure youre using the download link above, not the one on armaholic, foxhound hasnt had a chance to fix that one yet. Share this post Link to post Share on other sites
Guest Posted July 9, 2013 Thanks for the headsup J0nes! I have updated the Armaholic mirror with the fixed version. :) I refer to it as version 1.2 fixed to indicate this is a fixed version, I hope that is ok with you. Updated version frontpaged on the Armaholic homepage. Ac-130x v1.2 fixed Share this post Link to post Share on other sites
rahmad_cakep46 10 Posted July 9, 2013 thanks Jones I am very impressed with your work .... nice You are very quick to respond to shortage of you work ...:) Share this post Link to post Share on other sites
SSgt Decker 4 Posted July 9, 2013 This is a great mod! Thanks for your work! :) Share this post Link to post Share on other sites
DaViSFiT 21 Posted July 9, 2013 Thx! Would be great to see a Version for arma2/3 playable multiplayer ;) Share this post Link to post Share on other sites
j0nes 194 Posted July 9, 2013 should be playable in multiplayer! my clan will do testing on it, now that I have this version out. but please feel free to try it with your friends, the more/quicker feedback I get, the faster I can improve it Share this post Link to post Share on other sites
kill4eva 10 Posted July 10, 2013 Nice Improvements =]...but cant increase/decrease center radius & altitude of the autopilot...is that just me or glitch? Share this post Link to post Share on other sites
j0nes 194 Posted July 10, 2013 unfortunately that has been removed alltogether, that part of the script was very expensive, due to the calculations it had to make to determine both where the plane was as well as where it needed to be and then decide if it could move or not. The autopilot now runs on a semi-fixed radius\height using "attachto" instead of "setpos" which contributed to 90% of the lag. I say semi-fixed, because the starting height is radius +50 and the radius should be able to be set at the beginning of a mission (or maybe just in the init field of the aircraft?) with DMM_radius = whatever. I made this change for both the reasons above, figuring that playabiltiy in this case overrides modification-ability as well as now it provides the pilot with more of a precise task on to properly judging his target to line his gunners up for the best attack. P.S. the height is above terrain level, not above sea level. so if you set it at 1000 (default) you have to be 1050m above terrain (your shown altitude) to start the script. the +50 meters ensures that the script wont make calculation errors due to fluctuation in terrain. Share this post Link to post Share on other sites
sorophx 25 Posted July 15, 2013 we had a couple of problems with this mod, just throwing it here in case it wasn't mentioned before. it's concerning ACE. when you initialize the auto-pilot while having players in the gunner's position, they get teleported out of the plane. and in that moment ACE wounds is triggered somehow, they both lose consciousness for a minute or so: the screen becomes black for both of them. Share this post Link to post Share on other sites
j0nes 194 Posted July 15, 2013 ah yes, I havent done any testing im MP or with ACE, so thank you! i will get around to making an ACE version, but it might be a while unfortunately, but Im sure its just defining some ACE characteristics in the cfgvehicles section Share this post Link to post Share on other sites
j0nes 194 Posted July 16, 2013 did the first multiplayer test thisevening! everything went flawlessly. now that (aside from ACE issues) it is %100 functional Im going to re-do the visual model. Ive gotten a much better hold on how to model in O2 and ive gone out and purchased a plastic AC130 replica for reference :) the interior will be walkable as well as there will now be an internal view when youre in the gunners seat instead of just being forced into optics. Im not sure when it will be done, but I hope youll bear with me a little while longer as this project nears completion! Share this post Link to post Share on other sites
sorophx 25 Posted July 17, 2013 wow, great news. thanks for the update. really looking forward to it Share this post Link to post Share on other sites
tabakhase 10 Posted July 18, 2013 @ACE blackout, its the "stop" when you where moving at some hundreds speeds in a plane -and then- freeze on a point ;D Haven't tested yet whats the best way around, but there is a API to temporary disable G´s / heal players by script, maybe just removing the velocity is already enough^^ - or give them superpowers ;P Share this post Link to post Share on other sites
sorophx 25 Posted July 22, 2013 oh, makes sense :) I am not sure there is a need for a workaround really. it doesn't kill the player, just a minor nuisance, so I wouldn't bother Share this post Link to post Share on other sites