Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: brandx0 on September 21, 2006, 01:01:24 am

Title: AI Weapon targeting selection?
Post by: brandx0 on September 21, 2006, 01:01:24 am
Is there any way at all to force the AI to use certain weapons against certain classes of object?  Obviously it has a preference, but for example, telling it not to use flak guns against a capital ship, or large beams against fighters (or for that matter, using large beams against fighters)

Basically it's not a requirement for a project of mine, but would certainly help me out a lot, some sort of flag or something that could force the AI to only fire certain weapons at certain types of enemy.
Title: Re: AI Weapon targeting selection?
Post by: Wanderer on September 21, 2006, 02:53:49 am
Well... weapons do have several such flags available... From http://www.hard-light.net/wiki/index.php/Weapons.tbl (http://www.hard-light.net/wiki/index.php/Weapons.tbl)

"small_only"
Forces AI to use weapon only against small targets (such as fighters and bombers).

"Huge"
Forces AI not to use weapon against small targets like fighters and bombers and can further be extented to not to target bombs - with ai profiles table.

Also "Bomber+"
Which can be used with "Huge" flag to allow the AI to fire the weapon against bombers but not at fighters.
Title: Re: AI Weapon targeting selection?
Post by: Shade on September 21, 2006, 03:00:20 am
In addition to those, there are two SEXPs for mission designers to set the targeting priority of turrets (such as bombs->ships->asteroids, for example): ship-turret-target-order and turret-set-target-order, where the first is for all turrets on a ship and the second for individual turrets.
Title: Re: AI Weapon targeting selection?
Post by: brandx0 on September 21, 2006, 02:36:56 pm
Oh, thanks.  I'd never seen small only, and I thought that huge was the counterpart to big damage for ships.
Title: Re: AI Weapon targeting selection?
Post by: Raptor on September 21, 2006, 03:08:20 pm
Also "Bomber+"
Which can be used with "Huge" flag to allow the AI to fire the weapon against bombers but not at fighters.

So If a weapon has both 'huge' and 'bomber+', it will shoot at bombers and above but not fighters?

I've been using 'bomber+' on its own, and the weapons still fire at fighters...
Title: Re: AI Weapon targeting selection?
Post by: Scooby_Doo on September 21, 2006, 04:24:43 pm
I'd like to see huge weapons that can target fighters when no other large ships are in target range.
Title: Re: AI Weapon targeting selection?
Post by: brandx0 on September 21, 2006, 07:27:48 pm
An extrapolation of this idea: Anti-missile systems?

First off, if we could define the bomb flag to not only have it be destroyable by weapons fire, but also be able to toggle whether the AI prefers it to use on large ships or not.  Then, one could hypothetically make all missiles in the game with the bomb flag, minus the preference for anti-ship use.  After that, one could expand the flags option on primaries to make a weapon only shoot at these bombs (or not, if desired) and put it on a turret and voila, anti-missile/phalanx system.
Title: Re: AI Weapon targeting selection?
Post by: Raptor on September 22, 2006, 02:21:01 am
An extrapolation of this idea: Anti-missile systems?

First off, if we could define the bomb flag to not only have it be destroyable by weapons fire, but also be able to toggle whether the AI prefers it to use on large ships or not.  Then, one could hypothetically make all missiles in the game with the bomb flag, minus the preference for anti-ship use.  After that, one could expand the flags option on primaries to make a weapon only shoot at these bombs (or not, if desired) and put it on a turret and voila, anti-missile/phalanx system.

There's been some discussion about this topic in the SCP Forum.  But in my experiance the Coders are not going to do anything with the Turret sections of code.  'Very messy' according to them. :sigh:

By default, whenever a bomb is launched, all the turrets on a ship target it, even those that can't actually see it :wtf:  Thus one bomb is fired, and the ship becomes completely focused on shooting it down, regardless of all other considerations (I've seen it happen many a time :rolleyes:)

There are work arounds, the best at the moment is the use of the 'SEXPs' Shade posted before, though it does mean you have to add them in to every mission for every capship :nervous:

You can get huge weapons to not shoot at bombs by default (which makes sense... the weapon can't target a fighter, so it never could tag a bomb) with the use of a new .tbl file the SCPers came up with.  But getting one is nigh on impossible (I've tried and failed :()
Title: Re: AI Weapon targeting selection?
Post by: Wanderer on September 22, 2006, 08:14:50 am
You can get huge weapons to not shoot at bombs by default (which makes sense... the weapon can't target a fighter, so it never could tag a bomb) with the use of a new .tbl file the SCPers came up with.  But getting one is nigh on impossible (I've tried and failed :()
You mean the file?

http://koti.mbnet.fi/vekkup/FS2/tbms/test-aip.tbm

You need to copy that file to mod/data/tables and then use fred to select the ai_profile for the mission.