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

*Tutorial* Creating Modular Mods

Here you find the different tutorials on editing and MODing Freelancer

Post Tue May 17, 2005 12:10 pm

*Tutorial* Creating Modular Mods

Firstly, you're probably wondering what I mean by modular mods.

What I mean is mods which are installed without needing to modify the original freelancer ini files, or at least as few as possible.

Whats the point? I hear you ask.

Well, the answer is simple. Modular mods could be easily turned on an off by removing or adding a few lines to freelancer.ini This will keep file structure clean and keep mods out of the original files. Each mod will have it's own ini files in its own directory. It makes it much easier to activate and deactivate mods, it will keep everything seperate so you know exactly which files belong mo which mods.

Installing these mods would be a matter of copying and pasting a folder into a folder called mods and adding a few lines into freelancer.ini.

How does it work?

When freelancer loads, it loads each of the ini files that are referenced in freelancer.ini. By adding entries to freelancer.ini it's possible to make freelancer load data from other ini files meaning the original files can remain untouched.

It's possible to add ini files which control the following things (and more):

-Add Ships
-Add Weapons
-Add Comodities
-Add Systems
-Add Bases/Jumpholes/Wrecks
-Change Constants
-Change initialworld and newcharacter info
-Add Effects
-Add/Remove all market info


I'll now walk through a couple of examples of how to do this.

To keep things organized, first we'll create a folder called MODS inside freelancer\DATA then each mod will have its own folder. I also advise, to keep things simple, using the same directory structure and file names as freelancer uses.

Lets make a very simple mod, Alter the cruising speed to 1000. Using the standard method we would alter constants.ini so for modular based modding create a folder in Freelancer\DATA\MODS called cruise1000 and inside it a file called constants.ini (So that the file Freelancer\DATA\MODS\cruise1000\constants.ini

exists) add the following to your new file:

