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 New Weapons

Here you find the different tutorials on editing and MODing Freelancer

Post Wed May 21, 2003 7:35 pm

*** Tutorial *** Creating New Weapons

Ok. This tutorial will cover almost anything about weapons I might need to be corrected at some points so please feel free to express any mislead or misinformation.

Here we go.

The first action for an editor/modder has to be backing up the files. We will be messing with the following files:

\data\equipment\weapon_equip.ini
\data\equipment\weapon_good.ini
\data\equipment\market_misc.ini
\exe\freelancer.ini

Make backups of those files then decompress them with bini.exe if you didn't do that before. Bini makes .ini.txt files. Delete the real files (which you got backups of) and rename those .ini.txt files to .ini files.

Here's the list of programs we'll use:
Notepad to open decompressed ini files.
Reshacker to modify the dll template
FL ini Referer to calculate the ids_name and ids_info numbers

Here's a template of a dll file that you are going to add in to your freelancer.ini.
Dll template
The template already has a weapon name and infocard entry. So you can just analyze it to understand.

Before we go further. Those ini files are read only so you might want to change their attributes first.

First Step:
-------------

What kinda weapon do you want to create ? Pulse, laser, neutron, tachyon, plasma, photon or particle ? Decide which one you want and just open weapon_equip.ini

We will make a pulse weapon as an example. Search for pulse01 in the file. Yeah we will get an existing weapon entry as a basis. Probably you'll find the entry below:

