Jump to content
Sign in to follow this  
Simon C

AC130 Scripting

Recommended Posts

Hi all.

I've downloaded rjtwins' AC130 pack, and I'm trying to create a script to automate the process. I've managed to create a copy of the C130 with the display name 'AC-130' that shows up in the editor and can be placed. Here is my config.cpp:

//AC-130 Config

#define TEast		0
#define TWest		1
#define TGuerrila		2
#define TCivilian		3
#define TSideUnknown		4
#define TEnemy		5
#define TFriendly		6
#define TLogic		7

#define true	1
#define false	0


class CfgPatches {
class sc_ac130 {
	units[] = { "sc_ac130" };
	weapons[] = {};
};
};

class DefaultEventhandlers;

class CfgVehicles {
class AllVehicles;	// External class reference

class Air : AllVehicles {};

class Plane : Air {};

class C130J : Plane {};

class sc_ac130 : C130J {
	displayName = "AC-130";
	class EventHandlers : DefaultEventhandlers
	{
		Init = "_this exec ""\ac130\init.sqs""";
	};

};
};

And here is init.sqs

_spooky = _this select 0

_gau12 = 'GAU_12U_Equalizer' createVehicle [0,0,100]
_bofors = 'L60_Bofors_cannon' createVehicle [0,0,200]
_howitzer = 'M102_cannon' createVehicle [0,0,300]

_gau12 attachto [_spooky,[0,-3,-7]]
_bofors attachto [_spooky,[0,1.5,-7]]
_howitzer attachto [_spooky,[0,6,-7]]

So far, the AC-130 is created, but there are no guns attached to it. I'm assuming that the script is either not running or is broken. Anyone know how to get this working?

Thanks in advance. :)

Share this post


Link to post
Share on other sites

It is likely that the guns are there, but not manned. createVehicle does not put AI in them, but simply the vehicle. You may have to place the vehicles manually on the map, and name them ... Then do something like this for the init:


_spooky = _this select 0;

_gau12 = _this select 1;
_bofors = _this select 2;
_howitzer = _this select 3;

_gau12 attachto [_spooky,[0,-3,-7]];
_bofors attachto [_spooky,[0,1.5,-7]];
_howitzer attachto [_spooky,[0,6,-7]];

Then for the init line of the plane do:

nul=[this, gau12, bofors, howitzer] execVM "\ac130\init.sqs";

I have not tested this do to my being at work, but this seemingly makes sense...

Share this post


Link to post
Share on other sites

That's what I'm trying to get around doing, placing them on the editor. They don't have to be manned for my purposes, but the problem is that the guns don't actually show up. Thanks for the help though, I wasn't expecting a comment so soon. :p

Share this post


Link to post
Share on other sites

The guns do not show up in the original addon either, this is for aesthetic purposes... So that there are not ugly guns just chillin under the plane. Hence why the AI is there, to show you where the gun positions are, or in MP purposes, playable spots to place yourself in.

Share this post


Link to post
Share on other sites

Oh, I didn't know that. Hmmm, that's messed up my idea then. :p

Again, thanks for the help. :)

Share this post


Link to post
Share on other sites

Dont worry about this .... once mandoble releases his Mando Missiles 2.35 beta you will be able to do this without ANY trouble at all.

Share this post


Link to post
Share on other sites

Ah yes, been following that topic very closely. :D

Share this post


Link to post
Share on other sites

Hey, Simon C, I'm working on this same thing!

Your guns are probably there, but with that "-7", they are below the aircraft in the ground.

Here's my thread on armaholic...

http://www.armaholic.com/forums.php?m=posts&q=7942&d=0

Maybe we can coordinate and can get some of these problems fixed sooner than if we do them separately! :)

Here's a new vid with some of my progress...

fTH2gd87_y4

For the weapons, I used these entries:

GAU:
this attachto [gunship2,[-0.4,7.6,-3.2]]; this setdir 270; 

Bofors:
this attachto [gunship2,[-0.9,0,-5.2]]; this setdir 270; this setVectorUp [2,1,-8]; 

Then, I actually used an M119 (looks better than the model originally used but I haven't edited the original AC-130 config yet) and used this:
this attachto [gunship2,[-0.5,-2.5,-3.5]]; this setdir 270; this setVectorUp [2,1,-8];

The setVectorUp is just being used to get the downward tilt to the weapons. Unfortunately, when weapons are inverted, the AI jump out as soon as you load them up as gunners. That's why the GAU isn't inverted. I'm in the middle of testing it in the above video.

Please note, that as soon as you load up a gunner, they will rotate the guns toward the centerline of the aircraft or do a 180 degree turn or whatever suits their little AI minds. Can't seem to stop them, even if I turn off AI behavior.

Anyway, I'd love to use your script idea here for my AC-130U plane that I was planning on releasing soon. I'm almost done with the skin and I just started working on the scripting (which I'm pretty weak at). Your script solves one of my biggest problems, getting the weapons onto the plane, if it works. I haven't tested it yet, actually. :) Maybe I'm getting my hopes up.

EDIT: Hmm, I can't seem to get the sqs file to work either. I'm going to try to add the weapons and magazines to the plane's config itself when I get home. maybe if that "loads" those weapons when the AC-130 is created, that will help this init file to find the weapons or something.

If I can get this to work, I'll be golden for releasing a standalone AC-130 with custom skin, custom weapons (from rjtwins), FLIR (from General_Carver), multiplayer compatible, etc.

Edited by Feint
more info...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×