Jump to content
Sign in to follow this  
Kildar

Anti-Air Soldier Converter

Recommended Posts

Just a very, very, simple script for converting soldiers into anti-air specialists, since there isn't a unit fulfilling this role by default in the A3 Alpha. Anyone who knows the least bit about scripting would be able to write this for himself, but maybe some of you will find this convenient.

Simply copy the following code into "scripts\gear\aa.sqf" in your mission directory and follow the instructions.

CHANGELOG

v1.0 2013-03-24-2345 Initial release

v1.1 2013-03-25-0045 Fixed missing semicolon, used addMagazines instead of addMagazine.

/*//===========================================================================

ANTI-AIR SOLDIER CONVERTER v1.1
Created by Kildar

---------------------------------------------------------------------------
DESCRIPTION:
Effectively converts a target soldier into an anti-air specialist 
by giving him a RPG-32 with n surface-to-air missiles.

The actual number of missiles provided is contingent on available 
inventory space. Magazines cannot currently be loaded directly into 
weapons, so there must be room for at least one missile prior to running 
the script.	

USAGE:
Place the following in the init line of target unit, where nMissiles is 
the integer number of missiles desired:	

	null = [this, nMissiles] execVM "scripts\gear\aa.sqf";

EXAMPLE(S):
	To provide an AA soldier with 2 missiles, use:
	null = [this, 2] execVM "scripts\gear\aa.sqf";

---------------------------------------------------------------------------
CHANGELOG
v1.0	2013-03-24-2345	Initial release
v1.1	2013-03-25-0045	Fixed missing semicolon, used addMagazines instead 
						of addMagazine.

*///===========================================================================

// Get arguments
_soldier	= _this select 0;
_nMissiles	= _this select 1;

// Remove pre-existing launchers and munitions
_soldier removeMagazine ["NLAW_F", 1];
_soldier removeMagazine ["RPG32_F", 1];
_soldier removeWeapon	"launch_NLAW_F";
_soldier removeWeapon	"launch_RPG32_F";

// Provide ammunition and launcher
if (_nMissiles > 0) then {
_soldier addMagazines ["RPG32_AA_F", _nMissiles];
};

_soldier addWeapon "launch_RPG32_F";

Chopper pilots watch out.

Edited by Kildar
v1.1

Share this post


Link to post
Share on other sites

Nice dude be useful this, anyway would you be able to do this for the air vehicles as they only use the machine guns, say for instance you want them to destroy a building even if they cant see enemy they just shoot it or summit?

Share this post


Link to post
Share on other sites
Nice dude be useful this, anyway would you be able to do this for the air vehicles as they only use the machine guns, say for instance you want them to destroy a building even if they cant see enemy they just shoot it or summit?

All this script does is give a unit, be it AI or player, the RPG-32 with some AA ammo for shooting down choppers (and cars). I'm not sure what would happen if the script was run on a vehicle, but only infantry units can use the launcher.

What you're looking for is best done using the editor. Right now there's an Invisible Target Soldier under the Objects (Training) class that the AI will fire at, although it won't use rockets because it thinks it's shooting at infantry only. Until someone creates something similar like a vehicle target, this is the closest I can get you to what you want. Somebody more experienced may know better.

Edit: After some more experimenting, AI pilots will use rockets after expending all minigun rounds (which takes longer than you think, even on 4x speed). If you can figure out how to remove all the bullets but leave the rockets (the ammunition slider affects both proportionally), you can force a rocket run.

Edited by Kildar

Share this post


Link to post
Share on other sites

Ok dude ive found some stuff. gonna try and see if i can remove all ammo then add missile ammo.

missiles_DAR  //weapon name of heli

24Rnd_missiles //ammo

---------- Post added at 22:06 ---------- Previous post was at 21:27 ----------

Right dude this removes the ammo and the AI used rockets but they didn't use rockets till they done a second fly over, going to have to sort way points out to get them to fire at the house to destroy it but hey good so far.

this removeMagazinesTurret ["5000Rnd_762x45_Belt", [-1]];  

Share this post


Link to post
Share on other sites

The heli should fire on the first pass as long as it has time to line up its run. Try starting the heli farther away, but make sure it also detects its target in time, maybe using doTarget or a destroy waypoint if necessary, and make sure its line of fire isn't obstructed by another building.

If you get it working please do share. I imagine this could come in handy at some point.

Edit: I have a mission in the works where 2 AH-9s attack 2 IFRITs, and after the new stable release they don't use their rockets first anymore even though the targets are vehicles. What a pain.

Edited by Kildar

Share this post


Link to post
Share on other sites

Yeah vehicles bit shit, I've not had chance yet but sure ill get the heli to destroy building.

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  

×