<pre><font size=1 face=Courier>
[Munition
nickname = fc_c_gun02_mark01_ammo
hp_type = hp_gun
requires_ammo = false
hit_pts = 2
hull_damage = 10.100000
energy_damage = 303
weapon_type = W_Pulse01
one_shot_sound = fire_pulse3
munition_hit_effect = pi_pulse_01_impact
const_effect = pi_pulse_01_proj
lifetime = 1
force_gun_ori = false
mass = 1
volume = 0.000100

[Gun
nickname = fc_c_gun02_mark01
ids_name = 263211
ids_info = 264211
DA_archetype = equipment\models\weapons\ge_shredder_shotgun.cmp
material_library = equipment\models\ge_equip.mat
HP_child = HPConnect
hit_pts = 1405
explosion_resistance = 1.000000
debris_type = debris_normal
parent_impulse = 20
child_impulse = 80
volume = 0.000000
mass = 10
hp_gun_type = hp_gun_special_5
damage_per_fire = 0
power_usage = 24.240000
refire_delay = 0.250000
muzzle_velocity = 600
use_animation = Sc_fire
toughness = 0.400000
flash_particle_name = pi_laser_01_flash
flash_radius = 15
light_anim = l_gun01_flash
projectile_archetype = fc_c_gun02_mark01_ammo
separation_explosion = sever_debris
auto_turret = false
turn_rate = 90
lootable = true
LODranges = 0, 20, 40, 80, 100
</font></pre>

A weapon entry has two parts. Munition and Gun. Just copy and paste those lines to the end of the file. Now we'll mess up with some settings. Change nicknames. Munition would always have the suffix "_ammo" at the end of its nickname.
Gun section's nickname is the actual nickname of the weapon.
Now change the munition's nickname to gun_darkreign_ammo and gun section's nickname to gun_darkreign.
hull_damage is obvious to understand i think. Shield damage is calculated according to this as the half of the hull damage. Change this whatever you want. The number will show up exactly in the stats of the weapon in game.
Weapon_type is the type of weapon that how the weapon will damage the type of shields. This weapon types are defined in the file named weaponmoddb.ini
Much of the other settings in the munition section are obvious and unnecessary to change.

Now the gun section. You changed the nickname to gun_darkreign right ? Ok now look at the ids_name and ids_info lines. Keep one of those numbers in your mind. We'll change these lines later. The numbers point to the dll file which we will create for weapon name and info text displayed in the game.
hit_pts is the hitpoint of the gun. Just like ships, nothing special.
hp_gun_type is important because it points the class of the weapon. If you want your weapon to be used by any ship you can change it to hp_gun_special_1.
power_usage is obviously handle the power consumption of the weapon. The minimum standart power usage is 4.580000. This one uses 24.
refire_rate is the rate of firing. The quickest rate is 0.120000 which means 8.33 (I dunno how this is calculated to get 8.33 or 5.88 or 4 or 2 or 3.03)
muzzle_velocity is the projectile speed. It's an exact number so use 800 for 800m/s in game.
Some say flash_radius is the explosion radius of the weapon when hit the target and they say if you want to set it to 10000 it takes the ships around the target down as well. I havent tested this yet.
projectile_archetype is the ammo's nickname so change this to gun_darkreign_ammo
auto_turret is the boolean value to set the weapon as a turret or not.
lootable also is a boolean value to make the weapon lootable or not.

Ok, now save the file after your changes. Now open the weapon_goods.ini
We are going to make our weapon a good to be sold on bases. Now search the number that you kept in your mind here. It will lead you to the entry like this :

<pre><font size=1 face=Courier>
[Good
nickname = fc_c_gun02_mark01
equipment = fc_c_gun02_mark01
category = equipment
price = 7460
item_icon = equipment\models\commodities\nn_icons\EQUIPICON_gun.3db
combinable = false
ids_name = 263211
ids_info = 264211
shop_archetype = equipment\models\weapons\ge_shredder_shotgun.cmp
material_library = equipment\models\ge_equip.mat
</font></pre>

change the nickname to your weapons nickname (gun_darkreign in this case). Use the same name for the equipment. Price is price and here we face those ids_name and ids_info again. Don't change them yet. Save the file now.

This is for the weapon setup. Now we need to add this wepon to a list of a base. I'll use Planet Pittsburg for an example. Open market_misc.ini and search for the line "base = Li01_02_base". It looks like this :
<pre><font size=1 face=Courier>
[BaseGood
base = Li01_02_base
MarketGood = co_gun01_mark01, 0, -1, 10, 10, 0, 1
MarketGood = co_gun01_mark02, 0, -0.200000, 10, 10, 0, 1
MarketGood = co_turret01_mark01, 0, -1, 10, 10, 0, 1
MarketGood = co_turret02_mark01, 0, -1, 10, 10, 0, 1
.
.
.
</font></pre>

Now we'll add a line there. just copy the first marketgood line and paste it next to the second gun entry and change the name after "=" to "gun_darkreign" so it should look like this now:

<pre><font size=1 face=Courier>
[BaseGood
base = Li01_02_base
MarketGood = co_gun01_mark01, 0, -1, 10, 10, 0, 1
MarketGood = co_gun01_mark02, 0, -0.200000, 10, 10, 0, 1
MarketGood = gun_darkreign, 0, -1, 10, 10, 0, 1
MarketGood = co_turret01_mark01, 0, -1, 10, 10, 0, 1
MarketGood = co_turret02_mark01, 0, -1, 10, 10, 0, 1
.
.
.
</font></pre>

Save the file.

Edited by - Catscratcher on 27-05-2003 20:51:10

Post Wed May 21, 2003 8:13 pm

Second Step
--------------
Copy the dll file you downloaded to the EXE folder of the game.

Open freelancer.ini and find the resources section which would look like this :
<pre><font size=1 face=Courier>
[Resources
DLL = InfoCards.dll ; Contains all infocard text resources
DLL = MiscText.dll ; Contains other bulk text resource: rumor, offer, and mission text
DLL = NameResources.dll ; Contains names of things, primarily.
DLL = EquipResources.dll ;Contains names of equipment (in string table) and infocards for equipment (in HTML resources)
DLL = OfferBribeResources.dll ; Contains random mission offers and bribes
DLL = MiscTextInfo2.dll ;Contains MP UI elements as well as other misc. text
</font></pre>

These are the default lines. It has 6 dll lines. Yours can be different because of some mods you applied. Now what's the dll file that you downloaded ? new_res2.dll
Add the line DLL = new_res2.dll ;custom resources next to the last one.
Now if your resources section has 6 dll lines as above yours will be the 7th one. Keep that in mind, we'll use it later.
Save the file.

Now we'll be using reshack to modify the dll file. Open the dll template you downloaded with the reshack(It's in the EXE folder of the game now right ?).
There are two important trees here. String Table and the 23.
String Table keeps the string values for anything. Now expand the String Table tree. You see a "1" now. It represents the table number 1. Now expand it. You see a 1033 entry. That one keeps the data. The right side now shows some lines:
<pre><font size=1 face=Courier>

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1, "Darkangel"
}

</font></pre>

Darkangel is the 1st string of the 1st table. Now expand the other tree 23. You see 101 now. Double click it and you'll see an entry named 1033. This is the infocard in xml format which appears in game as the info text. Now while 1033 selected , goto Action menu and click Save Resource as a binary file. Give a name like "darkangel.xml". Now you have a file in xml format. Open it with the notepad. You'll see some lines. Change the texts between the sections {text} and {/text} ({ is actually the smaller than and } is bigger than signs)
First text section has the name of the weapon. So our example's name is Darkreign. It's a pulse weapon so you wouldn't change the other text section because laser and pulse weapons have the same effects on shields. Now save the file as darkreign.xml and close it.
Get back to reshacker and go to action menu again. Click "Add a new Resource" this time. Now click the open file button and find the darkreign.xml file and double click it. Enter 23 as the resource type, 102 as the resource name and 1033 as the resource language. Darkangel is 101 and darkreign is 102 now. Save the dll file.

Now go to the string table tree and double click 1 and click 1033 to see the list on the right side. Go and copy the line which has darkangel and paste it next to it. Change the number to 2 and text to Darkreign. Click Compile String button. It should look like this now:
<pre><font size=1 face=Courier>
STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1, "Darkangel"
2, "Darkreign"
}
</font></pre>

Save the dll file again. Now open the FL ini Referer. Select the ids_name(strid_name) and enter 1 as Res_ID, 1 as Table and 7 as DLL #. Dll # is the dll entry number of your dll file in the resources section in the freelancer.ini file.

Now click the button below the DLL #. There should be a number shown below the button now. Note that down. It's 458752 if your dll # is 7.

Ok this points to darkangel not our new example. It's the first entry remember ?
Your weapon's ids_name number is 458753 and the ids_info number is 458853. Remember there's 100 difference between 23 entries and String Table entries.
Darkangel 1-101
Darkreign 2-102

Now open weapon_good.ini and find your weapons entry. Simply search for the weapon name. Now change the ids_name and ids_info according to the numbers above. 458753 and 458853.

Do the same for the weapon_equip.ini. Save both files and you are done.

Go to pittsburg in game and see if the weapon is listed there. If not, just ask.

Post Wed May 21, 2003 8:20 pm

For addition. There are some other things that you can; creating new types for weapons (so you can make weapons effective to all shields), changing the appearance of the weapon, the animation appears when firing, the animation goes to the target, etc. I didn't try those yet so i can't help now

You can even use other ini files than weapon_good.ini, weapon_equip.ini or market_misc.ini for your custom ships, weapons or other stuff. Just adding ini files as dll files into freelancer.ini. It's alike sphere(an ultima online emulator) server's spheretables.scp You can set which files to load. However, another "haven't tried, can't help" situation

If only your weapon's class is listed on the base, then something is wrong about the dll file. Probably its because it cant save the string table changes and the 23 entry changes at the same time. Just change a thing and save immediately.

Edited by - Catscratcher on 21-05-2003 21:29:19

Post Wed May 21, 2003 9:01 pm

Excellent tutorial! Great work and thanks.

Couple of things:

1. Dixi has created a great little utility for working with infocards and other resource .dlls.

2. The refire delay is the 0.12 for fastest which is the inverse of the refire rate (1/refire delay) or 1/0.12 = 8.33. The .ini file specifies refire delay, the infocard has refire rate.

Post Wed May 21, 2003 9:28 pm

I actually got the program you mentioned. However i didn't seem to get my dll seen by the program. It's a great app which makes things easier.

And thanks for the 2nd tip. I didn't know that and i was lazy to figure out myself It's the delay in a second right. Silly me.

Post Thu May 22, 2003 10:32 pm

I got news folk. This is about how to use new ini files instead of editing existing ones.

There is a [data section in the file "freelancer.ini". Scroll down you'll see lines like below:

<pre><font size=1 face=Courier>
equipment = equipment\light_equip.ini
equipment = equipment\select_equip.ini
equipment = equipment\misc_equip.ini
equipment = equipment\engine_equip.ini
equipment = equipment\ST_equip.ini
equipment = equipment\weapon_equip.ini
; equipment = equipment\turret_equip.ini
; equipment = projectiles\projectiles.ini ; kept around for turret projectiles
; equipment = projectiles\m11_projectiles.ini ; M11 snapshot
; equipment = equipment\m11_equipment.ini ; M11 snapshot
equipment = equipment\prop_equip.ini
.
.
goods = equipment\goods.ini
goods = equipment\engine_good.ini
goods = equipment\misc_good.ini
goods = equipment\st_good.ini
goods = equipment\weapon_good.ini
.
.
markets = equipment\market_misc.ini
markets = equipment\market_ships.ini
markets = equipment\market_commodities.ini
</font></pre>

That's a default look of the goods, markets and equipment entries. Now its really obvious what to do. Just create an eqiupment file just like the original weapon_equipment.ini file. new_weapon_equip.ini lets say. Move any custom weapons from the original file or add new ones if you like to the new file. Save it. Same with the weapon_good.ini
Create a file like new_weapon_good.ini and move any custom ones from the original one.

Ok now here's a tip about markets. You might think how to put goods in the base sell lists as they are all defined in the market_misc.ini. The general idea is this: If you define exactly two same weapon entries(nicknames) as equipment or good in any ini files, they would cause some conflicts and may crash your game due to their nicknames. That's not same with the market entries. If you, for example, put lines like below to a new market file like new_market_misc.ini
<pre><font size=1 face=Courier>
[BaseGood
base = Li01_02_base
MarketGood = gun_darkangel, 0, -1, 10, 10, 0, 1
</font></pre>

that will not redefine the pittsburg's list, it will just add the item to the current list which is already assigned to pittsburg in the market_misc.ini file.

You just add
<pre><font size=1 face=Courier>
equipment = data\new_weapon_equip.ini
good = data\new_weapon_good.ini
market = data\new_market_misc.ini
</font></pre>
lines under the [data section of the "freelancer.ini"
It's just that simple.

Note: This forum really needs to be fixed. <pre><font size=1 face=Courier> adds font entries to the original message.

Edited by - Catscratcher on 22-05-2003 23:36:08 </font></pre>

Post Tue May 27, 2003 5:37 pm

umm.... the template dll isnt there, missing link??

and im confused as to section 2 with the dll part, help needed

You call that a ship, THIS is a ship[![![!

Post Tue May 27, 2003 7:56 pm

I corrected the link, but it won't open anyway. Click it and get the url from the address bar from the new explorer window. Then close that one and start a new internet explorer yourself. Paste the url to the address bar and hit enter. That way it'll download.

Stupid bandwidth protections.

Where did you stuck about the second step ?

Post Tue May 27, 2003 9:02 pm

ok, now ive got your template ive made it down to the part where i need FL ini referer, where do i get it from, cant see it on DL's

but so far so good, i can get my wep to appear in bases, jus with wrong info, which is what im doing now, well... when i get the proggy

You call that a ship, THIS is a ship[![![!

Post Tue May 27, 2003 9:51 pm

ok, i followed your tut to the end after finding referer but FL crashes on startup, im gonna retry it but im fairly sure i did it correct 1st time round

where might i be going wrong

btw i use rebalance 1.0b so my ids numbers were different but i still think i did it properly

You call that a ship, THIS is a ship[![![!

Post Tue May 27, 2003 9:59 pm

I would like to know were u got this Fl ini Referer. i cant find it anywhere.

Post Tue May 27, 2003 10:22 pm

ok, havinf redone it it still wont work

now im pissed off, cos it should work

and to find ini referer do an all forum search for ini referer

why wont it work??

btw, isnt there a 1000 gap between id numbers???

i tried it both ways but neither helped, my number came back as 524290 and my dll is 8 cos there is a 7th already added

You call that a ship, THIS is a ship[![![!

Post Tue May 27, 2003 11:10 pm

here's the url of the file. (the error messages are in german. I'm not german. I just grabbed that from an url on the forums)

www23.brinkster.com/fayebo/flinireferer.zip

(copy&paste the url to a fresh internet explorer and hit enter)

Ok. My example has a gap of 100 between idnames and idinfos. Yours can be 1000 if you add infos names under the 23 category. I personally use hundreds as idinfos of weapons and thousands as idinfos of ships.

The first entry in the first table of the string table is always 524289 which is the idname.
The first entry of the 23 category is also 524289. But that would conflict. So you make it 101 not 1. Then your first idinfo is 524389. If you made it 1001 then the idinfo number is 525289.

If the game crashes, try deleting the autosave file in the my documents\my games\freelancer\accts\singleplayer
If it crashes again then the dll could be damaged. I once got everything fine but it crashed anyway. I fear the reshacker can not save the string table changes and the other resource type changes at the same time. So if you changed string table , compile and save asap. Same thing with 23.

Read my 5th post here. It mentions that you can use additional ini files not to mess with the original ini files. You can undo things easily that way. Just putting ; in front of any files you added to freelancer.ini to get them not used next time.

In addition to the crashing. The game checks everything in the saved files if they exist or not. So if you somehow delete any weapon you bought, that goes to autosave, and it can't find that weapon on startup. Same thing with ships and the other stuff.

Edited by - Catscratcher on 28-05-2003 00:20:28

Post Tue May 27, 2003 11:11 pm

What is the FL ini referer? What is the filename?

Post Tue May 27, 2003 11:17 pm

Freelancer General Editing Forum Forum

FL INI referer

posted on 14-05-2003 09:22:00


**************************************************
look for this thread
**************************************************

Return to Freelancer Editing Tutorial Forum