Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

Make NPCs using torps

The general place to discuss MOD''ing Freelancer!

Post Sat Sep 03, 2005 2:55 am

Make NPCs using torps

Has anyone found out how to do this? I wondered why my Bombers don't use them, even if there's no other weapon to shoot with.

I thought about a [TorpedoBlock in pilots_population.ini, but haven't tried yet. Btw I think this wouldn't be successful because I don't even know if something like this exists. Maybe one can find out by looking at one of the DLLs. The problem is that I can do nothing with DLLs but ids_names and infos.

There are other ways, of course, like editing a missile, making it class 10 and giving that hardpoint only to the bombers, but that doesn't please me at all...

Post Sun Sep 04, 2005 10:48 am

Hi!

In the pilots_population.ini scroll down to the job_block of the pilot you are using in your encounter. There you should see a section like this:

attack_preference = capital, 5000, guns / guided / unguided
attack_preference = cruiser, 5000, guns / guided / unguided
attack_preference = gunboat, 5000, guns / guided / unguided
attack_preference = fighter, 5000, guns / guided / unguided
attack_preference = freighter, 5000, guns / guided / unguided
attack_preference = transport, 5000, guns / guided / unguided
attack_preference = weapons_platform, 5000, guns / guided / unguided
attack_preference = solar, 5000, guns / guided / unguided
attack_preference = anything, 5000, guns / guided / unguided

now I changed it to this:

attack_preference = fighter, 5000, guns / guided / unguided
attack_preference = freighter, 5000, guns / guided / unguided
attack_preference = transport, 5000, guns / guided / unguided
attack_preference = gunboat, 5000, Torpedo / guided / guns / unguided
attack_preference = cruiser, 5000, Torpedo / guided / guns / unguided
attack_preference = capital, 5000, Torpedo / guided / guns / unguided
attack_preference = weapons_platform, 5000, guns / guided / unguided
attack_preference = solar, 5000, Torpedo / guided / guns / unguided
attack_preference = anything, 5000, guns / guided / unguided

and my encounters attack all capitals and stations with torpedos. It works perfectly in my mod (It should also work with fighters and all the other shipclasses).
So just change these lines to anything you want and be sure that the pilot, who is declared in your encounter file has the job_block you changed. Then your NPCs should use torpedos first.
If you delete all the other things, leaving the line like this:

attack_preference = gunboat, 5000, Torpedo

they should only use torpedos and no other weapons. However this last thing is not tested!

Hope this helps!

Black Eagle

Post Sun Sep 04, 2005 2:16 pm

You are my god! It works!

Do you also know how I can change the range from where, how often etc. they shoot the torpedos, or is this done by the MissileBlocks? And even if not, you saved my mod. Thanks again.

Post Sun Sep 04, 2005 9:42 pm

Well, gee... I'll have to test this for the XML Toolkit Mod. Silly me, I just had the "anything" line enabled for the AIs.

Post Mon Sep 05, 2005 5:09 am

Hi again!

I think the missileblocks should do for the shooting interval. However, if it does not work for torps you could still try to change the gunblock or just create totally new torpedoblocks. I'm not sure if anything of this works, but it's worth a try and in my opinion the missileblock should do the trick.

And thanks for the nice words, glad to help you

Black Eagle

Post Sun Apr 16, 2006 1:18 pm

I know this one is old, but I implemented the things recommended here.

Now I want to have a cruiser fire a torpedo salvo at a base from about 6.5 K distance. I've equipped the ship with a scanner with a range of 20000, so it can see the base, and then armed it with two torpedo slots and gave it the appropiate ammo. I then changed the JobBlock to include weapon instructions looking like this:
<pre><font size=1 face=Courier>attack_preference = SOLAR, 5000, TORPEDO / GUNS / GUIDED / UNGUIDED
attack_preference = CAPITAL, 5000, TORPEDO / GUNS / GUIDED / UNGUIDED
attack_preference = CRUISER, 5000, TORPEDO / GUNS / GUIDED / UNGUIDED
attack_preference = ANYTHING, 5000, GUNS / GUIDED / UNGUIDED </font></pre>
I also changed the MissileBlock to include this:
<pre><font size=1 face=Courier>[MissileBlock
nickname = missile_longrange
missile_launch_interval_time = 0.000000
missile_launch_interval_variance_percent = 0.000000
missile_launch_range = 10000
missile_launch_cone_angle = 360
missile_launch_allow_out_of_range = True </font></pre>

Both together should assure a ship can fire from the given distance at a base that is hostile. (I checked out if it works by moving the cruiser closer to the base, and it fired two torpedos). The distance seems to be the problem and I can't find another entry that I would have to change in order to have the cruiser fire torps over long distances.

Any ideas?

EDIT: Maybe it's a matter of the torp itself? Is it's range limited by anything else than "seeker_range = 10000"? If so, that's where the problem might be.

Post Sun Apr 16, 2006 3:24 pm

I think the torp's lifetime also affects this sort of thing- if it's not going to get there, I don't think the AI would launch, but I could be wrong.

Chris Bates

Post Sun Apr 16, 2006 3:37 pm

It turned out that, judging by muzzle velocity, accelleration and duration of accelleration, the torpedo could only have travelled around 5K, not the 6K+ I need. So I doubled the lifetime and now the torp could easily reach the station.

However, that's still not the solution. Good idea, though. I hadn't thought of that before.

EDIT: Can it be that there is some hardcoded limitation to how far the AI will shoot? Anyway, I'll try moving the whole thing closer to the station first thing in the morning.

Edited by - Manhattan_Guy on 4/16/2006 5:06:08 PM

Post Mon Apr 17, 2006 2:37 am

I'd have thought the limitation lies in:

The radar range - they cannot shoot what they do not know is there - hence how you can fly straight past hostile ships in a nebula or zone where interference = 1.

Give them a stupidly long range radar (about 10k in fact). Be aware that they may still not attack the target though - you may need to alter your zones to include the target in the zone, and remove any other enemy spawns (so they don't get distracted).

This way they'll also fly towards it (if they are going to attack it that is).

Post Mon Apr 17, 2006 3:16 am

Ships will only spawn within a radius of x km from a player ship, so if you're hanging around by the station then you'll porbably be outside that range.

Post Mon Apr 17, 2006 6:19 am

@Chips: As I posted earlier, I gave them a scanner with a range of 20000. Should be enough.

@Accushot: No, I hang around with the ships, not with the station. So I should at least see them fire their torps, even if they never reach the station.

Post Wed Apr 19, 2006 4:18 am

No other ideas?

Post Wed Apr 19, 2006 5:47 am

Shouldn't it be:
SOLAR, 6500, TORPEDO.....
If you wanted the pilot to fire at the target?

Post Wed Apr 19, 2006 6:07 am

Have you tried from 2k and worked backwards? If it works, try 3k etc? See what range it stops at... I know you've said you've had it working at other ranges, more interested in where it stops working though.

Edited by - Chips on 4/19/2006 7:08:36 AM

Post Wed Apr 19, 2006 6:24 am

@M-A-C-E: Why should it be 6500?

@Chips: Yes, that's what I plan to do once I have the time.

Return to Freelancer General Editing Forum