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

FLMM Find & Replace or append?

The general place to discuss MOD''ing Freelancer!

Post Fri Oct 22, 2004 2:49 am

FLMM Find & Replace or append?

Hey hey. I'm pretty new at modding in Freelancer, but I've dabbled with it in a few other games.

I'm not terribly XML savvy, so is there a way to Find & Replace text in the .ini files, say by line or some coordinate system ("5th line after fc_x_ge_fighter", for random example) or is it ok to just append redundant data and let Freelancer figure out which of the duplicate, yet slightly different entries you want it to use?

Say I wanted to make a mod that changed all the stock game npc shields' regen rates, max capacity and toughness to bring them more in line with the pc's shields. Can I just add all the npc shield entries at the end again with different values? I've read Chips' tutorial on doing that manually, and I've done that. I was just wondering if there's a way to make those modifications more compatible with other mods.

I'm a bit of a purist, and so I don't like the big mods that "unlock all ships, weapons and make them all buyable at Manhattan". I'd just like to make a few mods for my own use that just make the world more "real" and feel more like a complete game for me. I plan to make my own "Starblazer mod", in which I plan to not only make the ship buyable, but also have it flown by npcs. The number of entries I'll have to alter and add is daunting, though that won't stop me if it's the only way.

I also like the idea of mass drivers, but the one mod I've seen for those isn't FLMM compatible. Least not compatible with my 1.31 version of it. I'm confident that I can make my own though.

PS - While proofreading my post, it hit me that if there was a way to comment out lines with the XML script, I could then append my lines without having to replace the whole .ini file. Is that possible?

Post Fri Oct 22, 2004 4:33 am

