Reminder: Internet Explorer 6 or below are NOT supported.





There are currently 89 users playing Freelancer on
41 servers. | April. 13, 2021 |
Browsing this Thread:
1 Anonymous Users
The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
I’ve been meaning to get around to document the Freelancer .thn files and what you can actually do with them for a while. I wrote some (fairly bad) tutorials about it back in the day with a lot of information that I’ve now figured out isn’t quite right and I’d like to clear things up a bit, and also share what I’ve worked out since then.
I’ll post to this thread as I work stuff out, along with an index in the OP if it gets cluttered to make referencing stuff easier. If anyone has any corrections or additions, please please post them here. First off, some key things:
I’d like to start the thread off by dissecting a few basic entries from a really basic custom script from the alternate menu screen pack I made as a template for folks. The full pack can be found here, but I’ve attached the script in question to this post: Code: { Things I don't yet understand the fuction of here are srt_grp and usr_flg. *Valid options are UNDEFINED_EVENT, PSYS, DELETED, MOTION_PATH, SUB_SCENE, SCENE, HARDPOINT, MARKER, SOUND, LIGHT, MONITOR, CAMERA, DEFORMABLE, COMPOUND and UNKNOWN_ENTITY. Some of these are self-explanatory, but I’m not 100 percent on all of them just yet, notably MONITOR and SUB_SCENE. Next I’d like to take a quick look at the cameraprops entity for Camera_0 Code: cameraprops = I mostly understand these, but I wouldn't mind some confirmation on fovh and hvaspect regarding what exactly they alter as it's not entirely clear. After this is a monitor entity. I’m still not 100% certain what these are for. There are events present in many scripts that set monitors as cameras, but changing or removing these entries doesn’t seem to have an effect. If anyone has worked these out, please let me know! I’m going to break this initial breakdown into a couple of posts. Lighting needs an entire section to itself I think and I’d like to try and keep this relatively neat and avoid rambling if I can.
Posted on: 2019/11/15 10:56
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() Joined:
2010/8/27 14:02 Group:
Registered Users
Posts:
76
![]() |
Here is unfinished doc I was writing on THN stuff. If you want to continue from where I left off feel free to request writing rights.
Posted on: 2019/11/15 11:40
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
This is an absolutely brilliant document that has demystified a whole bunch of stuff for me! Thank you so much for sharing it. Going to change the format of what I had planned a bit as you've covered pretty much everything I wanted to + the bits I didn't really understand.
A few questions I still have though: What do the values in diffuse represent? is it just an RGB value, or is it a bit more complicated than that? (Sorry if this is more of a general 3d lighting question) I'm still not entirely clear what MONITOR does. Is it actually required to switch cameras, or is it okay to use a marker entity for this? I've run into an issue, particularly in menu screens, where using running_lights = true under userprops results in some odd visuals (boxes around the lights). Have you had any luck getting this particular line to work properly? (Screenshot attached.) Attach file: ![]() ![]()
Posted on: 2019/11/15 12:42
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() Joined:
2010/8/27 14:02 Group:
Registered Users
Posts:
76
![]() |
Glad to be of help. Just keep in mind while most information here is correct a few things aren't, I simply never got around to correct them or to continue writing it.
Monitor is meta-object representing your viewport, your screen to put it simple. Switching between cameras is event of SET_CAMERA. You should have only one monitor object in scene. Pretty much every color there is going to be RGB, however THN is inconsistent when it comes type of values: integers ranging from 0 to 255 or normalized floats from 0.0 to 1.0. Some properties expect integer, others expect float. Regarding lights it's just a case of textures not loaded for some reason, so it defaults to plain white color which is then tinted to whatever sprite had for diffuse color.
Posted on: 2019/11/15 13:43
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
Ah, that makes sense. I'll play around a bit with diffuse and see what I can get out of it.
Regarding the lights, I assume there isn't a fix for this. They were never intended to be loaded into the menu screens. I'm going to guess that getting the textures to load in correctly would probably involve an exe hack? Also I noted in your document you suggested to use 3d modelling software to draw the paths and then import them. Which software were you using for this? Any recommendations?
Posted on: 2019/11/15 14:38
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() Joined:
2010/8/27 14:02 Group:
Registered Users
Posts:
76
![]() |
There is a simpler fix for lights textures, you just need a model to embed texture used by those light sprites (matching name too) and push it into scene so it'll load the resources and display those sprites.
Regarding paths I'd normally just make them in 3Ds MAX. But there isn't a readily available solution I'm afraid, so it's not like you can install it, make paths and grab em from there. For my own uses I've made a script to export spline knots and capture rotation of a dummy object to THN path key points.
Posted on: 2019/11/15 16:34
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() Joined:
2013/3/16 7:49 Group:
Registered Users
Posts:
74
![]() |
FYI I'm attempting (with mild success) to provide an implementation of thn with a player of sorts in Librelancer (https://github.com/Librelancer/Librelancer) but no arbitrary code execution there lol. When it's done I'll be able to publish some more thorough docs since I'll have code to base it off.
RE your lights problem, you could try and make a tiiiny model that references the textures in the txm which would get the game to load it. (e.g. a solar that references efx.txm , and DcDt mats that use "bulb" and "shine" ![]()
Posted on: 2019/11/28 7:55
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
That's a pretty good idea! I'll have a go and report back
![]() Honestly it might be worth leaving the arbitrary code in just because it does actually allow you to do some interesting things with variables and makes scripts much easier to customize on the fly. Something else I've run into: It seems that when loading base/planet scenes, the events section for any 'hardpoint' scripts will not execute at all. Unfortunately this prevents the use of ATTACH events in bases. I've not yet found a way around this other than putting the models I want to attach things to in the 'ambient' scripts.
Posted on: 2019/12/4 6:25
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2008/9/11 15:55 From Somewhere at Moscow
Group:
Registered Users FLServer Admins $$$ Supporters $$$ Senior Members
Posts:
1766
![]() |
Tried to run thn server-side. Won't work.
But music from client-side is working ![]() Code:
See https://the-starport.net/freelancer/fo ... t_id=32782#forumpost32782
Posted on: 2020/2/5 23:01
|
|||
Open Sirius Mod | ||||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
@Treewyrm Bit late but I'm finally requesting edit access. I've started doing menu screens again and figured it would be good to note down what I figure out/remember as I go. I have a few bits on sparam ready to go already, so I'll add those when you approve it.
Posted on: 2020/3/8 17:25
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
So, I'm having a very minor issue with my START_MOTION entry:
Code: { The animation (the rotating part for manufacturing_platform_lod.cmp ) 'jumps' inconsistently every now and then. As it's just a simple rotating part, and it loops for the entire duration of the scene, I'm not really sure what to do to get it fixed. This is the first time I've really played with START_MOTION in a scene. Any ideas?
Posted on: 2020/3/24 8:53
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() Joined:
2010/8/27 14:02 Group:
Registered Users
Posts:
76
![]() |
How animation plays out depends on several factors. If animation script contains maps for more than one part and each map has different durations the animation will go out of sync as each part will have its animation looped independently. Type of looping is defined by event_flags property (restart, reverse, ping-pong, etc).
Posted on: 2020/3/24 9:56
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
I assume event_flags=2 is restart. I've played around with it and have seen the animation reverse and play once, but it won't loop smoothly.
You can see the behavior demonstrated here (Around 00:26): https://www.youtube.com/watch?v=HtYnk2kJwTk
Posted on: 2020/3/24 10:34
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() Joined:
2010/8/27 14:02 Group:
Registered Users
Posts:
76
![]() |
Quite frankly I just don't see what's wrong there, probably because whatever is supposed to be incorrect is just too far and youtube quality makes it all kinda hard to spot anyway.
Either way it's all about how map keyframes are set and whether they are looped or not. Some vanilla models have that and for full 360 rotation they have to make a quick jump as maximum rotation between two keyframes is 180 degrees. This jump can become noticable if there's time delta between its keyframes.
Posted on: 2020/3/24 11:01
|
|||
|
Re: The big .thn/.lua research thread |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
152
![]() |
Found a fix! Jeider on the Freelancer Discord provided some alternate keyframes for
manufacturing_platform_lod.cmp and that fixed the issue.For anyone running into a similar problem in the future, they can be found below: Code:
https://media.discordapp.net/attachmen ... 5622124101762/unknown.png
Posted on: 2020/3/26 13:45
|
|||
|