**Tutorial** - Intro scripts
Firts, you'll need the Fled-Thorn.
This program will allow you to edit thn files.
Once they are decompressed, you don't need to compress them, alike the inis.
Also, having a 3d prog will help you a lot !
I know it's hard to get a good one, but I think milkshape will do the work great.
Now that we have progs, lets start.
Decompress the file Intro_waterplante.thn, witch is in the DATA/SCRIPTS/INTRO folder.
Open it with notepad and take a look at the structure.
Here is the beginig of the file :
duration=361.872
entities={
{
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
}
},
One important thing : I advise you to keep the tabulation system cause it is alot more clear. The forum can't display it, so take a look at existing blocs, or download the text version of this tut.
So, let describe this part : the duration entry is the duration time (in second) of the scene. After this time past, it will restart the scene from the begining.
Then is the most important part, the entities.
In this bloc (will call it like that every thing that is put into "{" and "}" ), all objects of the scene will be referenced.
The "Scene" bloc is almost the same in every files, so keep it.
As you can see, every bloc is finished by a coma just after the ending "}".
The only exeption is the last bloc witch has no coma.
Be careful : if you make a sintax error, the screen will be black, and you won't see anything.
Althoug, if you make reference errors (like typing li_fighter"s" instead of li_fighter) the object won't appear and the scene will shows.
Now, take a look at the "planet_mercury_200_2" bloc.
It's the first "phisical" object of the sene.
Here it is :
{
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"
}
},
The "type" is always COMPOUND for phisical objects.
The "template_name" is the reference to the file listed in the "category" (here "Solar" --> Solararch.ini)
"lt_grp" seems to be a "light group", but i'm not sure of this, since changing it will sometimes turn the object dark or ligh...
For "srt_grp" (="sort group" ), i dont know what it meens, but it's not important since you can make a good scene without changing this !
Dito for the "usr_flg" (="user_flag" ).
The "flags" entry is a list of params that you can borrow from existing objects. It's not always the same, so check wath it should be for a ship or another object.
Now, the hardest part : "spacialprops".
You have two entries in it : "pos" (= position in XYZ, like in systems) and "orient" (witch i can't undersand at the moment). If you change it, you'll see your planet beeing deformed... So, I think there is no links to the orientation of the object.
After, there is the "userprops" entry.
Into this one is the "category", witch define (as i said earlier) in witch file to take the archetype.
You can put :
- "Solar" for bases, planet and other objects (exept suns). It will read solararch.ini.
- "Spaceship" for ships but also for battleships, gunships, cruiser, etc. It will read shiparch.ini.
Now, another exemple, and one of the most usefull : path.
There aren't any in waterplanet, so take one from gasminer !
A simple one :
{
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, {7760.895996,612.463013,-4181.623535}, {1.000000,0.000000,0.000000,0.000000}, {6997.041504,612.463013,-1500.000000}, {1.000000,0.000000,0.000000,0.000000}, "
}
},
You see that there is no template for a path.
Always let the path coordinates at zero, you'll see why later.
So we'll jump to the most important part : the "pathprops".
I havet seen anything else than "CV_CROrientationSplinePath" in the "path_type", so keep it like that.
Now is the more intersting part : the "path_data"
Here are referenced all the path parts. They are also in XYZ and they are calculated the same as other coordinates, exept that they are relative to the path emplacement.
You can also see that there is, after every coordinates, this : {1.000000,0.000000,0.000000,0.000000}
I've seen in other path that this is changed somtimes, but I don't know what is the use of that...
Thats now done for phisical objects, and if you want to add effects, then just take a look at bob's tut, whith explain it well.
Also, you may have a few questions :
Q : "How do the hell I know where to put my object entry ?"
A : Wherever you want in the entities entry !
Q : "How do I know how to place my object in space ?"
A : That's where the 3d prog is usefull : you'll have to remake the scene in your prog.
IE : In 3dsmax, divide everything by 10. For the camera, but only if it doesn't have any "orient" params (that why I chose Intro_waterplanet.thn) it should be easy to place it, since it always point to a simple direction.
There is also an important point : the field of view.
Take the exemple of the waterplanet camera : the fov is settled at 30.
But, you'll see in 3dsmax the if you put 30 in the fov entry, it won't be good.
The reason ? I don't know why, but if you mutliply by 2 (60) that will be corect...
Now, you should know the basics for the entities, and you're ready to learn "events".
Edited by - Chips on 10/31/2004 7:35:23 AM