Fraid its a case of doing them all i think. however - you can cut and paste from a script i did in the admins mod (Available in downloads section - do a search, or alternatively in my own forums section (see about 7 below this forum for Pathfinderstudios - and then check thread saying its all our mods). I included it as an option for admins to select the level of regen - so feel free to swipe that straight out in order to relieve the hard work

Post Fri Oct 22, 2004 7:43 am

You're asking if there's a way to replace specific values with an xml script? If so you can use the sectionreplace or replace methods. Here's an example of the sectionreplace used to bump up the capacity and regen rate of the npc 01/01 shield:

first opening tag to tell where and what you're doing:
<pre><font size=1 face=Courier><data file="data\equipment\st_equip.ini" method="sectionreplace"> </font></pre>

set of <section> tags to tell which section you're targeting, just needs to show something unique to that section.(in this case the nickname, in the case of some ships you need to go to the ids_name):
<pre><font size=1 face=Courier><section>
[ShieldGenerator
nickname = npc_shield01_mark01
</section> </font></pre>

paired <dest> tags that show what you're replacing:
<pre><font size=1 face=Courier><dest>
regeneration_rate = 1
max_capacity = 600
toughness = 6.000000
</dest> </font></pre>

paired <source> tags that show what you're replacing with:
<pre><font size=1 face=Courier><source>
regeneration_rate = 140
max_capacity = 6000
toughness = 6.000000
</source> </font></pre>

closing tag for the <data> tag at the top.
<pre><font size=1 face=Courier></data> </font></pre>



Here's the whole thing without the breaks since it looks funny like that:

<pre><font size=1 face=Courier><data file="data\equipment\st_equip.ini" method="sectionreplace">
<section>
[ShieldGenerator
nickname = npc_shield01_mark01
</section>
<dest>
regeneration_rate = 1
max_capacity = 600
toughness = 6.000000
</dest>
<source>
regeneration_rate = 140
max_capacity = 6000
toughness = 6.000000
</source>
</data> </font></pre>


If you're planning to replace the regen and capacity of all the shields you can use the "replace" method and just do them all with just one child:

<pre><font size=1 face=Courier><data file="data\equipment\st_equip.ini" method="replace">
<dest>
[ShieldGenerator
nickname = npc_shield01_mark01
ids_name = 263759
ids_info = 264759
DA_archetype = equipment\models\st\li_refractor_shield.3db
material_library = equipment\models\li_equip.mat
HP_child = HpConnect
hit_pts = 400
explosion_resistance = 0.500000
debris_type = debris_normal
parent_impulse = 20
child_impulse = 80
volume = 0.000000
mass = 10
regeneration_rate = 1
max_capacity = 600
toughness = 6.000000
hp_type = hp_fighter_shield_special_1
offline_rebuild_time = 12
offline_threshold = 0.150000
constant_power_draw = 0
rebuild_power_draw = 10
shield_type = S_Graviton01
shield_collapse_sound = shield_offline
shield_rebuilt_sound = shield_rebuilt
shield_hit_effects = 0, gf_li_shield01
shield_hit_effects = 100, gf_li_shield02
shield_hit_effects = 500, gf_li_shield03
separation_explosion = sever_debris
LODranges = 0, 20
lootable = false

[ShieldGenerator
nickname = npc_shield01_mark02
ids_name = 263760
ids_info = 264760
DA_archetype = equipment\models\st\li_refractor_shield.3db
material_library = equipment\models\li_equip.mat
HP_child = HpConnect
hit_pts = 548
explosion_resistance = 0.500000
debris_type = debris_normal
parent_impulse = 20
child_impulse = 80
volume = 0.000000
mass = 10
regeneration_rate = 1
max_capacity = 821
toughness = 8.200000
hp_type = hp_fighter_shield_special_2
offline_rebuild_time = 12
offline_threshold = 0.150000
constant_power_draw = 0
rebuild_power_draw = 10
shield_type = S_Graviton01
shield_collapse_sound = shield_offline
shield_rebuilt_sound = shield_rebuilt
shield_hit_effects = 0, gf_li_shield01
shield_hit_effects = 100, gf_li_shield02
shield_hit_effects = 500, gf_li_shield03
separation_explosion = sever_debris
LODranges = 0, 20
lootable = false

etc, etc, all the shields as long as there are no breaks
</dest>

<source>
[ShieldGenerator
nickname = npc_shield01_mark01
ids_name = 263759
ids_info = 264759
DA_archetype = equipment\models\st\li_refractor_shield.3db
material_library = equipment\models\li_equip.mat
HP_child = HpConnect
hit_pts = 400
explosion_resistance = 0.500000
debris_type = debris_normal
parent_impulse = 20
child_impulse = 80
volume = 0.000000
mass = 10
regeneration_rate = 140
max_capacity = 6000
toughness = 6.000000
hp_type = hp_fighter_shield_special_1
offline_rebuild_time = 12
offline_threshold = 0.150000
constant_power_draw = 0
rebuild_power_draw = 10
shield_type = S_Graviton01
shield_collapse_sound = shield_offline
shield_rebuilt_sound = shield_rebuilt
shield_hit_effects = 0, gf_li_shield01
shield_hit_effects = 100, gf_li_shield02
shield_hit_effects = 500, gf_li_shield03
separation_explosion = sever_debris
LODranges = 0, 20
lootable = false

[ShieldGenerator
nickname = npc_shield01_mark02
ids_name = 263760
ids_info = 264760
DA_archetype = equipment\models\st\li_refractor_shield.3db
material_library = equipment\models\li_equip.mat
HP_child = HpConnect
hit_pts = 548
explosion_resistance = 0.500000
debris_type = debris_normal
parent_impulse = 20
child_impulse = 80
volume = 0.000000
mass = 10
regeneration_rate = 200
max_capacity = 8400
toughness = 8.200000
hp_type = hp_fighter_shield_special_2
offline_rebuild_time = 12
offline_threshold = 0.150000
constant_power_draw = 0
rebuild_power_draw = 10
shield_type = S_Graviton01
shield_collapse_sound = shield_offline
shield_rebuilt_sound = shield_rebuilt
shield_hit_effects = 0, gf_li_shield01
shield_hit_effects = 100, gf_li_shield02
shield_hit_effects = 500, gf_li_shield03
separation_explosion = sever_debris
LODranges = 0, 20
lootable = false
</source>
</data> </font></pre>

Might seem like alot of data just to replace two lines but if you're just doing this for yourself it won't matter. Also if you put it up for download this will zip down to almost nothing, it'll use alot less space than moding inside the file itself does.

Edit = Looked really bad with the breaks so I put the whole thing in at the bottom
Edit#2 = Came back to add the fact that you can use the "replace" method to just do them all.

Edited by - kaegogi on 10/22/2004 9:08:20 AM

Post Fri Oct 22, 2004 9:45 am

This is excellent, kaegogi! Just what I was hoping for! I'm a bit of a compatibility-freak, so I like my mods to have as little impact on the files I'm modding as possible. With this, that's possible.

I can use the sectionreplace method repeatedly if I wanted to, right? I'd like to just replace those values I'm changing, and leave everything else alone.

ALSO, is it possible to aim an append to a specific place as well, to add the nanobots and batteries to all the loadouts they're needed on? Or would I achieve that with some form of the sectionreplace method?

Thanks kaegogi for the XML help and Chips again for the tutorials and ideas!

<edit> Just found the "sectionappend" method, and it looks like it uses the same syntax as "sectionreplace", so that's super! Thanks again! </edit>

Edited by - ZeligtheLiar on 10/22/2004 11:10:17 AM

Post Fri Oct 22, 2004 4:04 pm

Yay! Finally finished my first XML-only mod. I did the Self Healing NPCs thing with it and after a few debuggings and a couple of false starts I finally got the syntax down and it's working perfectly. It only replaces and appends those things that are in my mod, leaving all other data in the .ini files completely alone.

It might not sound like much to some, but it's a big deal to me. Thanks guys for your help here and in the incredible tutorials I've been wading through. Now to work on my Starblazer mod, but first a bit of time away from the keyboard.

Post Wed Oct 27, 2004 7:33 pm

Glad to help. Also glad you found your answers. You probably already found this but if you open FLMM and go to Help and then click on "How Do I Make a Mod Work With FLMM" you'll find that there are some very cool things you can do with xml through FLMM.

If you want an easy way to build your xml files you can use Paddy's xml Scripter

Post Thu Oct 28, 2004 6:35 am

Why do section replace when you can just delete? Since most script files either append which means addon, or replace which means replace original code with new. Following this train of thought further, most edits are done on full SDK files so if you're replacing a section, why not just delete the reference thereby not having to use section replace at all! Result is smaller files and no duplicate bug entries in Ioncross... game on!

Edited by - Gibbon on 10/28/2004 7:36:06 AM

Post Thu Oct 28, 2004 3:10 pm

I wanted to use sectionreplace to change something without having to generate all new entries. For instance, I used sectionreplace in my own version of the NPC self-repairing mod like this:

<data file="DATA\MISSIONS\pilots_population.ini" method="sectionreplace">
<section>
[Pilot
nickname = light_fighter_default
</section>
<dest>
repair_id = repair_fighter_never
</dest>
<source>
repair_id = repair_fighter_both
</source>
</data>

repeated for each of the pilot nicks.

I like to have as little impact on the original files as possible. I think deleting the whole section, when another mod might have appended or replaced something else there, would be more destructive than using a specific replacement. Also, having as little modification in my mod would allow anyone that felt inclined to include it in their own with very little adjustment.

I've made a great deal of use of sectionreplace in my own Starblazer mod, which I'm pretty happy with so far. I've put the ship in the hands of the various NPC factions that fly civilian fighters. I can't wait to start fighting them. If anyone else would like to test it out I'd be happy to email it to you. Until I'm satisfied that it's as bug-free as I can get it I don't want to upload it publicly. I'm fairly anal about my own mods.

Return to Freelancer General Editing Forum