zodd 14 Posted March 8, 2015 (edited) Gday all, Unfortunately I wont be able to work on this any more but it is at least basically functioning and hopefully people can either have a bit of fun with it or use the ideas to develop a (much) more polished version! The scripts here are generally functional but represent only a proof of concept rather than a watertight solution! It came from an idea in the addon request thread; there are no mods/scripts readily available that allow helmet slaved cannons. This is a pretty poor implementation I will freely admit but I figured it is better to get it out there so people can have fun with it than just bin it all together. Demo: Note the aiming mark is the origin of the pilot's velocity vector line (unsure of correct name) in the middle of the HUD. Drawbacks: - You need an AI gunner (No other way to directly control the gun unfortunately) - It is sometimes a little slow at reacting or will lose the target briefly - Sometimes it will hover in one spot close to where you are looking - fix for this is look around a bit to 'reset' it - Only finds the terrain point - wont use heights of objects (eg. generally will just fire at the base of a building) - No indication if you look past the limits of the cannon; it will return to forward position until you look back within the arc Usage- Chopper init: nul = [this] execVM "slavedGunInit.sqf" Scripts: slavedGunInit.sqf: _unit = _this select 0; _unit setVariable ["CANNON_SLAVED_ACTIVE", false]; _unit addAction [ "Toggle Slaved cannon", "trackLookSpot.sqf", "", 5, false, true, "", "_this == (driver _target)" ]; trackLookSpot.sqf: _unitToTrack = _this select 0; if (_unitToTrack getVariable ["CANNON_SLAVED_ACTIVE", true]) then { _unitToTrack setVariable ["CANNON_SLAVED_ACTIVE", false]; } else { _unitToTrack setVariable ["CANNON_SLAVED_ACTIVE", true]; _moveObj = "LaserTargetW" createVehicle [0,0,0]; _moveObj hideObject true; _gunner = gunner (vehicle _unitToTrack); _gunner commandTarget _moveObj; _gunner disableAI "AUTOTARGET"; _gunner disableAI "TARGET"; _unitToTrack action ["ManualFire", vehicle _unitToTrack]; while {_unitToTrack getVariable ["CANNON_SLAVED_ACTIVE", false]} do { _gunner = gunner (vehicle _unitToTrack); _wPos = screenToWorld [0.5,0.5]; _moveObj setPos _wPos; _gunner reveal [_moveObj, 4]; //_gunner doTarget _moveObj; //_gunner doWatch _moveObj; sleep 0.01; }; deleteVehicle _moveObj; _gunner enableAI "AUTOTARGET"; _gunner enableAI "TARGET"; _unitToTrack action ["manualFireCancel", vehicle _unitToTrack]; } These scripts are completely free to use/modify/improve/etc without any restrictions - Hopefully someone is able to develop a better implementation. While I only used mouse look in the video demo, it should work no issues with track IR/VR etc - While the hacky implementation isnt great, it should open up some more solo piloting options. (The scripts above can quite easily be modified to add an AI gunner if one is not present) Enjoy! Edited March 8, 2015 by Zodd Share this post Link to post Share on other sites
scotg 204 Posted March 18, 2015 So this isn't something we can just drop into the vehicle's config.cpp? How would we go about setting this up for a new vehicle? I just realized yet again how little I know about making addons. I have a new chopper working, but so far I haven't tackled the weapons (cannon turret, 4 missiles, 1 bomb) or the MFD stuff. Share this post Link to post Share on other sites
MrHuachuca 10 Posted March 18, 2015 Oh wow, this is really interesting. I was kinda getting tired of the Cobra and commanche not having HDF (head direction firing) only mod that has this is the FZA Helicopter mod. Glad to see this is now able to be on most of the helicopters in Arma 3. Nice job! Share this post Link to post Share on other sites
scotg 204 Posted April 3, 2015 Does anybody know how to implement this into their own creation? I don't want to bother Zodd with it, but I'm struggling to figure out where in my config.cpp I would use this: nul = [this] execVM "slavedGunInit.sqf" Also, are the .sqf examples he gives complete files, or just the important parts of a file we are expected to already know? Share this post Link to post Share on other sites
orcinus 121 Posted April 3, 2015 Does anybody know how to implement this into their own creation? I don't want to bother Zodd with it, but I'm struggling to figure out where in my config.cpp I would use this:Also, are the .sqf examples he gives complete files, or just the important parts of a file we are expected to already know? As the original post indicated, that line goes in the init line of the chopper when you place it in the editor. Nothing to do with the chopper's config. AFAICT the scripts are complete. Copy each and paste it into a text editor like notepad++, then save it as "all files" with the name shown above each script box. Then copy those into your mission folder. Don't use Windows Notepad for editing ArmA files - with line wrapping on, saving any split line results in a space being inserted where the line was wrapped. Breaks the script. Share this post Link to post Share on other sites
scotg 204 Posted April 3, 2015 Ok, Thanks Orcinus. I've just been working with the configs and model - nothing more advanced than that. I was actually kind of hoping for something a little more pre-packaged that will work without extra input at the editor level. Something that we could indeed drop into our config files, or make a special .sqf for, if possible. Also, I found this (focus on example 3): https://community.bistudio.com/wiki/weaponsTurret Would that help with a simpler solution to the goal? Share this post Link to post Share on other sites
orcinus 121 Posted April 3, 2015 I don't see how that example helps (but never having tried to make a model, I could be completely wrong:) ). Might be easiest just to turn the script into an addon, adding a condition that excludes AI pilots. Share this post Link to post Share on other sites
scotg 204 Posted April 3, 2015 Oh yeah the script looks like it just calls upon all types of ammo for a weapon. I was just looking at this part: _driverWeapon = _ka50pilot weaponsTurret [-1] I'm just wondering if there's a way to use that part for this. I really want to get my one-man assault chopper working right. Meanwhile, I've dropped that first line nul = [this] execVM "slavedGunInit.sqf" into my chopper init, but got an error message that it could not find the .sqf files. That means I placed them in the wrong place, so:A. Where will the .sqf files need to be located for the game to find them? B. If they pack into the pbo, where in relation to the chopper config.cpp should they be? Share this post Link to post Share on other sites
zodd 14 Posted June 3, 2015 Strewth - sorry for absence in this thread, I checked on it a few days after I posted and there was nothing but notifications must have been turned off... oops! It seems that most of the issues that were raised have been sorted but basically these are just simple scripts to add to your mission files. As Orcinus said it is just a matter of saving the scripts in your mission file (Even if you dont tinker with scripts normally, Notepad++ is a worthy download!) and putting this line in the init line of the chopper in the editor: nul = [this] execVM "slavedGunInit.sqf" The sqf files should just be placed in your mission root folder before you pack it (same dir as your mission.sqm) but this will require an AI gunner to work. There are no issues with this being used on pure AI choppers as the slaved toggle is something that a player pilot has turn on/off specifically. It could definitely be turned into an addon (and more than happy to do that if people want and/or someone can take these as a base for a mod) but the reason I shied away from it is it is a bit too hackish at the moment... You need an AI gunner because as far as I can tell there is no way to access (set) the cannon orientation via script. The benefit of the current implementation is the AI gunner is basically simulating the software that takes your look rotation and gives it to the gun so the actual affect is not too bad. It is not perfect by any stretch (and if your gunner gets killed, unfortunately a bit of shrapnel must also hit the slaved cannon computer... ha!) but it does the job in the interim and can be VERY satisfying even with just mouselook. I would be very interested to see how it works with VR headsets if anyone has tried it! Share this post Link to post Share on other sites
pulstar 55 Posted January 22, 2016 Strange that this script didn't get wider adoption. I really like the idea of this, since you can get headtracking on the cheap. I will try to implement it as an addon for my personal use. Share this post Link to post Share on other sites
ineptaphid 6413 Posted February 4, 2016 Strange that this script didn't get wider adoption. I really like the idea of this, since you can get headtracking on the cheap. I will try to implement it as an addon for my personal use. Would love a copy if you manage it. Share this post Link to post Share on other sites
shomu1 193 Posted February 4, 2016 I wouldn't mind it either. Share this post Link to post Share on other sites
Foxone 1044 Posted March 6, 2016 Is there a way to to have the Slaved Cannon controlled by a gunner that is a player? Or is that Arma being Arma? It should be do-able, as Nodunit and Franze have something like this in their AH-64D Apache mod 1 Share this post Link to post Share on other sites