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** How to edit the .thn script files

Here you find the different tutorials on editing and MODing Freelancer

Post Sat Jun 07, 2003 5:11 am

**TUTORIAL** How to edit the .thn script files

Ok, so ya want to edit a script, right? well, today we're gonna focus on the main menu background, the one with the station in front of a planet with the ships and transports flying across.

First off, you need the .thn uncompiler:

here

and you'll also need:

BINI

and

UTF EDITOR

both of which can be found in the editing utilities section of lancersreactor

now, once you have those, go into DATA\SCRIPTS\INTRO and copy gasminer3.thn to wherever you unzipped the .thn decompiler to. decompile it and open it up with notepad.

Now, you are probably going "What's this? this isn't Freelancer coding!" and you'd be right. It's scripted in LUA code. But it's fairly straightforward, especially if ya know C++ or something like it.

I'm not entirely sure what time unit is used in these, so just leave them alone for now.

P/-/3@R D@ D@\/\/G F00lZ

Check out what I'm doing for Reynen's Mod @ my website!


Edited by - BobTheDog on 07-06-2003 07:03:59

Post Sat Jun 07, 2003 5:43 am

Ok, now every FL script (to my knowledge) begins with a duration declaration, and then a scene entity, and ya can just copy those if ya make a new script.

here's how things work in FL scripts:

Everything has to be declared. You can only use things from solararch.ini, shiparch.ini, effects.ini, and the starspheres and nebulaspheres.

so, here's how to declare a ship:

{
entity_name="Ships_li_dreadnought", <-- this is the name used to reference it in this script
type=COMPOUND, <-- must be this for ships
template_name="li_dreadnought", <-- what to use from shiparch.ini
lt_grp=4,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC,
spatialprops={
pos={ <-- position to start at... only used is stationary
7760.895996,
612.4628300000001,
-4181.624023
},
orient={ <-- rotational vectors
{
-0.955097,
0,
-0.296293
},
{
0,
1,
0
},
{
0.296293,
0,
-0.955097
}
}
},
userprops={ <-- I assume this tells it where to get the template from...
category="Spaceship"
}
},


now, you can mae the template anything from shiparch.ini

we have a ship, now let's make it follow a path:

This is a path from gasminer3.thn:

{
entity_name="Path_1_copy_1",
type=MOTION_PATH,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
5,
6.576355,
55
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
pathprops={
path_type="CV_CROrientationSplinePath",
path_data="OPEN, {7760.895996,612.463013,-4181.623535}, {1.000000,0.000000,0.000000,0.000000}, {7465.413574,612.463013,-3846.421143}, {1.000000,0.000000,0.000000,0.000000}, {7569.932129,612.463013,-3511.218262}, {1.000000,0.000000,0.000000,0.000000}, {7474.450684,612.463013,-3176.015137}, {1.000000,0.000000,0.000000,0.000000}, {7358.968750,612.463013,-2840.812256}, {1.000000,0.000000,0.000000,0.000000}, {7283.486816,612.463013,-2505.608887}, {1.000000,0.000000,0.000000,0.000000}, {7188.005371,612.463013,-2170.406006}, {1.000000,0.000000,0.000000,0.000000}, {7092.523438,612.463013,-1835.202759}, {1.000000,0.000000,0.000000,0.000000}, {6997.041504,612.463013,-1500.000000}, {1.000000,0.000000,0.000000,0.000000}, "
}
},


all the numbers at the bottom are points for the path to follow, i'm not sure how to calculate them, tho. What you CAN do is edi the pos={ section:
pos={
5, <-- positive is right, negative is left
6.576355, <-- positive is up, negative is down
55 <-- positive is forward, negative is back
},


I'm assuming that these paths are calculated from the center of the scene.

