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 ** Making asteroid fields and nebulas in .THN Me

Here you find the different tutorials on editing and MODing Freelancer

Post Sun Sep 02, 2007 4:13 am

** Tutorial ** Making asteroid fields and nebulas in .THN Me

Part 1: Asteroid fields

First of all, we need to create scene, starsphere, lights and camera in our script:
<pre><font size=1 face=Courier>
duration=10361.872

entities={
{
entity_name="Scene_Tutorial",
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
}
},
{
entity_name="starsphere_Bw07_stars",
type=COMPOUND,
template_name="starsphere_bw07_stars",
lt_grp=2,
srt_grp=-80,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Prop"
}
},
{
entity_name="starsphere_Bw07",
type=COMPOUND,
template_name="starsphere_Bw07",
lt_grp=2,
srt_grp=-80,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Prop"
}
},
{
entity_name="Camera_1",
type=CAMERA,
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
}
}
},
cameraprops={
fovh=30,
hvaspect=1.333333,
nearplane=1,
farplane=1000000
}
},
{
entity_name="Light_1",
type=LIGHT,
template_name="",
lt_grp=1,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-13805,
0,
-5578
},
orient={
{
0.991074,
-0.077697,
0.108328
},
{
0.027899,
0.9154870000000001,
0.40138
},
{
-0.130359,
-0.394775,
0.909483
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
1,
1,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
0.5,
0.5,
2
},
range=2000,
cutoff=98.999977,
type=L_DIRECT,
theta=90,
atten={
1,
0,
0
}
}
},
{
entity_name="Light_2",
type=LIGHT,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-13805,
0,
-5578
},
orient={
{
-0.834819,
0,
0.550524
},
{
0,
1,
0
},
{
-0.550524,
0,
-0.834819
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
0.909804,
0.909804,
0.5
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
1,
0,
1
},
range=60000,
cutoff=98.999985,
type=L_DIRECT,
theta=90,
atten={
1,
0,
4e-006
}
}
},
{
entity_name="Light_1_copy_2",
type=LIGHT,
template_name="",
lt_grp=3,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-14988,
0,
-8387.272247
},
orient={
{
0.991074,
-0.077697,
0.108328
},
{
0.027899,
0.9154870000000001,
0.40138
},
{
-0.130359,
-0.394775,
0.909483
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
1,
1,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
1,
-0.5,
1
},
range=2000,
cutoff=98.999977,
type=L_DIRECT,
theta=90,
atten={
1,
0,
0
}
}
},
{
entity_name="Monitor_2",
type=MONITOR,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0
}
}
events={
{
0,
SET_CAMERA,
{
"Monitor_2",
"Camera_1"
}
},

}
</font></pre>
When you load this script in the game, you will see a starsphere from Sigma-19. You can add distant asteroids to your starsphere background. Simply place this entity after the starsphere_Bw07 entity:
<pre><font size=1 face=Courier>
{
userprops={
category="Prop"
},
template_name="distant_roids_lt",
spatialprops={
orient={
{
0,
0,
1
},
{
0,
1,
0
},
{
-1,
0,
0
}
},
pos={
0,
0,
0
}
},
usr_flg=2,
type=1,
srt_grp=-80,
entity_name="ambi_distant_roids",
flags=4,
lt_grp=21
},
</font></pre>
And here is the result:


If you change the flags from "4," to "4 + LIT_AMBIENT,", you'll get a field of grey asteroids.

If you want to make a script that takes place in the asteroid field, you have to manually place all asteroids. If you have enough time and patience, you'll do it. This is the sample asteroid entity:
<pre><font size=1 face=Courier>
{
entity_name="asteroid_1",
type=COMPOUND,
template_name="nonmineable_asteroid60",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={40,-30,-327},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Asteroid"
}
},
</font></pre>
All you need to do is to copy-paste it many times, and change "entity_name" and "pos" in each copy. Change "template_name" in some copies to avoid having a field where all asteroids are identical. The file data\solar\asteroidarch.ini contains all available asteroids. The nickname is what you need to write in "template_name".

