DaveP 66 Posted June 2, 2009 (edited) I just came across this relatively rad little gem to show you guys: Using the AttachTo command it is possible to have static guns (ie. M119, TOW Launcher) firing from a flying C130 at ground targets. Very cool Notes: -With skill set to max and positioned where they have clear aim, most static weapons will engage the targets while flying while at a relatively high altitude (700~m), with the m119 gun performing this task best (followed by the TOW launcher, M2 machine gun at lower altitudes). Thusly, the main issue of the system for me thus far is I can't remember how to keep an aircraft flying at this sort of altitude while circling an area -So far I've only got it working with the guns on top of the plane; looks naff up close, but you can't see it when it's circling above -Improper placement will cause fratricide for the plane and anyone on it -I can't see how to change the rotation/bearing of the gun beyond straight on; I originally came up with this trying to put a marksman in a heli, but realised he couldn't turn around to face outside How to do it: Really simple, far less than you'd expect: 1. Create plane, name it 2. Create gun, in init field: this attachTo [planes name, [offset array -xyz, fiddle with this]] I also group together the plane and the gun and set the guns skill to max. And that's it! Anyone that would feel like developing this further would probably do a better job than I, and this could really help with developing an AC130 addon (just cut out some holes in the c130 body, mod the static guns so you can limit their 'swng', and then incorporate these commands into the addon) I'm toying with an idea that seems like someone has done already (it's almost too easy), if so then good job all round! Test mission (call in the plane using Higher Command): http://www.sendspace.com/file/jvsd7d Edited June 3, 2009 by DaveP Share this post Link to post Share on other sites
maddogx 13 Posted June 2, 2009 Put the following into the init field of the C130: this flyInHeight 700 Thanks for the tip about the attachTo command. Sounds like we can have a lot of fun with it. :) Share this post Link to post Share on other sites
DaveP 66 Posted June 2, 2009 (edited) Put the following into the init field of the C130: this flyInHeight 700 Thanks for the tip about the attachTo command. Sounds like we can have a lot of fun with it. :) Gave it a shot, didn't work :confused: Edit: I'm an idiot, got it working! Edited June 2, 2009 by DaveP Share this post Link to post Share on other sites
maddogx 13 Posted June 2, 2009 It might take a while to reach that altitude. You could always setPos it there first. Try this: this setPos [(position this) select 0, (position this) select 1, 700]; this flyInHeight 700 Share this post Link to post Share on other sites
DaveP 66 Posted June 2, 2009 Got it working, put in player instead of this, oops. This could also be used for other cool stuff, like putting SPG-9's in the back of civvie trucks, perfect for those guerilla ops. All I wish is we could set the rotation too. Share this post Link to post Share on other sites
Commando84 0 Posted June 2, 2009 man this sounds frakkin awesome!!! :D Even with limited rotation I think people might find this useful :) Share this post Link to post Share on other sites
DaveP 66 Posted June 2, 2009 Interesting extra: If you put a mortar in the back of a truck, the GL Artillery module still works for player targetting; still yet to try with an AI artillery strike (since I still can't get them to work, haha), but if so then this could make mortars a helluva lot more useful. Share this post Link to post Share on other sites
UNN 0 Posted June 2, 2009 This could also be used for other cool stuff, like putting SPG-9's in the back of civvie trucks, perfect for those guerilla ops. Yeah, new the attach command is going to open up quite a few possibilities. All I wish is we could set the rotation too. You need to use the SetVectorUp and SetVectorDir commands once the object is attached. Share this post Link to post Share on other sites
DaveP 66 Posted June 2, 2009 You need to use the SetVectorUp and SetVectorDir commands once the object is attached. Good thinking, but it doesn't seem to be working, hmm Share this post Link to post Share on other sites
NKato 0 Posted June 2, 2009 It would also probably be a good idea to have the guns on the AC130 shoot laser-straight, regardless of distance, to ensure that we don't have any accuracy issues. It's really important. Share this post Link to post Share on other sites
DaveP 66 Posted June 2, 2009 It would also probably be a good idea to have the guns on the AC130 shoot laser-straight, regardless of distance, to ensure that we don't have any accuracy issues. It's really important. The AI M119's seem to hit the mark every time once the plane's lined up to shoot during a turn, they're really good at it compared to what the player can do Share this post Link to post Share on other sites
UNN 0 Posted June 2, 2009 Good thinking, but it doesn't seem to be working, hmm The attach command has been in VBS2 for quite a while. In VBS you can use the SetVector commands on attached objects. I don't have ArmaII atm so I cant say if the same can be said for that. Share this post Link to post Share on other sites
DaveP 66 Posted June 2, 2009 The attach command has been in VBS2 for quite a while. In VBS you can use the SetVector commands on attached objects. I don't have ArmaII atm so I cant say if the same can be said for that. It doesn't seem to change a thing, even if I put in values pulled from a command that gets the vector of another object :confused: Also, I've found that Machineguns rarely work, only firing off one or two rounds and then that's it, could be due to the ranges involved? Share this post Link to post Share on other sites
Maddmatt 1 Posted June 2, 2009 You can set the direction of the attached objects with the setdir command, but in this situation the direction is relative to the object it's attached to. That's based on my own experimenting with it. Not sure how the setvectordir commands work in this situation. Share this post Link to post Share on other sites
norrin 9 Posted June 2, 2009 AttachTo is a really amazing piece of code. The possibilities are almost endless - its what I used in the fastrope script I released earlier. Not sure if you've seen this thread here: http://forums.bistudio.com/showthread.php?t=73387 where I've been trying to do something similar - allow attached units to shoot from the top of an APC. So far I've got a script that allows a player to climb up on top of the vehicle. There's 4 positions ontop of the vehicle that can be used. From there you can shoot etc. If you use the command on a player you can change your arc of fire by bringing up the iron sites and then using the alt key to move your aim around. Its a bit limited but you can still get quite a nice field of fire. The only problem I've encountered so far is you cannot give an attached unit an action so there's no way yet I can get the player to disembark - may have to use displaysetEventhandler. If i get it sorted I'm hoping that for instance once you are seated in a chopper you could move to the doors through an action and the attachTo command and fire out using the method described above. @DaveP - to get the weapons mounted inside the plane you will most likely have to change the mempoint you are using see: http://community.bistudio.com/wiki/attachTo_(VBS2). As one thing I've found is using attachTo when inside a vehicle attaches you to a different point than when used outside a vehicle even though the coordinates are the same. Share this post Link to post Share on other sites
Maddmatt 1 Posted June 3, 2009 As one thing I've found is using attachTo when inside a vehicle attaches you to a different point than when used outside a vehicle even though the coordinates are the same. I think it's best to force the unit out of any vehicle he is in before attaching him. Setpos is one way to do that. Share this post Link to post Share on other sites
Baron von Beer 0 Posted June 3, 2009 problem with attaching infantry, seems they cannot reload, unless I'm missing something obvious. Assume due to animation change, thought that seems odd since they can kneel/go prone. Share this post Link to post Share on other sites
DaveP 66 Posted June 3, 2009 You can set the direction of the attached objects with the setdir command, but in this situation the direction is relative to the object it's attached to.That's based on my own experimenting with it. Not sure how the setvectordir commands work in this situation. Top notch! Setdir does it, SetVectorDir did nothing. Nice one! Share this post Link to post Share on other sites
NKato 0 Posted June 3, 2009 The AI M119's seem to hit the mark every time once the plane's lined up to shoot during a turn, they're really good at it compared to what the player can do There's a difference here. I'm imagining that we want to control the guns like we did in "Death From Above" in Call of Duty 4, and that's with a TV view with all of the guns properly sighted in on the crosshairs regardless of range. It should allow us to target under player control, not AI control. The goal with an AC130 mod is to make these slots usable: Pilot, and TV Operator/Gunner. If you just use AI controlled gunnery, it kind of loses its magic for some of the folks involved. Besides, the guns on the AC130 is NOT the M119. Don't forget that the AC-130 also comes equipped with a 40mm L60 Bofors (their impacts are similar to 203 HE impacts, but with significantly more damage), which is originally by design an anti-aircraft gun but can be applied to other purposes such as its role on the Spooky. I think it would be best if we opted to use the AC-130H Pave Spectre II armament, rather than the Spooky. That's strictly only one Bofors and one 105mm, so we don't have to worry about calibrating the Vulcan that would normally appear on the AC-130U. (Besides, it's plausible since the Marines tend to get hand-me-downs from the Army and the Air Force!) Here's an outline for you modders if you're serious about tackling the AC-130H: Recommended Fabrication Requirements: Occupancy Slots - Minimum, 3 (Pilot, TV operator/gunner, Navigator or Loader) Armaments - L60 40mm BOFORS, M102 Howitzer Functions - Ability to utilize FLIR (or spoofed FLIR), laser-straight accuracy with L60 and 105mm M102. Laser Designator for support, as well, especially useful in sensitive, delicate operations deep in enemy territory. Ability to use Flares in an "angel wing" arrangement is a bonus. The reason I chose the AC-130H as the suggested platform for this discussion is to simplify the vehicle to just two primary weapons, so that experimentation, fine-tuning, and improvements to the vehicle's code/scripting will not be as difficult. In a nutshell, it's easier to start with a simpler configuration, and when it's working flawlessly, upgrade it! :D Share this post Link to post Share on other sites
Scrub 0 Posted June 3, 2009 This sounds like a fantastic piece of code! A question to those who have used it, would it be possible to use this to, maybe, attach a vehicle to the deck of an LCAC? Share this post Link to post Share on other sites
DaveP 66 Posted June 3, 2009 There's a difference here. I'm imagining that we want to control the guns like we did in "Death From Above" in Call of Duty 4, and that's with a TV view with all of the guns properly sighted in on the crosshairs regardless of range. It should allow us to target under player control, not AI control.The goal with an AC130 mod is to make these slots usable: Pilot, and TV Operator/Gunner. If you just use AI controlled gunnery, it kind of loses its magic for some of the folks involved. Besides, the guns on the AC130 is NOT the M119. Don't forget that the AC-130 also comes equipped with a 40mm L60 Bofors (their impacts are similar to 203 HE impacts, but with significantly more damage), which is originally by design an anti-aircraft gun but can be applied to other purposes such as its role on the Spooky. I think it would be best if we opted to use the AC-130H Pave Spectre II armament, rather than the Spooky. That's strictly only one Bofors and one 105mm, so we don't have to worry about calibrating the Vulcan that would normally appear on the AC-130U. (Besides, it's plausible since the Marines tend to get hand-me-downs from the Army and the Air Force!) Here's an outline for you modders if you're serious about tackling the AC-130H: Recommended Fabrication Requirements: Occupancy Slots - Minimum, 3 (Pilot, TV operator/gunner, Navigator or Loader) Armaments - L60 40mm BOFORS, M102 Howitzer Functions - Ability to utilize FLIR (or spoofed FLIR), laser-straight accuracy with L60 and 105mm M102. Laser Designator for support, as well, especially useful in sensitive, delicate operations deep in enemy territory. Ability to use Flares in an "angel wing" arrangement is a bonus. The reason I chose the AC-130H as the suggested platform for this discussion is to simplify the vehicle to just two primary weapons, so that experimentation, fine-tuning, and improvements to the vehicle's code/scripting will not be as difficult. In a nutshell, it's easier to start with a simpler configuration, and when it's working flawlessly, upgrade it! :D The first obstacle to overcome in that case would be making it so the aiming point would stay fixed on a given area, so you could actually hit something; There's a very big margin for error when you try to gun it yourself, especially due to how much the plane's velocity effects where the shell will land. You appear to have overthought this a lot more than I anticipated; This is me simply throwing together whatever I could get my hands on to get a 'pretty much there' solution Share this post Link to post Share on other sites
NKato 0 Posted June 3, 2009 (edited) The first obstacle to overcome in that case would be making it so the aiming point would stay fixed on a given area, so you could actually hit something; There's a very big margin for error when you try to gun it yourself, especially due to how much the plane's velocity effects where the shell will land.You appear to have overthought this a lot more than I anticipated; This is me simply throwing together whatever I could get my hands on to get a 'pretty much there' solution You're talking to someone who's studying game development. This isn't overthinking, this is actually underthinking in terms of game dev work. :P Edit: Yeah, you should look at Mando Missiles' system for the UAV. It actually looks functional and when you click the button, it locks onto wherever you were looking at, or a given target if it's near the crosshairs. That's auto-lockon, which would be useful for dealing with larger targets. Edited June 3, 2009 by NKato Share this post Link to post Share on other sites
Kr3v 10 Posted June 3, 2009 Hi. I tried your manipulation and when I write this attachTo [my planes name, [offset array -xyz, fiddle with this (or player)]] the game says me that I missed a ]Do you know what's the problem ? Thanks. Share this post Link to post Share on other sites
DaveP 66 Posted June 3, 2009 (edited) Here's a test mission, in which I also attached a UAV to the bottom of the C130 so you can use FLIR (Updated) http://www.sendspace.com/file/jvsd7d Edited June 3, 2009 by DaveP Share this post Link to post Share on other sites
Kr3v 10 Posted June 3, 2009 (edited) Thank you, I downloaded it. Edit : Haha, it's awesome. Hope to see an AC-130 addon like in CoD 4. Edited June 3, 2009 by Kr3v Share this post Link to post Share on other sites