Alright, first off, hello boys. Sorry I didn't see this earlier - I don't frequent TLR forums very often, and I only knew of this after BP pointed me to it, actually. X_x
For basic NPC follow, it is indeed as Bejaymac stated - you increase the NPC speech time, fooling the game into thinking that the "hey buddy I'm going to scan you now" speech is 9999 seconds long, which never advances the NPC AI past the "follow player" state.
Now, the problem is this - should the NPC wing ever encounter enemies, the formation leader will move his wing to attack the enemies, and stop following you - producing the "one-shot wingmen" that were featured in 88 Flak pre-1.25 versions. A work-around for this is simple - you give the formation leader for the following wing a ship with a 0-range scanner (all AI need to scan you is a scanner with a long enough "cargo_scan_range" variable - the actual "range" variable of the scanner should be 0) - this means that the formation leader will never see enemies, and will just keep following you until you log out, die, land, jump systems, etc. - and, the actual formation's wingmen will always follow your directive, since the formation leader is always with you. (so, when you flee a fight, wingmen will flee with you; wingmen won't engage an enemy until you engage / the enemy is within a certain range)
On a side note, in Flak 1.25 and later, some DLLs were edited a bit so instead of the gcs_scan_announce voice being used, the rms_friendlyarrival voice was used (so you'd hear "hey I'll watch you back" instead of "hey I'll scan your cargo now" ) - if you were to look in the voice files for the latest flak, you'd see all rms_friendlyarrival speech having a duration of 9999 seconds instead.
Now, normally, when an NPC goes to scan something, it calls a "DirectiveTrailOp" AI function - the formation leader will follow so many meters behind the target (the range of the follow defined under TrailBlock in pilots_population.ini). However, in 1.26 and later, I made a small DLL edit that forced cargo-scans to call a "DirectiveFollowOp" function - this made the formation leader follow 50m (this is locked at 50m) to the right of the target, and also enabled trade-lane travel with them - so, since you never saw the formation leader (as it was cloaked), it was just like having real player-wingmen, trade-lane travel and all.
Now, the real pain of incorporating "proper" NPC wingmen (that is, good follow AI, proper speech, etc.) into a mod is that you have to do a few DLL / EXE hacks (sorry, no two ways around it), and set up the systems in a specific way. For instance, I don't know if anyone here has looked at the AI Companion Bot in the latest 88 Flak betas yet (
http://www.memes.no/88flak/forum/viewtopic.php?t=106), but this is a rather extreme example of that requiring a web of about 200 patrol paths in every system to generate the system-wide bot spawns (only one squad per-player too). For NORMAL wingmen, you'd just need a separate encounter that calls some sort of invisible ship (look at Flak's patrolp_follow.ini encounter), and have that encounter placed on every patrol path (what I did in the systems was insert a patrolp_follow encounter to every patrol path zone, using the same factions as what was there already). For example, a common encounter setup for a patrol path in Flak looks like this:
encounter = patrolp_assault, 1, 0.140000
faction = li_n_grp, 1.000000
encounter = patrolp_follow, 19, 0.05 ;0.140000
faction = li_n_grp, 1.000000
encounter = patrolp_bh_assault, 1, 0.200000
faction = gd_bh_grp, 1.000000
encounter = patrolp_follow, 19, 0.05 ;0.200000
faction = gd_bh_grp, 1.000000
As you can imagine, this is a complete pain in the arse, because you have to go through every patrol path and MANUALLY insert the follow thing, making sure you're using the same faction lines and whatnot - this would normally take a LOT of time. Luckily, I normally use ConTEXT for all my programming-related editing, which supports a macro function that made this a breeze (I set it up to copy every "encounter = " line with all "faction = " lines under it, and change the "encounter = " line to read "encounter = patrolp_follow" ). Explaining how to macro something like that is kinda awkward, and is something I hope to cover in a planned tutorial.
So yeah, to wrap that all up, I hope this enlightened some of you as to how exactly NPC wingmen tick. I plan to port wingmen to normal Freelancer, and include a tutorial in it on how to implant them into a mod. I may even be able to include ConTEXT and the needed macros to properly set up a system, meaning all you'd have to do in the end is open up the system with ConTEXT and press a button (literally).
Edited by - fox Unit 01 on 4/8/2007 12:47:22 PM