[EngineEquipConsts
CRUISING_SPEED = 1000

[PhySysConsts
ANOM_LIMITS_MAX_VELOCITY = 1000

(remember to put back the ending square bracket)

The beauty is you only need to add the things you are changing, none of the other constants need to be stored in this file.

Finally, freelancer needs to be able to see your file so open up Freelancer\EXE\freelancer.ini, find the [data section and scroll down to the end of it (Above the [error section) and add:

;Enable fast cruise speed
constants = mods\cruise1000\constants.ini

You're done! Now you have a crusing speed of 1000 without modifying the existing files so it will work with any other mod!*

*If you have another mod defining cruise speed by altering constants.ini, the value will be overwritten because your new constants.ini is referenced after

the original one in freelancer.ini

There are some limitations, of course. Like info cards, and mods which require editing specific dll files or freelancer.exe. There are also some ini files which are not referenced in freelancer.ini for example most of the ini files in the DATA\INTERFACE folder.

Well that turned out to be more of an article discussing the use of loading ini files in this way, but I hope it's useful. I'll post some better examples of how to do this with more complex mods later on.

Next: How to add a ship in this way.

Edited by - TheJkWhoSaysNi on 5/17/2005 1:11:34 PM

Post Tue May 17, 2005 12:53 pm

Adding a ship as a "module".

I'll add a flyable Battleship Osiris (Based on the Cheap realistic battleship by Wanderer & IGx89).

Firstly we'll create a folder in Freelancer\DATA\MODS called "Osiris". This is where all the data for the Osiris will go.

The following files are needed. For continuity I have kept the same file names and directory structure as freelancer. They could be called anything. Infact, all the "goods" files could be put into one file, all the "equip" files could be put into one. But since freelancer splits them up, I will too.

(These are the files we would edit if we were adding the osiris in the normal way)

SHIPS\shiparch.ini
EQUIPMENT\engine_equip.ini
EQUIPMENT\goods.ini
EQUIPMENT\market_misc.ini
EQUIPMENT\market_ships.ini
EQUIPMENT\st_equip.ini
EQUIPMENT\weapon_equip.ini
EQUIPMENT\weapon_good.ini

We would also need to add a cockpit for the osiris somewhere in the cockpits folder.

Since we're installing the mod as a module, create all the neccesary files and the structure inside your DATA\MODS\Osiris folder so now you have:


MODS\Osiris\SHIPS\shiparch.ini
MODS\Osiris\EQUIPMENT\engine_equip.ini
MODS\Osiris\EQUIPMENT\goods.ini
MODS\Osiris\EQUIPMENT\market_misc.ini
MODS\Osiris\EQUIPMENT\market_ships.ini
MODS\Osiris\EQUIPMENT\st_equip.ini
MODS\Osiris\EQUIPMENT\st_good.ini
MODS\Osiris\EQUIPMENT\weapon_equip.ini
MODS\Osiris\EQUIPMENT\weapon_good.ini

We also need a cockpit so create this file too:

MODS\Osiris\COCKPITS\or_dreadnaught.ini

The contents of these files will be almost exactly what would have been added to the original files if we were adding the ship in the normal way. I'll include all the code anyway, i've included comments where differences are.

MODS\Osiris\SHIPS\shiparch.ini will contain (ONLY) the following:

[Ship
ids_name = 237043
ids_info = 66584
nickname = or_dreadnaught_ship
LODranges = 0, 600, 800, 1000, 1500, 2000, 3000, 20000
msg_id_prefix = gcs_refer_shiparch_Ordb
mission_property = can_use_berths
type = FREIGHTER
DA_archetype = ships\order\or_osiris\or_osiris.cmp
material_library = Ships\order\or_ships.mat
material_library = fx\envmapbasic.mat
envmap_material = envmapbasic
explosion_arch = explosion_instant
fuse = o_osiris_fuse, 0.500000, 1
fuse = or_osiris_burning_fuse03, 0.000000, 17325
surface_hit_effects = 0, small_hull_hit_light01, small_hull_hit_light02, small_hull_hit_light03
surface_hit_effects = 150, small_hull_hit_medium01, small_hull_hit_medium02, small_hull_hit_medium03
surface_hit_effects = 300, small_hull_hit_heavy01, small_hull_hit_heavy02, small_hull_hit_heavy03
steering_torque=24000, 24000, 58000
angular_drag=15000, 15000, 35000
rotation_inertia=2800, 2800, 1000
linear_drag = 2.000000
nudge_force = 360000.000000
strafe_force = 3000000
nanobot_limit = 100
shield_limit = 100
mass = 100000.000000
hold_size = 1000000
bay_door_anim = Sc_open baydoor
bay_doors_open_snd = hanger_doors_opening
bay_doors_close_snd = hanger_doors_closing
HP_bay_surface = HpBayDoor01
HP_bay_external = HpBayDoor02
HP_tractor_source = HpTractor_Source
num_exhaust_nozzles = 1
hit_pts = 69300
cockpit = mods\osiris\cockpits\or_dreadnaught.ini ;Notice the path is to where the cockpit is inside our mod folder
camera_offset = 80, 370
camera_angular_acceleration = 0.050000
camera_horizontal_turn_angle = 23
camera_vertical_turn_up_angle = 5
camera_vertical_turn_down_angle = 30
camera_turn_look_ahead_slerp_amount = 1.000000
hp_type = hp_turret_special_10, HpTurret_O1_01
hp_type = hp_turret_special_10, HpTurret_O2_01
hp_type = hp_turret_special_8, HpTurret_O4_01
hp_type = hp_turret_special_8, HpTurret_O4_02
hp_type = hp_turret_special_8, HpTurret_O4_03
hp_type = hp_turret_special_8, HpTurret_O4_04
hp_type = hp_turret_special_9, HpTurret_O3_01
hp_type = hp_turret_special_9, HpTurret_O3_02
shield_link = l_freighter_shield01, HpMount, HpEngine01, HpEngine02, HpEngine03, HpEngine04
hp_type = hp_freighter_shield_special_10, HpEngine01, HpEngine02, HpEngine03, HpEngine04

MODS\Osiris\EQUIPMENT\engine_equip.ini

[Engine
nickname = ge_obat_engine_01
ids_name = 263888
ids_info = 264888
volume = 400.000000
mass = 10
max_force = 9000000
linear_drag = 100000
reverse_fraction = 0.500000
flame_effect = gf_li_largeengine02
cruise_charge_time = 10
cruise_power_usage = 20
rumble_sound = rumble_battleship
indestructible = false
outside_cone_attenuation = -3
inside_sound_cone = 90
outside_sound_cone = 270

MODS\Osiris\EQUIPMENT\goods.ini

[Good
nickname = or_dreadnaught
category = shiphull
ship = or_dreadnaught_ship
price = 150
ids_name = 12018
item_icon = Equipment\models\commodities\nn_icons\bw_freighter.3dba

[Good
nickname = or_dreadnaught_package
category = ship
hull = or_dreadnaught
addon = ge_s_scanner_01
addon = infinite_power
addon = ge_s_tractor_01
addon = ge_obat_engine_01
addon = sfx_rumble_battleship

MODS\Osiris\EQUIPMENT\market_misc.ini

;*We're actually updating the market info for Manhattan here. It's adding these to the list of sold goods of manhattan. It does not overwrite the old info, it adds too it.

[BaseGood
base = Li01_01_base
MarketGood = or_battleship_turret01, 0, -1, 10, 10, 0, 1
MarketGood = or_battleship_turret04, 0, -1, 10, 10, 0, 1
MarketGood = or_battleship_missile_turret01, 0, -1, 10, 10, 0, 1

MODS\Osiris\EQUIPMENT\market_ships.ini

;*Again, we're adding a ship, however, I've had to do a little work around. Due to freelancer only allowing 3 ships to be for sale at each base, one of the existing ships needs to stop being sold there. In the marketgood lines, the third number is a boolean value storting whether that package is sold or not. So to replace lf_package with our osiris package lf_package needs to stop being sold. It's done by setting it to not sold there. A 0 in the third column.


[BaseGood
base = Li01_01_base
marketgood = lf_package, 1, -1, 0 , 1, 0, 1, 1;stop this ship being sold, so the osiris can be
marketgood = or_dreadnaught_package, 0, -1, 1, 1, 0, 1, 1

MODS\Osiris\EQUIPMENT\st_equip.ini

[ShieldGenerator
nickname = shield01_mark10_cap
ids_name = 263818
ids_info = 264818
DA_archetype = equipment\models\st\li_refractor_shield.3db
material_library = equipment\models\li_equip.mat
HP_child = HpConnect
hit_pts = 6752
explosion_resistance = 0.500000
debris_type = debris_normal
parent_impulse = 20
child_impulse = 80
volume = 0.000000
mass = 10
regeneration_rate = 1500
max_capacity = 30000
toughness = 500
hp_type = hp_capital_shield_special_10
offline_rebuild_time = 30
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_pi_shield01
shield_hit_effects = 100, gf_pi_shield02
shield_hit_effects = 500, gf_pi_shield03
separation_explosion = sever_debris
LODranges = 0, 20
lootable = true

MODS\Osiris\EQUIPMENT\st_good.ini

[Good
nickname = shield01_mark10_cap
equipment = shield01_mark10_cap
category = equipment
price = 500
item_icon = equipment\models\commodities\nn_icons\EQUIPICON_shieldgen.3db
combinable = false
ids_name = 263818
ids_info = 264818
shop_archetype = equipment\models\st\li_refractor_shield.3db
material_library = equipment\models\li_equip.mat


MODS\Osiris\EQUIPMENT\weapon_equip.ini
;*Long but exactly what would have gone into weapon_equip.ini if we were adding the mod normally

[Munition
nickname = or_battleship_turret01_ammo
hp_type = hp_gun
requires_ammo = false
hit_pts = 2
hull_damage = 10000.500000
energy_damage = 0
one_shot_sound = fire_capship_forward_gun
munition_hit_effect = li_capgun_01_impact
const_effect = li_cruiser_maingun
lifetime = 3.500000
force_gun_ori = false
mass = 1
volume = 0.000100

[Gun
nickname = or_battleship_turret01
ids_name = 263379
ids_info = 264379
DA_archetype = equipment\models\turret\li_turret01.cmp
material_library = equipment\models\li_turret.mat
HP_child = HPConnect
hit_pts = 4800
explosion_resistance = 1.000000
debris_type = debris_turret_huge
parent_impulse = 20
child_impulse = 80
volume = 50.000000
mass = 10
hp_gun_type = hp_turret_special_10
damage_per_fire = 0
power_usage = 0
refire_delay = 5.000000
muzzle_velocity = 1500
toughness = 2.500000
flash_particle_name = li_capgun_01_flash
flash_radius = 15
light_anim = l_gun01_flash
projectile_archetype = or_battleship_turret01_ammo
separation_explosion = sever_debris
auto_turret = true
turn_rate = 90
lootable = false

[LOD
obj = Root
LODranges = 0, 1200

[LOD
obj = barrel
LODranges = 0, 1000

[Munition
nickname = or_battleship_turret04_ammo
hp_type = hp_gun
requires_ammo = false
hit_pts = 2
hull_damage = 140.799999
energy_damage = 0
one_shot_sound = fire_capship
munition_hit_effect = li_capgun_01_impact
const_effect = li_capgun_01_proj
lifetime = 1.500000
force_gun_ori = false
mass = 1
volume = 0.000100

[Gun
nickname = or_battleship_turret04
ids_name = 263382
ids_info = 264382
DA_archetype = equipment\models\turret\li_turret04.cmp
material_library = equipment\models\li_turret.mat
HP_child = HPConnect
hit_pts = 4800
explosion_resistance = 1.000000
debris_type = debris_turret_small
parent_impulse = 20
child_impulse = 80
volume = 50.000000
mass = 10
hp_gun_type = hp_turret_special_8
damage_per_fire = 0
power_usage = 0
refire_delay = 0.150000
muzzle_velocity = 1500.199951
toughness = 0.800000
flash_particle_name = li_capgun_01_flash
flash_radius = 15
light_anim = l_gun01_flash
projectile_archetype = or_battleship_turret04_ammo
separation_explosion = sever_debris
auto_turret = true
turn_rate = 90
lootable = false

[LOD
obj = Root
LODranges = 0, 450

[LOD
obj = barrel
LODranges = 0, 500

[Motor
nickname = or_battleship_missile_turret01_motor
lifetime = 1.875000
accel = 250.111099
delay = 0

[Explosion
nickname = or_battleship_missile_turret01_explosion
effect = ku_torpedo01_impact
lifetime = 0.000000, 0.000000
process = disappear
strength = 100
radius = 30
hull_damage = 1867.500000
energy_damage = 0
impulse = 0

[Munition
nickname = or_battleship_missile_turret01_ammo
explosion_arch = or_battleship_missile_turret01_explosion
hp_type = hp_gun
requires_ammo = false
hit_pts = 2
one_shot_sound = fire_missile_regular
detonation_dist = 4
lifetime = 30.375000
Motor = or_battleship_missile_turret01_motor
force_gun_ori = false
const_effect = li_missile02_drive
HP_trail_parent = HPExhaust
seeker = LOCK
time_to_lock = 0
seeker_range = 3500
seeker_fov_deg = 180
max_angular_velocity = 30.903330
DA_archetype = equipment\models\weapons\li_rad_missile.3db
material_library = equipment\models\li_equip.mat
mass = 1
volume = 0.000100

[Gun
nickname = or_battleship_missile_turret01
ids_name = 263384
ids_info = 264384
DA_archetype = equipment\models\turret\li_turret04.cmp
material_library = equipment\models\li_turret.mat
HP_child = HPConnect
hit_pts = 4800
explosion_resistance = 1.000000
debris_type = debris_turret_small
parent_impulse = 20
child_impulse = 80
volume = 50.000000
mass = 10
hp_gun_type = hp_turret_special_9
damage_per_fire = 0
power_usage = 0
refire_delay = 0.500000
muzzle_velocity = 66.699997
toughness = 1.600000
light_anim = l_gun01_flash
projectile_archetype = or_battleship_missile_turret01_ammo
separation_explosion = sever_debris
auto_turret = true
turn_rate = 90
lootable = false

[LOD
obj = Root
LODranges = 0, 450

[LOD
obj = barrel
LODranges = 0, 500


MODS\Osiris\EQUIPMENT\weapon_good.ini

[Good
nickname = or_battleship_turret01
equipment = or_battleship_turret01
category = equipment
price = 250
item_icon = equipment\models\commodities\nn_icons\EQUIPICON_capturret.3db
combinable = false
ids_name = 263379
ids_info = 264379
shop_archetype = equipment\models\turret\li_turret01.cmp
material_library = equipment\models\li_turret.mat

[Good
nickname = or_battleship_turret04
equipment = or_battleship_turret04
category = equipment
price = 150
item_icon = equipment\models\commodities\nn_icons\EQUIPICON_capturret.3db
combinable = false
ids_name = 263382
ids_info = 264382
shop_archetype = equipment\models\turret\li_turret04.cmp
material_library = equipment\models\li_turret.mat


[Good
nickname = or_battleship_missile_turret01
equipment = or_battleship_missile_turret01
category = equipment
price = 200
item_icon = equipment\models\commodities\nn_icons\EQUIPICON_capturret.3db
combinable = false
ids_name = 263384
ids_info = 264384
shop_archetype = equipment\models\turret\li_turret04b.cmp
material_library = equipment\models\li_turret.mat

Our last file, one which would have had to have been added anyway. The cockpit

MODS\Osiris\COCKPITS\or_dreadnaught.ini

[Cockpit
mesh = cockpits\liberty\models\li_freighter_cockpit.cmp
int_brightness = 0.500000
head_turn = 30, 10

[CockpitCamera

[TurretCamera
tether = 0.000000, 50, 380
yaw_rotate_speed = 2.000000
pitch_rotate_speed = 1.500000
accel_speed = 5



That's it. Now we just need to make freelancer able to see the files. Add this to the data section of your EXE\freelancer.ini file.

;Battleship Mod
equipment = mods\osiris\equipment\st_equip.ini
equipment = mods\osiris\equipment\weapon_equip.ini
equipment = mods\osiris\equipment\engine_equip.ini

ships = mods\osiris\ships\shiparch.ini

goods = mods\osiris\equipment\goods.ini
goods = mods\osiris\equipment\st_good.ini
goods = mods\osiris\equipment\weapon_good.ini

markets = mods\osiris\equipment\market_misc.ini
markets = mods\osiris\equipment\market_ships.ini

One last note: Where you are assigning ini files to a type in freelancer.ini, all the files of the same type can actually go in a single file, for this mods and other single ship mods it would perhaps be better to do it that way. However for continuity with current modding standards I've kept them seperate.


I believe I got across the general idea of how this works so I wont run through any more examples unless someone wants me to.

In my opinion, this is a much better way of adding smaller mods to the game. It wont work for large scale mods since they mostly require editing a lot of the files.

Here are all the files i've added for both mods, including my modded freelancer.ini.

I dont know whether this approach will take off but I thought I'd post how to do it so people can try it out.

Edited by - TheJkWhoSaysNi on 5/17/2005 2:03:27 PM

Post Tue May 17, 2005 3:05 pm

Was it blackeagle that posted about using the Freelaner.ini file in this way? I think it was him who made mention about just adding the extra files as needed for your mods via the Freelancer.ini file etc - about 2 years ago now.

If it wasn't him, then I apologise to the person who it was - but its too far back to go searching. Nice use of the idea, basically what he said... but explaining it clearer to people If I remember rightly, the reason why it never really took off was simply because some don't want compatibility

Nice posting though - really well explained and clear as possible Good stuff

Edited by - Chips on 5/17/2005 4:07:29 PM

Post Tue May 17, 2005 3:13 pm

Ah, I did search the tutorial forum for freelancer.ini couldn't find anything on adding mods in this way. Couldn't see anything in the sticky in this forum either.

Well, another explanation of it cant hurt :p

Return to Freelancer Editing Tutorial Forum