Freelancer Community Network


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** THN Editing by LordFjord

Here you find the different tutorials on editing and MODing Freelancer

Post Fri Sep 14, 2007 4:40 pm

**Tutorial** THN Editing by LordFjord

For breslin and anybody else that want's it here's LordFjord's THN tutorial.

I copied it from his site 2 months before it got hacked and destroyed by some low life Eastern European who thought he was being clever.

Post Fri Sep 14, 2007 4:41 pm

What is a thn file
THN files hold all animation sequences in cutscenes, rooms on bases, also the menu background scenes.
All things that are in ingame-graphics and not actually in space flight mode are thn animations.
Original Freelancer has manymany of these for the singlplayer cutscenes or just for filling the docked bases with a bit ambience and light.
Everything that moves there was scripted into detail - every single bypassing "traffic" ship on planets and so on.


This tutorial is a reference to the possible sections I found, not an example.
I learned many parts of this from Lancersreactor and additional researched revealed a few more details.

Install the thn-decompiler. make sure the LUA dir is set up correctly and select a thn file. It will be decoded. It will work in a decompiled format, just like ini-files.

The thn file is divided into 2 big sections, above that u can declare the complete duration of the animation (in seconds).

duration = 300
entities={ ...
< list all entities here >
}

and
events={ ...
< sequences and events go here >
}

you need to declare EVERYTHING, from the largest planet to the smalles engine-effect.

A bit theory:
positions are always: x, z, y (well, it is actually x, y, z but those are aligned differently as in school-maths)
orientations are more complex.

I will try to list all sections i found and my guess what they mean:

entities:

scene
i don't know why u need it, it is never referredd to in the future.
havent tested if it works without one, but all files i checked so far have it.
Code:
<pre><font size=1 face=Courier> {
entity_name="Scene_Untitled",
type=SCENE,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
},
up=Y_AXIS,
front=Z_AXIS,
ambient={
128,
128,
128
}
},</font></pre>

declareing a ship

Code:
<pre><font size=1 face=Courier> {
entity_name="Ship_01",
type=COMPOUND,
template_name="pi_elite2",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0.000000,
-1000.000000,
7000.000000
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Spaceship"
}
},</font></pre>

template_name= this is the reference to shiparch.ini
pos={ <------------positioning as described above, only important for fixed objects
orient={ <---------orientation as described above
category= <-------"Spaceship" for ships, "Solar" for planets, other objects

declaring an effect
In this case it is the ship's engine. Note that some ships have several engines, u need an entry for each one.

Code:
<pre><font size=1 face=Courier> {
entity_name="Ship_01_Engine_1",
type=PSYS,
template_name="gf_co_smallengine02_fire",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
psysprops={
sparam=0
}
},</font></pre>

Position values are not important as we will link this to the ship later.

declaring a planet/other object
very similar to our other objects, just for reference:
Code:
<pre><font size=1 face=Courier> {
entity_name="planet_mercury_200_2",
type=COMPOUND,
template_name="planet_mercury_200",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC,
spatialprops={
pos={
325.583038,
-2031.342896,
-1040.869141
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Solar"
}
},</font></pre>

Lights:
Pretty straightforward, you can set a lot of options here, i wont go much into detail here, I assume u know what RGB colors, diffuse, specular and ambient values are
Code:
<pre><font size=1 face=Courier> {
entity_name="Light_1",
type=LIGHT,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0,
0,
0
},
orient={
{
0.560152,
0,
-0.82839
},
{
0,
1,
0
},
{
0.82839,
0,
0.560152
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
0.909804,
0.909804,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
0,
0,
1
},
range=2000,
cutoff=98.999985,
type=L_DIRECT,
theta=90,
atten={
1,
0,
4e-006
}
}
},</font></pre>

Camera and monitor
you need both to see something - u can define cameras and i think u can even swithc between them during the animation. The monitor is what u actually see on the screen.

Code:
<pre><font size=1 face=Courier> {
entity_name="Camera_1",
type=CAMERA,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0.0,
-1028.601685,
7368.024414
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
cameraprops={
fovh=30,
hvaspect=1.333333,
nearplane=1,
farplane=1000000
}
},</font></pre>

I havent experimented with the cameraprops yet, but i guess u can change FOV there how about a 360° cam?

Monitor:
Code:
<pre><font size=1 face=Courier> {
entity_name="Monitor_2",
type=MONITOR,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0
},</font></pre>

Background
Use any starsphere from the inis.
Code:
<pre><font size=1 face=Courier> {
entity_name="starsphere_Li04_4",
type=COMPOUND,
template_name="starsphere_Li04",
lt_grp=0,
srt_grp=-100,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
-0.943394,
0,
-0.331673
},
{
0,
1,
0
},
{
0.331673,
0,
-0.943394
}
}
},
userprops={
category="Prop"
}
},</font></pre>