now, you need to have the ship go down the path... under the events={ section, at the end of the declarations, you would put:

{
0, <--this tells it how many time units to delay the action (I think)
START_PATH_ANIMATION,
{
"Ships_li_dreadnought", <-- which entity to put on the path
"Path_1" <-- which path to use
},
{
duration=60, <-- I'm not sure what the next three do...
start_percent=0,
stop_percent=1,
offset={
90,
45,
45
},
up=Y_AXIS,
front=NEG_Z_AXIS,
flags=POSITION + ORIENTATION + LOOK_AT <--this seems to tell the ship to face in the direction of the waypoint
}
},

As you can see, there is a field called offset={

this is exactly like the pos={ field discussed earlier. This time, it tells the offset by which the ship is placed on the path.

ok, now you have a ship, on a path. assuming you simply edited the gasminer3.thn, you are almos good to go.

to get it to allways show up when you start freelancer (there are three possible menu backgrounds, randomly chose when you start FL) you need to edit two files:

intro2_vlocanoplanet.ini
intro3_planetchunks.ini

both in DATA\UNIVERS\SYSTEMS\INTRO\BASES\ROOMS

you'll need to decompile them with bini and change this line in both:

[Room_Info
scene = ambient, Scripts\Intro\xxxxxx.thn

to:

[Room_Info
scene = ambient, Scripts\Intro\gasminer3.thn

save both files, and make sure you put the decompiled ini's back into the right folders, and made sure they still had the .ini extension, not .ini.txt as bini makes them. now, load freelancer, and you should see the intro with the ship going by eventually.

P/-/3@R D@ D@\/\/G F00lZ

Check out what I'm doing for Reynen's Mod @ my website!


Edited by - BobTheDog on 07-06-2003 07:02:30

Post Sat Jun 07, 2003 5:55 am

Now, you say "Wait a second... there's no engine!"

that's correct.

Here's the complex part: This is a script, not a Freelancer system, and those aren't ships, just models stuck on a conveyor belt. they don't even have solidity. Yep, you can fly them right through each other, and anyhting else in the scene, planets, stations, etc.

how to add an engine then?

back at the declaration part of the gasminer3.thn file, add this:

{
entity_name="FX_ge_lbd_engine_01",
type=PSYS,
template_name="gf_li_largeengine03",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7784.271973,
609.758606,
-4256.971191
},
orient={
{
-0.993505,
0,
-0.113791
},
{
0,
1,
0
},
{
0.113791,
0,
-0.993505
}
}
},
psysprops={
sparam=0
}
},

this time, the template comes from effects.ini

this is the engine effect used by the engine used by the liberty dreadnought in the game.

Now that we've declared it, we mive on to attaching it to the ship:

put this in the events={ section:

{
0,
ATTACH_ENTITY,
{
"FX_ge_lbd_engine_01", <-- thing that's being attached
"Ships_li_dreadnought" <-- thing it's being attached to
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpengine01",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION
}
},

note at the end it has sections for what to attach it to. If you are not familiar with the model you are attaching the effect to, you need the UTF editor to look at the hardoint names for specific models. The Liberty Dreadnought has only one engine flame, fortunately for us. and the hardpoint is labeled HpEngine01.

I suppose you caould add offsets here, but that'd look odd...

now it's attached to the ship, but we still need to turn it on:

under the attachment event, add this:

{
0,
START_PSYS,
{
"FX_ge_lbd_engine_01"
},
{
duration=2400
}
},

this turns on the named effect.

now, save the file and go back into the game. You should see the Liberty Dreadnough has it's engine now.

One last thing:

THe engine is too small, you say. Yes, but it cannot be helped. I don't know of a way of changing it's size... you see the size it dynamically controlled in the game, relative to your speed, bu the ship in the scene has no speed, it's just sitting on the track. so the effect is at it's lowest "on" point.

And another thing:

You can't add weapons, or runninglights to anything. Believe me I've tried.

P/-/3@R D@ D@\/\/G F00lZ

Check out what I'm doing for Reynen's Mod @ my website!

Post Sat Jun 07, 2003 5:59 am

Here's another thing to try:

Add this to these declaration area:

{
entity_name="smoke1",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke2",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke3",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke4",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke5",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke6",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke7",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke8",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},
{
entity_name="smoke9",
type=PSYS,
template_name="gf_prisonattack_bigsmoke",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
7322.942383,
363.170685,
-3207.746094
},
orient={
{
0.433044,
-0.458753,
0.775899
},
{
0.223574,
0.888564,
0.400586
},
{
-0.873205,
0,
0.487352
}
}
},
psysprops={
sparam=0
}
},

amd these to the event area:

{
0,
ATTACH_ENTITY,
{
"smoke1",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s2_01",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke2",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_01",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke3",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_02",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke4",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_03",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke5",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_04",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke6",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_05",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke7",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_06",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke8",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_07",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
ATTACH_ENTITY,
{
"smoke9",
"smallstation1_1"
},
{
duration=2400,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpturret_s1_08",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION + ENTITY_RELATIVE + ORIENTATION_RELATIVE
}
},
{
0,
START_PSYS,
{
"smoke1"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke2"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke3"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke4"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke5"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke6"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke7"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke8"
},
{
duration=2400
}
},
{
0,
START_PSYS,
{
"smoke9"
},
{
duration=2400
}
},


now the station is burning! Oh no!

P/-/3@R D@ D@\/\/G F00lZ

Check out what I'm doing for Reynen's Mod @ my website!

Post Sat Jun 07, 2003 6:02 am

And one last thing to try:

Open the following:

intro1_cityscape.ini
intro2_vlocanoplanet.ini
intro3_planetchunks.ini

and change the

[Room_Info
scene = ambient, Scripts\Intro\xxxxxxxx.thn


to:

[Room_Info
scene = ambient, Scripts\Intro\intro_waterplanet.thn


now you can see the unused intro!

P/-/3@R D@ D@\/\/G F00lZ

Check out what I'm doing for Reynen's Mod @ my website!

Post Sun Nov 20, 2005 9:18 pm

Is there a shorter, less complicated way.

thats to much code.

Post Wed Feb 15, 2006 7:41 am

Perhaps you would use the code function of the Forum next time. Look at the "Forum Codes"!!!!!

Edited by - burzelmann on 2/15/2006 7:43:33 AM

Post Sun Feb 19, 2006 12:37 pm

A thread, one of the only ones on thn editing, which is nearing three years old, gets bumped by someone asking a simple question - which most likely won't get a reply because no-one really edits the thn files much (its tough!).

However, then bumping the thread once more (after 3 months) to critcise Bobs posting is pretty much deplorable .

Please refrain from trying to criticise things that are nearly 3 years old, unless you are going to offer up a superior solution.

Post Mon Feb 20, 2006 6:30 pm

Hehe... I thought it was odd when I got a topic reply notice for this thread ^_^

But to answer your question if anyone's still interested, no, not that I know of. THN editing never really became a big focus, so no tools were ever created to expedite the process. Sad, really, because you could do some cool stuff with THN files if you wanted to.

P/-/3@R D@ D@\/\/G F00lZ


Post Mon Feb 20, 2006 7:24 pm

That's the problem with .thn files, they're a pain in the a***, i know i've tried and sort of got things working ok, more luck than judgement.

Post Tue Mar 07, 2006 3:45 pm

http://darkbasicpro.thegamecreators.com/?f=lua
this program utilises the Lua scripting language in the games. Perhaps someone can learn something.

Post Wed Apr 05, 2006 10:42 am

Sorry for the several-month-bump, I guess. I was wondering if anyone could give me a hand here -- I'm having trouble figuring the Orientation values and how they work exactly. I've seen how they are used in hardpoints for aligning a weapon etc and know what they're for, but to me it seems totally different when you're talking about a station, or such.

Does anyone have much experiance with them in THN's who could share the secret?

Cheers,

L.D.

Return to Freelancer Editing Tutorial Forum