The other way is to use "backdrop" picture in your background, but in that case you will be unable to add any objects or moving ships, because "backdrop" is a small picture and it is very close to the camera.

Add this to Data\PetalDB.ini:
<pre><font size=1 face=Courier>
prop = menu_background, bases\backdrops\bd_li02_06_iceasteroid.3db
</font></pre>
And place this entity in the script:
<pre><font size=1 face=Courier>
{
entity_name="Background",
lt_grp=23,
flags=4,
userprops={
category="Prop"
},
template_name="menu_background",
spatialprops={
pos={
0,
0,
-80
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
type=1,
usr_flg=0,
srt_grp=0
},
</font></pre>
Now launch the game and you will see a picture of asteroid field in the main menu.

You can edit the 3db files in

Post Sun Sep 02, 2007 4:17 am

data\bases\backdrops with UTF editor and import your own .tga pictures. Each .3db file contains 512x512 picture which consists of four 256x256 fragments.


Part 2: Nebulas

Now remove "Background" entity and starspheres from our script. When you've done with it, add this entity:
<pre><font size=1 face=Courier>
{
entity_name="Nebula",
lt_grp=23,
flags=LIT_DYNAMIC + LIT_AMBIENT,
userprops={
category="Prop"
},
template_name="starsphere_generic_exclusion",
spatialprops={
pos={
0,
0,
-1190
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
type=1,
usr_flg=0,
srt_grp=0
},
</font></pre>
Now we have the nebula, but it is gray. To fix it, add this to the events section:
<pre><font size=1 face=Courier>
{
0,
16,
{
"Scene_Tutorial"
},
{
fogprops={
fogend=4720,
fogstart=1,
fogmode=3,
fogcolor={
0,
190,
190
},
fogon=1,
fogdensity=0
},
duration=0
}
},
</font></pre>
Result:


You can experiment with the nebula position, fogend and fogcolor to get the results you want.

There are three nebula entries in the Petaldb.ini:

prop = nebulashpere_plain, Solar\nebula\plain_inner_sphere.3db <-- this nebula should be used without fog
prop = starsphere_generic_exclusion, solar\nebula\generic_exclusion_rtc.3db <-- gray nebula, must be "painted" with fog
prop = starsphere_exclu_generic, solar\nebula\exclu_generic_sphere_rtc.3db <-- gray badlands nebula, must be "painted" with fog

Open solar\nebula folder, and you will notice that there are more nebula .3db files. You can add them to PetalDB.ini. For example, add this:
<pre><font size=1 face=Courier>
prop = nebula_walker_exclusion, Solar\nebula\walker_exclusion.3db
</font></pre>
Then remove the fog from our script and change the nebula template_name to nebula_walker_exclusion

Now run the game and you will see a Walker nebula.

If you want to make distant nebula, you may try to use generic_cloud.3db file. It is gray, but proper fog settings will repaint it. In this case, your ships, starspheres, stations, planets and asteroids should have the following userprops:
<pre><font size=1 face=Courier>
userprops={
category="Your category*",
nofog="y"
}
</font></pre>
*- Spaceship, Solar, prop or Asteroid.

You can also use the fog settings to change the color of distant asteroids.

Post Fri Sep 21, 2007 1:55 pm

Just wanted to say Thank You! Great info.

Post Fri Sep 21, 2007 4:07 pm

Please forgive me for this insanely simple question.

Is the spacing and placement of all those lines a necessity?
(Is there a simpler way to accomplish that? )

Post Sat Sep 22, 2007 11:03 pm

Well, the simple way to write THN scripts is when you want to make something, find a similar thing in another script, then copy-paste it to your script and modify. For example, if you want to add a ship, copy-paste it from another file, then change entity_name and temlpate_name.

Post Thu Oct 11, 2007 1:08 pm

You Absoloubte Genius. I've been Trying to that for ages.
Well Done

Post Fri Oct 12, 2007 1:51 am

taken you a while to see this ain't it ruppet ^^

maybe we could have a asteriody menu screen eh eh???!!

Universal Modding Forums


Return to Freelancer Editing Tutorial Forum

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