Pathes:
The way to get things moving, maybe the most complicated part of this(and he isn't bloody kidding, hardest part of a THN IMHO)
Code:
<pre><font size=1 face=Courier> {
entity_name="Path_1",
type=MOTION_PATH,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
pathprops={
path_type="CV_CROrientationSplinePath",
path_data="OPEN, {0.000000,-1000.000000,6800.000000}, {1.000000,0.000000,0.000000,0.000000}, {0.000000,-1000.000000,2000.000000}, {1.000000,0.000000,0.000000,0.000000}, "
}
},</font></pre>

position doesnt matter here, the important entry is this:
path_data="OPEN, ...
there is always one coordinate "{x, z, y}" followed by "{1.000000,0.000000,0.000000,0.000000}".
I dont know what the 2nd entries in the set do, but the 1st ones define the waypoints of the path.
(I need to verify if these are absolute or relative coordinates.)

You can add additional waypoints.

The ships / moving objects will be attached to the path in the "effects" section.
You can attach a camera to a path, too.


The last entry in "entities" doesn't have a "," after the closing bracket }.

------------------------------------------------------------------------------
events:

the number before each entry is the delay in seconds before it is initiated.

Starting effects:
This is used for all kinds of effects. They must have been defined in the sections above.
Code:
<pre><font size=1 face=Courier> {
0,
START_PSYS,
{
"Ship_01_Engine_1"
},
{
duration=2400
}
},</font></pre>

duration is in seconds.

Rotating objects
Code:
<pre><font size=1 face=Courier> {
0,
START_SPATIAL_PROP_ANIM,
{
"planet_watblucld_1500_4"
},
{
duration=360.1,
target_type=ROOT,
spatialprops={
axisrot={
360,
NEG_Y_AXIS
}
}
},</font></pre>

Used usually with planets, but it should work with any object - maybe even the camera.

Attaching objects to each other
This is used to attach an engine to a ship, rings to planets, explosions to their objects,...
a few examples:
an engine:
Code:
<pre><font size=1 face=Courier> {
0,
ATTACH_ENTITY,
{
"Ship_01_Engine_1",
"Ship_01"
},
{
duration=360,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpengine01",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION
}
},</font></pre>

target_part is the hardpoint of the ship - mabe its possible to place guns on ships, too.

Pathes / Movement
moving a ship:
Code:
<pre><font size=1 face=Courier> {
0,
START_PATH_ANIMATION,
{
"Ship_01",
"Path_1"
},
{
duration=50,
start_percent=0,
stop_percent=1,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
flags=POSITION + ORIENTATION + LOOK_AT
}
},</font></pre>

duration is in seconds. This and the distance defined by the Path (waypoints) will be responsible for the speed of the object.

The offset entries are used to move the relative position of the attached object to the parent object.
You can give several objects the same path with different offsets to create fleets and their formations.

Set up Monitor
Code:
<pre><font size=1 face=Courier> {
0,
SET_CAMERA,
{
"Monitor_2",
"Camera_1"
}
},
{
0,
START_PATH_ANIMATION,
{
"Camera_1",
"Path_Cam"
},
{
duration=35,
start_percent=0,
stop_percent=1,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
flags=POSITION + ORIENTATION + LOOK_AT
}
},</font></pre>

First the Monitor is attached to the camera object, then the camera is set on a defined path -> moving camera.

---------------------------------------------------------------------------

Thats it so far. Look up the existing thn files from the scripts/intro dir to see how the existing ones are done.
This tut only covered the basics - with a bit imagination, patience and time there are many ways to create nice new features for FL.
A few ideas that would be probably possible:
- a "story sequence" when starting a new character (it will show the docking sequence of that base).
- a "tutorial and credits list" for mods - either as new char startup or as menu background scene.
- with modeling and skinning, completely new rooms, planetscapes, ... are possible. i'd love to see cool docking sequences to orbital bases for example.
- "one-room-bases" - put the whole base into a single room where you can access all important things at once.

Fjord

P.S.: check the system inis for the intro system, in the rooms of that u can specify the menu background scenes.

Post Sat Sep 15, 2007 1:53 am

have you got any more of his tutorials or did they all get sunk? :/

Universal Modding Forums


Return to Freelancer Editing Tutorial Forum

Hosted by The-Starport
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.