#General modding chat
1 messages Β· Page 12 of 1
You should look at documentation, i remember it was something with transform, just search for "transform" and you will find it
tm.players.GetPlayerTransform(playerId)
does anybody know how to make these buildings?
@junior widget improved formation mod
am i not able to just download it on the workshop itself?
the workshop upload is from jess, he'd have to update it
or he'd have to let me upload this version
you can just put the mod from this in the mod directory
https://steamcommunity.com/sharedfiles/filedetails/?id=3585918112
i guess here's an unlisted upload
instead of the eyeball it uses the 1x1x1 tube
place the block as close to the center of mass as possible
also here's a BP of the block with the decal being the front:
A new update for Track Creator Plus is now on the Workshop. This includes the new StringAlong tool plus a few minor tweaks. Details in the Topic here: #1404642052129423466
Feel free to upload it
Same is valid for any future time
oops i did a dumb
max force value doesnt do crap, its stuck at 75
ima fix up some stuff then upload it, with thumbnail as well
how did i not see any of this, this is very understandable though.
Wait can you do transparency already by exploiting AA?
It just depends on what AA the game uses
should i do a modstructure.destroy() or .despose()? i assume .destroy() but am not 100% sure
what is the difference between the two?
Iirc one is instant, one does the deletion animation
thats an... interesting difference
i assume there still isnt a good way to detect collision vs being despawned?
Don't think so
π
Dispose Iβve always found more reliable
Is the modding api somewhere online? Like the lua file with comments and whatnot. Was wondering whether i gotta download it for my phone or i can find it somewhere
And is there a way for a raycast to not collide with a specific structure, but to collide with everything else?
terrorsoul has his modding portal with a section of all the functions listed out
The community hub for Trailmakers mods, guides, and spawnable requests.
Actually, in what ways can a block disappear? Collision, getting its health mowed down with a gun or sth, what else?
That looks... incredibly useful. Thanks!
backspacing or respawning
Does repairing also count? Like for detached blocks and whatnot?
@cinder spruce the mod wont switch through the modes i select, its always just the line formation instead of transforming into the others.
alr gimme a sec
seems to be working fine?
do you have a video?
might be because im only using three aircraft
the V and diamond are identical while using 3 or less aircraft
yea when i switch to any other formation it always stays as the line formation
are you able to get a video so i can see what you're doing?
@cinder spruce does the second wingman need the lighter gray color compared to the first wingman needing the darker gray? or is it the same darker gray color for more than 1 wingman
no all the wingmen are the same dark gray
they're sorted automatically
yea its bugging out for me
yea like i place one more of my growler with the dark gray color behind me
idk
its just not working for me
it is but its not switching through the other formation modes
oh yea for me they dont float
maybe thats why
the height offset doesnt change anything
they are still sliding around on the ground
Welcome to tm modding, where stuff doesn't work and noone knows why
the one on the workshop uses the eyeball, are you using the 1x1 pipe?
no i am using the eyeball block
i mean when on the ground they usually dont stay up
when flying its fine
like when i put on the v or any other formation mode on other than the line
they still make a line formation
doesnt matter what i change
all they do is go crazy
hmm 2 things
- what settings are you using?
- where is the eyeball placed on the build?
i put the eyeball piece as close to center of mass as possible (basically a block behind it) and also the only settings im changing is the distance and the formation modes at best
rq can you unsub and resub to the mod to make sure u have the latest version?
i really dont know whats wrong
alright
still didnt change a single thing
i just turned on the mod and changed nothing other than turn it on
and 2 of them just try to jump me
i tried changing the distance and that did basically nothing
so
yea
idk why this is happening
do i have to place them down in a specific order? or does that not matter
Why does the place of where the eyeball is matter? Is it to allow some design variation for how aircraft fly, or is it a necessity from the code?
you can only apply force or torque on a block, and not a whole structure
the closer to the COM the block is the more stable it is in general
Can you not? Apply force on a block? Torque shouldnt matter where the block is, since torque, but i swear ModBlock.getStructure().addForce(x, y, z) works
I guess ill have to double check, but i swear the anti drag block uses that sometimes and works well
You can apply force on a structure, yeah, not torque
Ah yes, makes sense
But torque still prefers to be applied near com else the com will receive weird forces
Can you elaborate on the weird forces?
If a clockwise (just 2d) torque is applied, let's say to the right of the com the com will be pushed upwards, at least I'm pretty sure in unity it happens like this
Same reason as to why putting the tracker close to missile fins turns sharper than otherwise
Ah, lovely
I do not know about this
Wait, so tracker at the back of the missile = good???
That is... very unexpected
That's how I remember it, yes
i had an interesting idea for a mod the other day
what if there was a mod that can create a recording and save the position and rotation of a build, and replay that recording by moving the creation through the saved points? could be interesting for custom missions with wingmen of sorts. might also be useful while recording videos
i might be able to try and do this using formation mod as a base
alright ive mostly isolated most of the stuff i need, and added a quick way to step through manually defined frames with positions and rotations
strangely it feels kind of dampened when its travelling in the negative direction, is something up with the PID?
If you attempt to do such a thing, i would also highly recommend allowing the data to be spit out into a format that can be copy pasted into desmos or sth, to show the flight path
well first i have to figure out how to work reading and writing data to the dynamic data folder, i have not used it before
alr managed to get something
you can see the footsteps where i ran around to record the path
0 manual flying
surprisingly easier than i thought it would be
still need a way to save the replay, and maybe a better way for it to loop.
i had to manually fly through roughly the same spot for a decent loop
@hollow depot
gah daymn
This is awesome! I'd love to have this system in Track Creator Plus to record fastest laps and be able to play them back as a ghost replay!
My original thought was to use a trigger box or non collision prefab as the ghost vehicle.
i could probably reduce how many points i record lol

i think this might explain why the wingmen in formation mod sometimes decide to form up 300m away
Super cool, that would also be good for a replay tool for racing
it is kinda finnicky but can work super well
Man I need your help with the physics api I made lol, you seem to have mastered pid
awesome
Lmaooo
At least the lua stuff works but yeah it's definitely a maybe for all the tm stuff
isnβt there a spawnables document in the same folder as the modding documentation or something?
Yeah but that's the names
Hence the check myself
oops wrong reply, mb terror
Yeah that's exactly what I meant, thanks
I'm assuming all transforms apply to these objects, so like scale translation and rotation
anyone know if theres a planet map kind of mod? that has a round world, water, realistic gravity, and potential for orbital mechanics?
don't think so, there's at least one planet mod but they don't have realistic gravity or water
water is actually just a really big flat plane so you can't have water wrap around planets and such, idk about gravity though, i know there's the orb in the middle of space sector but i'm not sure about modding that kind of gravity in
oki thnx
<@&1123912996406706277> Modding Jam for 2026??? Help me answer some quick questions https://discord.com/channels/296562030624899072/1428696418935377920
I mean it sure would give me motivation to expand my map loader
Because currently it's just an optimized fork of trailmappers loader but I wanna add path movement support and such to it
please i need help somone i am trying to import a map from somone else into trailmappers he sent me on dc the full zip file that you put into trailmakers but none of the files including the Map file inside of it are able to be imported into trailmappers
any ways to do this from my or his end
Yes, there should be a Map.json file in the mod your friend shared
You need to put that file into Documents/Trailmappers/Saves/"your_map_name"/
There it is
i tried that file it recognises its there bc it doesnt say no file found or whatever but when i click import nothing happens
ill try
The import function is for maps from a different format
No problem
ah i just needed to convert that file to a json file bc it wasnt one
is there a way or mod to remove clouds on danger zone?
No
circle
Man, makes me wish we could interact with logic to just give them better autopilots
What if... you could check for the position of flight control surfaces and engines and whatnot on the build every once in a while, and then limit the forces based on those. Would require making an autopilot that knows how to fly a plane actually, but would make the planes react to damage
Would allow the recordings to be more interactive
Or make the strength of the control surfaces very low on the build and apply a force on them
Ye or that, that would give a more realistic feel for it, but would require a lot more math to simulate the angle you wanna have the fins at
I've already done that for cars, so applying torque on the surfaces so that they stay at an angle is pretty much done, tho managing to get a plane to go where you want is harder than a car

Ngl, i feel the worst part for ai creations flying around would just be having to deal with being a players structure (being able to interact with logic would be nice, but isnt super necessary). Not being able to essentially have a modded player thingy that has their own id for the sake of structures and such would be super painful to deal with, having to check whether it despawned, spawning it back in in the same place, etc
Yeah using blueprints in mods currently is very jank.
Because the blueprints your mod spawns always need to be associated to a player which causes a whole lot of bugs.
#1385250615340306523 message
Oh wow. Its MUCH worse than i imagined
Yeah would be amazing if we wouldnt have to associate the blueprints to a player.
Or, give us a modded player (like an id of -1 or sth
@paper bone seperated tracks
took a lot more work than i expected 
Ayyy nice
Recording of 2 separate tracks, and replaying them
hmm
does json not play well with vectors?
i cant seem to get it to save properly
It might save the dot in the number as a comma instead and that breaks it
Yeah i believe you can do something like this:
local jsonString = json.serialize(data)
jsonString = string.gsub(jsonString, "(%d+),(%d+)", "%1.%2")
tm.os.WriteAllText_Dynamic(savePath, jsonString)```
Imagine if we had graphics mods or shaders that would be so cool
anyone know if its possible to change the emission strength of the headlamp block through modding? they are never bright enough
nope not possible
aw that suckss
Then you'd need a compiler which complicates things for the team
@cinder spruce scrapman used the formation mod v2
he forgot to mention it was your version tho
yoo fr?
2 scrapman features lsgo
Welcome to another episode of Trailmakers! Today I am checking out a mod that lets you fly multiple planes in various formations!
Formation Mod: https://steamcommunity.com/sharedfiles/filedetails/?id=3585918112
Tons More Trailmakers: https://www.youtube.com/watch?v=mwTCzFXIjVg&list=PLjtiR7dM6Lgp2qrCaaHCTjAmW-vC_IO5T
My Most Popular Videos (fo...
i just watched it and he even switched to reading the new description halfway through
I'm guessing he started with the base one, then realised how unwieldy it is
he had the new version loaded in at the start so maybe he just had the wrong one open on steam
anyway i have a few things to change/add
i want to try out a ground mode for ground vehicles so it doesnt shove into the floor
Should be as easy as disabling y axis, the code might already be there if I stole everything from the missile logic
Hey, is there a way to interact with functional blocks? Like spin a servo or get the number on a number display through a mod? Or at least send inputs to a creation?
Interacting with logic was suggested, but it's not yet implemented
Ok thanks, that would be super cool
If need be you can control servos by adding torque and read values with some servo or something+checking the rotation of a block on it, but they are not easy/compact
You can also spawn objects in front of sensors, but it easily breaks with movement
anyone know if there is a alternative mod to block editor like to get custom colours because the mod just corrupts builds it hasnt worked for a while
don't use the set all or any of the options that say "use at your own risk"
they are kinda unstable and are the ones that corrupt builds
as for the color its an issue with modding which is getting patched in the next update
ah alr
So im interested in working on modding tm, ive looked around but i could finde how to make a mod using the lua
i found it
question, i dont think so, but is it at all possible to change the color of bullets? i doubt it but itd be cool
is there a list somewhere of the blocknames for modding?
you can make a pretty quick mod to get the name of any block that you're selecting
might be a good introduction
Anyone know the dimensions of maps, like test zone etc. Grid squares. Its been discussed before but I cant find it
Test zone is 15000 x 15000 iirc
All maps are 15 x 15 km with the space map being 25 x 25 km.
Each test zone square is 15 x 15 meters
test zone square you mean the large grid squares?
its from center of the black line to the center of the black line on the other side
I think this scale is ok, from looking ingame its about 4 barrels per small square
Do you happen to know the y heights of the maps?
iirc its 7.5 km, dont know about space
test zone is 300, dont know about the other maps but the water is always at 0
from what i remember space sector is equal length on all sides
Going to call it approx 200 for stranded
oh man, i wish there was a 25x25km ground map
Iirc it's always 50
Can't confirm it tho
Unless that was from the bottom of the sea
oof, sorry bout that trailmakers π¬ first time mod maker, tried making a team sensor block
I've realised where I went wrong, wont do that again π
anybody know why my cone is purple?
These latest updates the Devs have been removing some unused assets from the game files, I'm guessing they removed the texture but not the model
Are you running the game with low quality settings? Some prefab assets have missing textures at lower quality settings.
hey im trying to make my first mod but im having a hard time making the main.lua file and idk how.
create a text file and name it main.lua
thank you stino!
I'm trying to make a mod that spawns a line at a block and rotates it so it aligns with it's face but I can't figure out how to rotate it correctly does anyone know how to get the line to be positioned and rotated so that it looks similar to the red one image
whenever you finish this mod, i need it xD lasers for distance sensors is awesome
Yeah I'm making it to help me improve tracking
coolio
If i finish it i'll upload it to workshop if you want
up to you
your rotation is unused, might wanna do something about that
thats because I tried to rotate it and it wasn't accurate. i'm pretty sure It only worked in build mode either that or I just didn't use it right
that code is a temporary solution, it spawns multiple lines in different directions instead of one line in the right direction. and I removed the code for rotating since it wasn't working and I needed to fix other things
btw, the os lib is disabled in TM, i believe there is a time function in tm.os
thanks I found it
also you should use SpawnObject for spawning prefabs, iirc SpawnCustomObject is for custom 3d models
thanks I fixed those
also I have just checked and GetRotation is only accurate when in build mode, once the block is out of build mode GetRotation will still get the rotation of the block but it will only return the rotation the block was in when it was last in build mode
what did i do wrong?
check your mods .log in the modding directory
your second 0 in AddUiButton needs to be a string (identifier)
did it and didnt change anything
yeah the button setup looks like this, you dont need anything in data if you dont have any value to pass on
i am forgetting how lua works but could also be you need to define your SetGravity function before the AddUiButton reference.
yeah that would makes sense and it works!
thank you frans!
oh lol i didn't think so for a sec because for some of the mods im working with it was setup kinda like this which works fine
right haha
ids can be any primitive type
because the createui function defers the execution of the adduibutton call until after the function setgravity has been defined, so when the name is looked up in the global namespace it finds the function
yeah i figured
here's what i think you should do,
this model is just a simple cube, 1 x 0.1 x 0.1, with its origin at one end of cube
makes it a bit easier to position and orient the line, since the origin is at the end.
you can load it with tm.physics.AddMesh("line.obj", "line") and spawn it with tm.physics.SpawnCustomObject(pos, "line", "")
as for the block rotation, i believe it is in local space strangely
function GetBlockRotation(block)
local forward = block.Forward()
local right = block.Right()
local relativeX = forward.x
local relativeY = -forward.y
local relativeZ = forward.z
local angleradY = math.atan2(relativeX, relativeZ)
local relativeangY = math.deg(angleradY)
local relativehori = math.sqrt(relativeX * relativeX + relativeZ * relativeZ)
local angleradX = math.atan2(relativeY, relativehori)
local relativeangX = math.deg(angleradX)
local W0 = tm.vector3.Create(forward.z, 0, -forward.x)
W0 = W0 * W0.Magnitude()
local U0 = W0.Cross(forward)
local Angle = math.atan2(-U0.Dot(right), W0.Dot(right))
if Angle < 0 then Angle = Angle + math.pi * 2 end
local relativeangZ = math.deg(Angle)
return tm.vector3.Create(relativeangX, relativeangY, relativeangZ)
end
here i made this function based off something from jess's mods, it gets rotation from a block in world space from the forward and right vectors
Thanks this works perfectly
W0=W0*W0.Magnitude()
What was I thinking, that's not how you normalise a vector
But if it works it works
how would i go about making it so that i kill all players alive?
using a for loop and looping over the table that is returned from tm.players.CurrentPlayers()
this website is fairly usefull for getting a overview of the available functions
https://mods.trailmakers.ludixi.com/docs
The community hub for Trailmakers mods, guides, and spawnable requests.
but how do i make it so it goes through the list/table?
with a for loop
maybe look at the lua documentation for a introduction to the language
quick lua from memory so might be wrong
--first get the player list
local players = tm.players.CurrentPlayers()
for i, player in ipairs(players) do
-- now `player` is one element in the players list
-- you can get the playerId from the player object
local playerId = player.playerId
-- then call KillPlayer for _that_ specific player
tm.players.KillPlayer(playerId)
end
-- this will be done for each element in the `players` list
this works thanks frans! i was trying to figuer it out for over 40 minutes to no avail
first trryyyyy
will there be thingy to do block bans in the next update?
(but i very, very much wanna look into it)
I also would love that feature
augh
can i just shove like a null value or something on that last one, i don't want a sprite
i dont think you even need to put it
just remove the last argument entirely
i mean, yeah it worked with only 2 parameters (header and the second thingy) but someone said to fill all 4 parameters to fix invoke ui callback
Fully omit any value and it will use a default icon
ok
Banning blocks would make making campaigns a lot easier
π€
Whenever we suggest a new modding feature to frans we now must always present how it specifically would make it easier to make campaign mods :P
i'd just use it to ban specific blocks automatically for things like demo derby
with the persistence of data on the mods (idk what it's called, where you leave a session but the mod still keeps track of stuff) you can probably make a block ban presets mod too
but for now, i'm gonna try making a mod to reload custom unguided weapons like bombs by spawning the blueprint under the player with an adjustable offset
that's the plan at least, i don't have the slightest clue as on how to implement that
i thought of doing such things, but never had the time to try. good luck, and may lua be with you!
The current method of destroying peoples builds if they use the wrong block is a very rough approach
I would say 95% of what is being suggested here is pretty sensible and worth adding.
I have been wanting block banning/restrictions for a very long time for the sake of gamemode creation; creating constraints in sandbox games it literally the way forward to faciliate play π
i've got the time to try but not the skill to actually do it, not yet at least
-# but i'm not gonna promise anything since i'm not known for keeping promises like this lol
I know its just a joke since you have said previously that you would love to see more campaign mods
space sector
that would be awesome
If we could change the skybox we could make a better more realistic space map
having builds belong to no player/modded player could allow for custom enemies on the map... (if this was possible i would so make AI enemies for the Custom missile mod)
Or traffic
that too, tho for enemies i think its even more clear, as stuff like locking on with autolock wouldnt work on builds from the same player (maybe? am actually not sure, but i assumed so since same team and whatnot)
No i think it only doesnt target a build when there is a player of the same team inside (atleast from my in game experience)
maybe, i dont remember, havent used autolock in a while
But it would resolve a lot of the currently existing bugs related to when using blueprints as if they werent owned by a player.
just wondering before i start later, but is it possible to adjust the power of the propellors? ive seen it for the jets and thrusters, but never seen one for the propellors at all
ModBlock.SetPropellerPower(power)
how do i make it so i can use the ModStructure.AddForce(X, Y, Z) i have tried alot but i can manage to get it to work can anyone help? and just in general the ModStructure
Can you be a bit more specific? What's the plan? All modstructures or a specific one? What about the modTransform, that has nothing to do with structures
for now i want to make vehicles the person is in accelerate in a direction really fast (up for example)
and with modtransform i mean modstructure my bad
Ok, that's decently straightforward, you have to call tm.players.GetPlayerSeatBlock(playerId) to get the seat a player is in, it will return either nil or the ModBlock of the seat (add a check), at that point you can do ModBlock.GetStructure() and add force on said structure, if you want a constant force do it in the update function, else do it wherever
im trying but i dont know how to continue from here.
Do you have the docs at hand?
i got the trailmakers_docs.lua and a lua document
ok, that's good
first tho, here tm.players.GetPlayerSeatBlock(playerId) returns the seat as a ModBlock, you are gonna have to store it somewhere, same for the structure, so either do something as simple as
local structure = seat.GetStructure()```
or you could do directly
```local structure = tm.players.GetPlayerSeatBlock(playerId).GetStructure()```
and from here i can do structure.ModStructure.AddForce(X, Y, Z)?
just structure.AddForce(x,y,z)
in the docs the name ModStructure is a placeholder for whatever variable that contains a ModStructure you have
same for the other classes
it works! thank you so much ive been trying to figuer it out for the past 4 hours.
ah okay! i think i got confused from there
donβt hesitate to ask for help here when you need it :)
Stupid but funny solution:
Create a program that poses as a player, can join and leave, and not much else. Kinda like how games have the "X game dedicated server" on steam as a seperate thing, tho here it would be a dedicated fake client
@warm canopy
?
banned from ludixi? what did you do??
i got the same thing
i believe whatever host he's using kicked him out
hmmm why is it not working? it should work i think but i keep getting failed to invoke UI callback
playerid doesnβt have any functions, its just a number
i believe you can get transform from a function under tm.players.GetPlayerTransform or something
i cant check docs rn cuz terrorsouls site is down :(
tm.players.GetPlayerTransform(playerId).GetPositionWorld()
something like that
wait that indeed is there... there is no way i would have kown because the website is down 
Run the mod called documentation, it will generate a file called documentation, in the folder "mods", with all the functions
well im on phone, otherwise i would have the docs file on my pc
okay it now works. i used: tm.players.GetPlayerTransform(playerId).SetPositionWorld(TeleportX, TeleportY, TeleportZ)
anyway do you have this thing setup from alva? https://discord.com/channels/296562030624899072/1141061251796041799
Yeah I do but I had the old version it seems as most functions weren't on it
hmmm it only works when im not in a seat is there anyway to make it with the whole vehicle?
you arenβt able to set the position of structures unfortunately
only apply forces, which is what formation mod does pretty much
let me guess it also uses alot of math?
Surprisingly only force and not torque, gotta use blocks for that
Donβt panic Iβll fix it when Iβm home. Iβve been out all day
Hosting autobill didnβt go through so they suspended my account temporarily
rip
Should be fixed now
yeah, it works
@warm canopy I didn't know you could submit guides on your website, that's super cool
You can teleport a player and the structure they are seated in if you use a spawnpoint
YO can a trailmaker get some help
The preview image has to be less than 1mb
thats good to hear cause mine is 1.02 MB how do I make it smaller its the base image you get with just not uploading one x.x\
there should really be some more instructions when uploading a mod lol
Or at least better errors...
There are tons of sites that compress images
Loose some quality, but it's no big deal
so I did this, still at this. is there something I need to do to get trailmakers up to date with the new preview image?
The folder you are showing here isnt the folder that will be uploaded
Changing things in that folder wont make a difference
so I need to find it in trailmakers directory somewhere
install_dir/mods/mod_name
You need to change the preview image that is in the folder with the name of your mod here
THANK YOU SO MUCH @paper bone @radiant lion
that looks like a peak map might have to check it out later
ok, in what units is the force? newtons? what is the gravitational strength (at 1.0 gravity)?
from my experiments, power of around 2.1 (2.1*deltatime applied every update) seems to make a 0.8kg pipe levitate, but the acceleration seems to be 14 m/s^2, at least if my acceleration based on velocity based on position shows, but like, that is incredibly chaotic and weird and idk if units are wrong or if im a dumbass or whats going on
14m/s/s is the correct gravity in TM
hmmm, that is very weird
ok, so eyeball math:
V/0.8kg=14
V=11.2
2.1*X=11.2N
X=16N/3
so one TrailNewton (as in the unit strength you use in the addforce function) is roughly 16/3 newtons
but measuring it with a different method gives 4.97ish as Newton to TrailNewton ratio?
crisis resolved, the weight was actually 0.15, not 0.8
what
my mod isn't showing up in steam or the in game ws?
https://steamcommunity.com/sharedfiles/filedetails/?id=3601057434
wth
I don't see it either, very weird
I was only able to find it when I went through your steam profile
Shows up here
no problem here either (web/steam view, didn't check ingame)
I see it now too, i guess it just took a long time
hmm idk
ig took several hours to actually show up
will we ever possibly get a way to make custom light sources for maps?
maybe in future updates but not any time soon
how long until trailmappers update? i know its thirdparty i think, but still
idk, but falshbulb needs to update the modding api for custom lights to be possible not the third party software trailmappers
yeah, in the meantime, anyone know a good way to imitate LED lights in trailmappers?
specifically a LED floodlight
theres only a few objects that give off light,
- Chest
- Lava
- Flamethrowers
- Salvage
- Power core crate
you could try experimenting with those
at least those are the ones i found
only the powercores give off blue light, and i need white
8 powercores to make that light
some of the other lights are a bit warmer, you could try combining them to cancel them out?
its better...
i wish there were more colors, but i also wish alot of things, thanks for the tip AJ, it it greatly appreciated
also, AJ, these give off a small amount of light too
those are just emissive, they dont emit any light onto other objects
aw man
tm.physics.SpawnPointLight(position: ModVector3, range: number, intensity: number, color: ModColor) would be sick to have
You are forgetting angle of the light cone
can anyone give me an example of how to read information from a file and write it into a table with mods? i haven't really used it so idk how to do it.
local content = tm.os.ReadAllText_Static("foo/bar.txt")
tm.os.WriteAllText_Dynamic("foo/bar2.txt", content)
its a point light
i suppose a spotlight could be something seperate
the moonsharp json lib is probably what you need
you can use json.serialize(table) to convert a table to a json string, and you can use the functions given by alva to actually write the data to the data dynamic folder.
to read the data and convert it back to a table, you can use the read function, and use json.parse(string) to get the table back.
local data={}
function saveData()
local jsonString = json.serialize(data)
tm.os.WriteAllText_Dynamic(βsave.jsonβ, jsonString)
end
function loadData()
local jsonString = ReadAllText_Dynamic(βsave.jsonβ)
data = json.parse(jsonString)
end
something like this i think
thanks, i'm gonna try it
i'm having trouble with data = json.parse(jsonString) it gives this error there Unexpected token : '='
I dont know if its like this in TM modding but json is "key": "value" , there shouldn't be a '='
the parse function returns the entire table though
Ok
Thanks, it worked
Does anyone know why the object spawns farther ahead of the block when the player isn't near the build. It only spawns correctly if it either isn't moving or the player is near it.
objects far away from the player update less often
then should I make it have an offset that scales with the distance
wait but if they update less often when are they in front of the build instead of behind
is it possible to affect player fov in first person with a mod?
is there a list of all spawnable object names?
tm.physics.SpawnableNames()
thx
i think in 2.2, spawnable names, audio names, and docs are auto generated in the mods folder from now on
neat
imagine we could have space sector render distance in other maps
you could literally see stuff from miles away
is there a mod to lower some drag of blocks?
afaik not a dedicated one, but it can be done with mods. the experimental branch of the custom missile mod has something kinda like it, but its done in a janky way and is meant for building missiles only. i know that @radiant lion is messing with a properly made custom drag blocks for the new custom missile mod, but its not yet available.
if you have some basic knowledge of modding or just programming, it shouldnt take long to make a mod like that yourself
@cinder spruce told me this was great reveal, so sharing Stino's clip here to show the new UI option π
Awesome, more ui is always welcomed
peak cant wait for that new UI
can confirm what obo said, just, it's possible but noone exist yet... but i'd reccomend waiting as setting drag right now has some side effects
Is there a way to know the drag of blocks without having to calculate it?
Only in 2.2
only 7 years days away
Yesnt, as apparently even the 2.2 values are not what i would expect (as in are not N*(m/s)^-2.2), or have some other multiplier chicanery
does ModBlock.GetMass() give the weight of the blocks? i'm having trouble using it, like the weight is around 5 times less than the in game weight
iβm assuming it gives the weight in the engine, like how melvin weighs 150kg in the engine but is heavier in trailmakers kilos?
-# disclaimer: untrusted source, me
Sounds pretty correct
-# disclaimer: I actually dont fully know, but I can see it returns the RigidBody Mass but I dont have the full overview of what "weight" actually yet. You might be missing some additional value to figure out the actual "weight".
on the block 1x2 it's accurate if i do ModBlock.GetMass() * 5 but for straight suspension i have to multiply by 10 to get the accurate weight
why does everything have to be inconsistant
I think i saw somewhere that it only returns the weight of 1 part of the block, so you get the weight of half the suspension
so every part that has something moving is half the weight?
Dont know if its half
the weight i get from lrage hinge through mods is 0.78 but the in game weight is 1.1 so yeah not half
how does parenting work? since you can't set the transforms yourself you'd have to do something else
Do you need to like make the matrices then convert them back so you can supply the r, t and s manually?
Parenting was suggested, but as of now that's the best you can do, set the transform values every frame based on those of the parent and an offset you give
Like this
at some point would someone be willing to help me set up the modding stuff? i haven't been able to figure it out
what is an acceptable amount of vertices for a custom map?
guys my map isnt mapping
@cinder spruce do u know the problem?, sorry for tagging u if ur busy or something
Thats too many triangles
At some point if the model has too many triangles trailmakers will just do bs like that
whats the max amount?
like 10000 or like even lower, 5000?
I dont actually know
I think it's like max 1 mega byte but idk
That's for tecture i think
is there anyway a icould anchor a 3d model to a build?
the easiest would be with 3dModelObject.GetTransform().SetPosition(position)
1000 workshop mods π
should ask for a Super Modder role xD
this is all mods uploaded not just from me xd
i only have a few
oooh, too bad i thought you were cooler lol
(this is a lie, youre sick xD)
anyways, can someone tell me how to access the modding API? i cant figure it out
ive been given links to the Wiki page, it dosent help
please someone?
ok, ummm, how do i save the code and get it into trailmakers? i found the mods folder and saved my mod to it, but its not showing up ingame
@cinder spruce how doeth i get a mod ingame?
this is how u enable them
in the mods folder, add a folder, name it sth, then into that add a main.lua file
thats the problem though, its not showing up ingame
wait, whats in the main.lua
it now shows up in game, but it didnt work, im cheking my coding now xD
does anyone have a list of all the blocks/ what they are called for modding? im trying to detect if someone uses more than 2 large flak
i cant find the block ID
I don't exactly remember how
ModBlock.GetName()
you can print to the log file the block you selected in build mode
65536? right?
I don't remember if that was tri count or unique vertices
no idea
32767
Is there anyway I could get ps5 grass on pc?
do you guys have any menu api or yall use the unity debug UI?
I think I might port mine and make it open source, tho it uses ML
The community hub for Trailmakers mods, guides, and spawnable requests.
it uses lua
alr
Is there any way to make a mod that allows you to use any seat underwater?
Nope, not a power the mod api has (unless there is sth new in the tank tracks update)
Yeah thatβs what I figured, I looked through all the stuffs and didnβt see anything
I hope that will be the case tho
For steam uploads right? No way it's for just textures as-is because that's literally nothing
It's for the preview image
Not a thing for 2.2
How fast is it to set the position rotation and scale for an object? I'd like to have an idea before even bothering with some ideas I have
(I can precompute the transformations so that part is not a big issue)
(the project in question is kind of related to this :3)
When i had like 4 objects moved every tick, 60 ticks per second, my game started to slow down(server fps went from 60 to around 30-40), but i have a pretty bad pc and also it was every tick
You can try but I doubt 100 will be very good for performance
It might not be possible then unfortunately
They'd need to be updated at least 30 times per second unless there is like a way to do lerping at a native framerate
how do you upload mods? mostly how do you set the thumbnail and description?
If the custom object is a rigidbody then youβll get much smoother frame rate
It won't need phyiscs
As I said, all movements are known
Unless that somehow changes things
If itβs a custom object though even if itβs static , if itβs a rigidbody itβll sync with the physics engine
Much smoother movement than if it wasnβt a rigidbody
What are you trying to make?
Just something that can replay animations
So given
Pos A at time 0
and
Pos B at time 1
I would need to interpolate linearly between them
Okay, but what Iβm saying is that if itβs a custom mesh and set to rigidbody. You wonβt get the teleporting affect like you do when it isnβt
So what does it look like when using a rigidbody? can you explicitly tell it how to interpolate or does it just do it automagically?
You can use the lerp function
You can do it from the host options in-game, just add a preview.png file (less than 1MB) in the mod's folder, it will make you choose a mod directory, it should be "mods/modname" then it will make you choose a proper name and description (you can always change it from steam directly)
thx
Oooooh I see that makes my job much easier
tm.vector3.Lerp(vector, otherVector, t)
Linearly interpolates between two vectors.
Parameters:
vector ModVector3
otherVector ModVector3
t number
Returns:
ModVector3
Wait I don't see how this would make it smoother? since this is just lua side right
If you are just updating the position normally every frame but the object is set to rigidbody it will be smoother
Try it
okay wait, is this a method you can use on a mod object or is it just a function for vectors?
Just saying "it's smoother" is completely meaningless if I don't know how or why it's smoother
It's a function on vectors
Are there any guides floating around on how to make a custom map?
Probably wonβt actually end up making one but Iβd love to give it a try
LittleCornDog has a video on Trailmappers, but there are also other ways of making maps like TrailEdit whatnot
https://youtu.be/o_3_NpOSLzQ
Join the Discord! π€
https://discord.gg/nsXXUYujJn
My Western Map: https://steamcommunity.com/sharedfiles/filedetails/?id=2996553656
Off road map: https://steamcommunity.com/id/littlecorndogs/myworkshopfiles/?appid=585420&browsefilter=mysubscriptions
Community Map: https://steamcommunity.com/sharedfiles/filedetails/?id=2814307506
If you ...
Ty!
Yeah, you spawn your map over a existing one and the barrier remains,
Alr
There's no way to do stuff in clip space right? I know I'm asking weird questions but like I'm mostly just thinking about stuff
Would mostly need that since it's not possible to get all the variables that go into defining the camera right? I guess the best I could do is just get the camera data and have all the data I can't get be manual for the player to adjust or something
Though I didn't see anything on how to get the camera data
and you can't seem to get the mouse position (only when it's down or up), hm
You have to do something really janky to simulate mouse controlled look direction
Yeah that's what I thought
You have to basically create a camera rig seat that uses mouse input for movement then measure the players rotation
guh
<@&1123912996406706277> https://discord.com/channels/296562030624899072/1441041011970281533
Added function to interpolate between colors
tm.color.Lerp(ModColor a, ModColor b, float t)
Is this just (a + b)/2 or is it the square root correction thing that literally no one gets right
no clue, just used the one that Unity offers
Okay yeah then it's probably the "incorrect" (but standard) one lmao
But yeah colors always bad everywhere
Yeeah
Well this is another version but I see no reason why they would ever change it
pretty sure a few minor things are missings
like the getDefaultDrag or quaternion equals
It's a newer version, the 6.0 beta thing unity seems to be doing I think
But I'm not sure
no, i mean from the changelog
Added the getDefaultDrag now π Thanks! Been hectic lately hehe
also the set wind is missing
DEAR LORD
:)
Done!
serious question, how are the changelog made? memory, some list stored somewhere...
In terms of modding I have a Document where we add to it every time we complete a task.
But it got a little side tracked here in the end..
We are actually talking about how do do it better overall for the game.. As it is hard to parse commit messages into changelogs. And sometimes things are a registered task.. Sometimes it it made adhoc.. So it is REALLY hard to track changes.
i see
The formatting completely fucks up copying from Confluence to Discord so that is intensely annoying.
time to make a script that converts from comfluence to discord then
I would love to know how other game companies does it π
I refuse to touch any of Atlassians APIs
i was thinking more of an external app where you paste the stuff from confluence and lets you copy a re-formatted version for discord
In OSS projects at least semantic commits work well. Tldr: enforce commit messages to follow the syntax <type>(<scope>): <description> (it's a bit more flexible than that), then you can use pre-made tools that take those commits and split them into lists of features, fixes, breaking changes, etc, potentially divided by scope
Yeah we were talking about it; it would be ideal to have it like that.. But a lot of times we have stupid commits here and there.. We moving a little faster than what you do in usual online projects. Sometimes compile errors are pushed.. And perforce you can't really do amends the same way as you can on git.
You also have to remember more than half the commits are artist doing "Updated model.fbx" or whatever and you can only get SO FAR with semantics like thos
chore(models): update X.fbx. Then it's a simple filter (usually tools already filter out all chore commits, also works for formatting, refactor, update libraries, ...)
It took us 2 years for people to add links to the related task URL so not sure how long this would take for people to get in the habit of :p
while here can you explain this
Player userdata will now contain Player Id, Player Profile Id and Player Name.
pretty sure the logs don't explain what the components of userdata are and stuff like .name .username or .profileId isn't working
If you want to get changelogs somewhat automatically, you need to enforce some consistency somewhere. If you can only assume commits are random letters you can't do much without and over-engineered AI that can generate descriptions from raw diffs. There are tools to automatically validate things if they don't match the syntax to help enforcing it
Does it work in game?
local players = tm.players.CurrentPlayers()
players[1].playerId
players[1].playerProfileId
players[1].playerName
The docs will include this in later version; I just haven't landed the new docs yet!
The only times i've heard about atlassian it's always been about negative things lol
Did setting health get fixed?
These modding additions are very interesting and will probably get me to do modding again.
The setdrag functions for blocks will be especially useful for rebalancing certain blocks using an excel spreadsheet and for incentivising players to use certain blocks over others: e.g adding drag penalties for thick wings so that gliders have skinny wings like in irl (aka narrow 'wing chord').
The wind function will also be super useful, although a per player version would still be appreciated!
Overall this is the right direction for trailmakers to head in!
No, but hopefully soon! π
I have a bunch of changes that I just need to land for next update
More to come π
Updated the functions on my modding site
After update, spawn locations on custom maps are broken
for me it's fine, can you link the map you are having trouble with?
my map oflex offroading experience extended
it is spawning at 0 instead of at the spawn point
not sure how to fix it
I used trailmappers
it is only failing on the first instance
after that, holding backspace lets you get to the right spot
just thought it was an odd behavior
Havent had this issue even with trailmappers maps
Whats the error in the your mods folder (.log file)
for me in single player it loads fine
is that the errorlogs.gz
it's in the mods folder
2025-11-20T13:03:51.4714219-05:00 failed to invoke OnPlayerJoined
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
i have no idea what it means 
Yeah... me too
- send link with map
- write me exact steps to reproduce it
will check it out next week
Thank you https://steamcommunity.com/sharedfiles/filedetails/?id=3563372295 To reproduce it, start the map, with the name 0ff Roading w/banned blocks, turn on player deaths, ban all the blocks that are flight or gyro blocks, and closed seats. then when people join, it has them join at 0,0 instead of the spawn point, and has the error message Failed to invoke on player joined. Could be an issue with the spawn location piece in trailmappers
That token has always been weird anyways. It makes people spawn on top of each other, no error handling.
what is tm.color.RGBToHSV supposed to do? It takes rgb values as input, but since it returns a mod color you can only get rgb values out and it should behave exactly like the normal .Create() constructor (specially since the alpha arg on that is optional). Currently it seems to always return RGBA(0,0,0,0) as well
my IDE docs have been updated
im trying to randomise a vector 3 for the new wind function but i recieve this error
your function needs to return a ModVector3. Right now it returns a Table
also you invoke randomWind() with no args, meaning no numbers, which throws your error
okay i fixed it now (i shouldnt have asked GPT for help)
If anyone has any useful bits of code, you can add them here if you want. https://mods.trailmakers.ludixi.com/snippets
Might be useful to some
The community hub for Trailmakers mods, guides, and spawnable requests.
i will upload my whole project when im done and have published it :)
Holy Jesus over 11k messages in this forum chat I never check
Having issues with hosting provider, they randomly decided to rollback the whole server overnight π
Fixed. Lost some snippets that I added but thats about it.
alright, then it's good that i didn't upload any yesterday
I'm having an error uploading a snippet
this is what i'm trying to upload
Yeah, host has really made this complicated
Try now?
It worked
Functions area got updated, now relying on alva's functions since they have more info. Also various other additions to the site to hopefuly make it a useful resource
I just tried to download the input library from https://mods.trailmakers.ludixi.com/libraries but none of the download links are working does anyone know why?
The community hub for Trailmakers mods, guides, and spawnable requests.
No idea, i can't either
I think these are the libraries if you still want to use em #1141357451887779910 message
thanks
for if you want the library on visual studio use the library from in the trailmker files (C:\Program Files (x86)\Steam\steamapps\common\Trailmakers\mods/trailmakers_docs.lua)
Added a bunch more snippets: https://mods.trailmakers.ludixi.com/snippets
The community hub for Trailmakers mods, guides, and spawnable requests.
Is there going to be a new trailmappers mod at some point with the new assets? I would love to be able to make my own snow or ice map.
It's being worked on but will take some time as hampta seems to be pretty busy
i need help
whats the gravity call i would add to a mod that will take the world gravity value
is stinos sled mod available?
nope
tm.physics.GetGravityMultiplier()
ok thank you
I never read this chat before
Welcome to our humble chat
ive been trying for a bit but i cant seem to get a simple looped timer going that works with a Boolean and then call a function can anyone help me with that?
i can
Time = 0
function update()
Time = Time + tm.os.GetModDeltaTime()
if Time >= Delay then
Time = 0
--your code
end
end
``` something like this should work
how can i get the forward drag from ModBlock.GetDragAll() and from ModBlock.GetDrag(aerodynamicBoxIndex)? i'm having trouble with them
From memory, but I think this is where it landed.
local box = ModBlock.GetDragAll[1]
local forward = box.forward
--same as
local box = ModBlock.GetDrag(0)
local forward = box.forward
thanks
Hello does anybody want to help me with track switches? Im not very good at coding. The reason why, I have a two month map project that sadly does not work after the update. If someone could help me to make a custom train switch, where the player can decide where to go, would make my day.
Would it be possible in any way to let a VR headset and/or controllers control a build? Totally not because I want to turn into a Dreadnought I made
Not through the modding api. You could try and use some kind of layer to translate your controller inputs into something readable by the game. But i dont really know much about how that works exactly
I'm not the best coder out there but I'm happy to help out
It might be easiest to simply switch "setIsTrigger" on and off for parts of your switch tracks depending on which way you want the train to go
@warm canopy the libraries on your website dont work btw (translated: File was not available on the site)
I'm aware ive taken them down whilst I work on them more
right now i kind of want to make a mod the adds stalling to trailmakers, just really simple if the aoa is over 25 degrees it makes all blocks have 20% of the drag up and down but the thing that i don't really know how to do is modifying the up and down drag of the creation without modifying the forward and backwards or sideways drag of it. So if i change the bottom drag of every block it will change the bottom drag of every block but if a block is rotated it will not be the the bottom drag being changed, compared to the vehicle
Easies way is probably to compare block rotation to player rotation, and you either just use some Ifs for the 90Β° if you want something simple, else you'd have to use sin and cos to also get the odd-rotated blocks
could i use ModBlock.GetRotation() work? it does give the local position of blocks
Oh right, yeah, you can do that
Not exactly sure how it works with stuff on hinges tho
@formal crane Just to confirm - we can't use SetIsTrigger() on objects spawned with tm.physics.SpawnCustomObjectConcave right?
Nope. PhysX does not support concave triggers.
Thanks, thought so. Makes things tricky. Any news on giving us proper no collision for any object?
Hasn't been high priorities yet, but I will keep it in mind for next year's planning.
Do you think people would be interested in a faction-like territory mod? It requires using my trailbridge client for the server host. Basically factions would have territory that they can claim etc. Not sure how Id fully handle whats considered territory etc
that would be interesting
Keep this idea in your head 
Ok that sounded mean, just we might get more cool stuff next year that would make that idea cooler. (not confirming anything, just speculations so far)
-# ability to ban blocks from the api ? 
I said to much, I'm out, Frans save me
Id love some sort of way of mods storing to a central data point that. It opens up a bunch of possibilities. My trailbridge app all it does is read an inbox.json file and an outbox.json file
I would rather that not be a thing at all. Too many security/privacy considerations to be worth it imo
It's essentially a reverse proxy into a network. If you can connect to an arbitrary network server, you can also connect to anything that's exposed in the LAN as well, or any other process on localhost
The app doesnt open any inbound ports etc
Mods cant tell the app where to connect either
Unless you are referring to how the devs would implement it
The mod has to be able to, and that runs locally on the server process. If the mod can connect to an arbitrary 3rd party server, it can open a connection to anything visible by the computer running the mod (LAN/local processes)
The mod can't work as a server for your central DB because it would be behind a NAT pretty much always
Thatd be like peer to peer though
The only option would be for the DB to be the normal backend, but you would only get a key-value store at best as the devs obviously won't allow you to run arbitrary code on their server, and good luck managing which mod should access what data with a single DB server
If you want p2p connections, you can use the normal server as the DB, you don't need to connect to a remote host (and you would have to, since both clients would be behind NAT)
Currently trailbridge implementation is a key-value store. Its not ment for large peices of data being shared. Its done like this for security. Im not sure on how the devs could implement a solution, was just throwing the idea out their. It would be a nice-to-have in terms of allowing for native sharing of leaderboards etc
I have seen it successful implemented in games like roblox with data stores etc
I guess one issue is that the main.lua can be viewed by anyone
What it implements is irrelevant. You need to store data somewhere, and the only options for that are:
- Use a central, 3rd party server: mods need to be able to connect to it, and since it's not known ahead of time mods need to be able to open connections to anything
- Use a central server hosted by the devs: you wouldn't be able to run any code in the DB server, and key management would be a mess since mods don't have IDs to scope keys. It likely could also only be used within the game
- Use p2p, decentralized connections: you aren't gona have a global view of the data, so not much different from each host having their own data (specially since you have no way to syncronize clients, so at best you would just be able to write on clients of the tm server)
Roblox runs everything on their servers afaik, they don't need to connect to any 3rd party servers. It's option 2 with a ton of infraestructure
Could the steam id of a mod be used as a unique identifier
No, because you can have local mods
The way I do it currently is I have an api key. But idk. Yeah 3rd party server not a good idea nor is p2p
one of my first modding projects was just making some sort of economy system in a way, then i realized it was gonna be really annoying because that ecosystem will only be able to mostly only last in the one session, on that one host
if i ever create a campaign where theres a lot of different resources or things to collect a central market could be a really cool thing to do
in what way were custom models limited in tm?
What do you mean?
the point where the models break, was it like 32000 triangles? or was it lower or even something else?
wasnt it like the 16 bit max integer?
No idea
65536
Yes, thank you
does ModBlock.SetDragAll only affect aerodynamics or also things like grip with the ground?
Friction has nothing to do with aerodynamics no.
I dont know the underlying systems fully, but I would expect it to affect movement in water and maybe snow!
hmmm because im looking to maybe have a event for my mod that the ground will be like ice. imma try it i will say if it works
once again getting this and i dont have a clue how to fix it... C:/Program Files (x86)/Steam/steamapps/common/Trailmakers/Trailmakers_Data..\mods\Choas Mod 0.1\main.lua:(101,4-60): cannot convert a userdata to a clr type System.UInt32
Has anyone tried to make a mod to add actual armor against explosives?
AKA, explosions can't hit stuff behind blocks
To make them less stupidly OP
idk. i used a code snippet https://mods.trailmakers.ludixi.com/snippet/21 and tweaked it. but the base version already doesnt work
Gets the mass of the vehicle that the player is currently in
can you show how you are calling Nofriction?
Nofriction gets called with a UICallbackData
not just a number that represent's the player's id
so youd have to do
function Nofriction(data)
local structure = tm.players.OccuipiedStructure(data.playerId)
--blah blah
end
ah oke thank you! it now works indeed
^
im not sure but it would be impressive af. not sure if its possible tho
aight
cant edit the explosion code so its impossible
i mean you can try to make it with raycasts and a alot of them
well you could maybe use raycasts to see if the explosion is within line of sight and cause an explosion at the enemy vehicle ig
i dont understand how that would solve anything?
that would still just use the games's own explosions(which we want to replace)
I guess you could spawn a bunch of tiny explosions at the end of the rays, but it doesn't seem neat at all
This would be cool for like a modded gun
curious but would it be possible for the raycast to pierce the player build but still produce an explosion on every point of contact? (even inside the target)
Not really, the raycast on gives the point where it hit something but you could calculate it's direction and spawn a few more explosions in front of where it hit
that's probably good enough
i mean you could make a kinda "timed" fuze just explode it a bit further down the raycast
Do you want to see modded bullets?
i mean i could try to make em or we
They were made once already, tho afaik without any special properties like penetration
https://discord.com/channels/296562030624899072/1338940992551649405
I made a mod that has custom bullets https://steamcommunity.com/sharedfiles/filedetails/?id=3427741362
Now, with the new api i should try remaking it
Whats different in the new api
stuff
wow thats crazy
Stuff, i know you can now get the name of a player, you can read chat messages and send chat messages, you can check the drag of blocks and set it, coloring now can color every block, there is new ui that makes big text in the middle of screen appear and other stuff i dont remember
i see
You could get the names of the players before too, but now you can get a unique id for each player
always wanted this
Yeah? I did not know
tysm
Uhh, i did not test it in 2.2, it might be broken or not, try it and see
doesnt have sound in 2.2 at least
Ye, never added any
ye oke
and i dont know what current keybind is suposed to do doesnt do anything in 2.2 it seems
o nvm
Is there any sound that sounds like a gun? Also is playing sounds every tick a good idea?
Does anyone know if there is a way to check whether or not a raycast hit a ModBlock without going through every block.
no :)
No as in you donβt know or it isnβt possible
not possible
Is is possible to check if it hit terrain instead then since that would also be less laggy
also no
Depending on the hit function you use it just gives the world position of what you just hit
You have the options:
Didhit > boolean
Gethitnormal > no idea what that does
Gethitposition > modvector3
Gethitdistance > float
Tostring > no idea what that does
The normal is basically a vector perpendicular to the surface.
To string will make it into a string, not sure how it's formatted, but it's likely a combination of the other datas
To string will always return: "Trailmakers.Mods.Api.Proxies.ModRaycastHit"
that doesnt sound very useful
it's likely the default implementation
Wait, chat censoring mod is possible now?
Can't edit existing messages
No, well kind of, you could ban the person who sent the message and send a big wall of spaces to cover the chat box and swear word
Can you cancel the message?
Nope
Making something like this might be a good idea
has anyone tried putting ascii art in chat
That sounds fun, but the chat box is a different lenght depending on resolution so if you make something for 1080p on 720p a fourth of the art might be not seeble
Wait you can read messages? I couldn't find anything for it
Look in the documentation, it should be there
I only see send
Can you send link to the modding portal?
The community hub for Trailmakers mods and guides
#1441041011970281533 message
It's here, i didn't see it in the modding portal
The community hub for Trailmakers mods and guides
Check this out. @willow breach is building an amazing map:
https://discord.com/channels/296562030624899072/1446840402274684968
I'm helping with some mod code to make the train track switching work.
What is the difference between ModBlock.GetDragAll() and ModBlock.GetDefaultDragAll()?
Current Vs default drag
Default refer to the "vanilla" values. As in unchanged. Just for reference so you can revert them or do calculations based on them or whatever
@scenic echo here's what i use to store data, there aren't many comments, but the most important functions are the encode/decode ones, they want the modBlock, start bit (1-81) and some other parameters depending on what you are storing
Thanks!
I found something interesting, if you set the health of blocks to 1 for example, from guns they will still take the same damage but from collisions they act like they have 1 health
set health is generally just cursed at the moment, hope to have a fix in 2.3 π
i was hoping for it to be fixed this patch, i guess i have to be patient
It is in the backlog of coming changes, just been a lot of things in works lately π
can tm mods have header files or does everything have to be included in the main?
You can make a header.lua file. Include that in the main and then that include everything you want lol
if you want declarations only, you can use ---@meta on the declarations file and the LSP will pick it up. If you want actual implementations you can call, you need to use tm.os.DoFile()
someone should make a mod that lets me tell chatgpt to generate me an awesome sportscar only for it to be a brick
is making a new label the only way to have multiple lines in a ui element? using \n or \r\n seems to get ignored (including the text after it)
From what i know, yes
would be nice to be able to have text blocks that are multiple lines, adding seperate labels leaves quite a bit of whitespace between them
Iirc it's not that it gets ignored, but there is a little box around the first line and all the text outside it isn't rendered
You can see this if you scale the text, top and bottom will be cropped
so if I make the text very small it would fit 
i mean you could use a random list of BP's and choose one and spawn one i guess and update the mod every once in a while
Big brain time
random inquiry, if i don't call ui everytime a new player joins, does it make the ui host-only?
yes (I think so at least)
you can check if the player id is 0 to make it host only
Player id is 0 btw for the host
yeah they're 1 lower than the in-game list shows
lua is one of the only languages where indexes start at 1 instead of 0 so you actually have to account for it lol
i set up a github for my chaos mod so i can work on the move. but i get all these errors. i did set up the library's and workspaces correctly but why do i still get these?
holy shit
are the playerid's from tm.players.GetPlayerProfileId(playerId) hex numbers or alphanumeric?
i assume it returns the steamid? which is just a number
it returns a string
yes i know that but from looking at it it looks like a hex value
602812b96f7bff6f59ceda4c
this is mine for example
i believe thats the TM player code
it is, but i wanna know if it is hex characters only instead of just some string
It is just a sequence of random chars using hex that represents a unique backend ID
Filtering in what context/way?
i'm adding a blacklist function to my mod so i want to store player id's along with their username
need to grab them from a file and filter out what is an id and what is a name
Just store it as csv/json
yeah that's what I'm gonna do lol
I still wish for steamid since that player profile id can be reset
honestly doubt most people would put in the effort
can somone help me with settinga thumbnail for a workshop upload
ive downloaded steamCMD and have everything set up but its returning with Preparing update...ERROR! Failed to update workshop item (File Not Found).
ive checked the file is the right vdf type the loacation of the image file is correct
that's a lot easier than for blueprints lol
its a map im uploading
what will this do
wdym
for blueprints you have to change the image through the steam api 
not that hard but it is annoying
wait i think im doing it that way
how do you do it for a mod
you need to export the map as a mod first, and modify the exported mod
i nees assistanewith 2 things, the keys between s+f an x+v have stoppe working, unrelate, trailmappers wont let me edit any of my maps, or ccreate new ones
the main issue is the trailmappers thing
Is it your keyboard? If so just get a new keyboard
laptop
I mean you could change your keyboard of your laptop yourself for like 20 bucks or send it to a repair shop for like 30-40 and you can always use an external keyboard on your laptop
i have $2
Do you mean the keys don't work in Trailmappers only? Or don't work in any app on Windows?
You can also work with the png the blueprint is stored in but ue I suppose the steam api is a lot simpler lol
steam api also doesn't risk corrupting the blueprint
ADD TO XBOX
ask Microsoft not us
its like trailmakers disables the keys, they work anytime im not playing TM, any other game i don't have issues
This is the modding channel. I suggest you post your keys problem in #bug-reports
i was trying to explain the spelling issues, anyways, i was here cause i was asking about the trailmappers thing
what's a modvector3
Probs better to ask here ->#1226065444364877835
it's data in the form of a vector3
interesting
i was hoping to just slap a number for wind speed and wind heading but this seems a little bit trickier than i expected
huh, i didnt know that existed, thanks
vectors are used in the wind speed to easily input both direction and magnitude (wind speed) at the same time
if you want to quickly add something you can just do
tm.vector3.forward() * windspeed
you can change forward to any of the built in directional vectors in tm.vector3 like forward/back, left/right, or even up/down if you want lol
hold up, i'm asking chatgpt on how any of this stuff works lol
im here to help too 
vectors are used a lot everywhere, they should honestly be taught in schools a lot earlier tbh
in the context of tm modding they're used for representing positions like xyz coordinates, directions like in the wind speed, scale for objects, and tons of other things
this is not something bothering anyone over
no no worries ill gladly explain anything
im pretty bored right now
also i love trying to teach stuff it helps me understand the topic more
also i have absolutely no coding experience (except like 5m of java which i do not remember at all)
ok so the code is basically the ComplexityMod code but i edited it a bunch
context: chatgpt is trying to get me to log the defaultValue parameter on the UIText's
my goal rn is to have 3 input boxes (windX, windY, and windZ) and then combine them into one vector3 before feeding that into the SetGlobalWind
the commented out ones are unnecessary at the moment according to the clanker itself
i hope that's at least somewhat legible
alright so immedietly the first thing i notice is your parameters on the mulitple set wind functions
there is this neat little thing called ui callbacks. it is data that gets sent to the function as a single parameter, so instead of having playerid, id, value, data in the function, you can replace it all with just one parameter callback
you can use this callback in the function to get all that information by using callback.value, callback.playerId, or callback.id
something like this
i did not know that, holy that's a lot simpler than i thought
chatgpt doesn't know anything about the modding api so it isn't quite helpful
on an unrelated note, does the code placement matter? like does stuff change if i put a function above something else?
compared to below
i believe it does
the function should be defined before you add it to UI
although your add ui function is defined before the others, it is actually called later in the onPlayerJoined function (i assume) which is fine
neat
how do i actually use a vector? i want to put it into the tm.os.log for now but i'll use it to set wind later
i think i see a better approach for this
you can just create a variable at the top that is the vector, instead of the x y z components of them
have a local windVector = tm.vector3.Create() at the top and remove the old variables
for each of the functions, you can set the individual x y z components by doing
windVector.x = callback.value
windVector.y = callback.value
windVector.z = callback.value
this way, you can completely remove the createWindVector function and ui
instead you can do it in the applyWindVector() through something like this
alright
it gives a invoke ui callback error everytime i type anything into the UIText, also fails to invoke the onPlayerJoined function, no clue why
maybe change it so tm.vector3.Create() is capitalized
also a good idea to check the logs found in the mod folder to get more info
might also not be a bad idea to fix the weird indenting
You can log a vector3 directly using the tostring() function:
tm.os.Log("myV3: "..tostring(myV3))```
ok
the errors in the logs are "failed to invoke ui callback" and "cannot convert a string to a clr type System.Single"
they were given some attention in the standard maths program at my high school but linear algebra definitely deserves more attention in secondary education
if anything more about (standard) vectors and a little bit of matrices, they're used in basically any higher level education related to physics or math
The callback.value from a text field is a string. You need it to be a number. Put tonumber() around the callback.value. eg
windVector.x = tonumber(callback.value)
this is what i did. (from my github repo im working on)
that actually worked, though applyWindVector gives an error "cannot access field SetGlobalWind of user data<Trailmakers.Mods.Api.ModApiPhysics>"
yeah i've already seen
It is not tm.physics but tm.world
tm.world.SetGlobalWind(ModVector3)
guh...
it actually works
tip dont set the wind speed to a million and look at the map
i am aware :
how do i like "refresh" the UI elements? i want the numbers in the in-game mod menu to show windVector.x/y/z numbers when the wind vector is applied but calling addUiForPlayer inside the applyWindVector doesn't seem to do anything
you can either remove specific ui labels or clear the entire ui and add everything you need back

Call
function tm.playerUI.SetUIValue( playerId , id , value )
When you need to update it.
You can do it every
function update()
-- get wind speed
-- make it into string or whatever
-- call tm.player.UI.SetUIValue() for your player and the specific UI id
end
ah, that seems less clunky so i'll (try to) do that
oh yeah I forgor about those
That's how i did it at the beginning and it was a nightmare, sometimes it just didn't work
iirc clearing/recreating the entire ui was a expensive operation as it freed the entire context and had to initialize it again, you shouldn't be doing it on each update
i didn't take a picture but it worked perfectly trust
if only you could use newline characters in strings without it not rendering the other lines π
are there any restrictions for adding images to tm.playerUI.AddSubtleMessageForPlayer()?
currently using a 256x256 .png, both adding it to data_static or the main folder doesn't seem to work
I beg can someone help me on this https://discord.com/channels/296562030624899072/1451096990862807112
are you loading the texture?
whuh
how do i do that? can't find anything about it in the docs
is it tm.physics.AddTexture(filename, resourceName)?
yes, the docs should tell you
hmmm
i think i did something wrong
hey gpt can you help me with this thing youve never been trained on
ngl i should've just sent the documentation with the prompt, would've helped a lot
fixed it btw
while ago but i went to do other things
I need help so badly on this please someone
if somone could help me id really appreciate it my trailmappers crashes every single time i try go into a map i have tried everything i know like verifying game files reinstalling clearing old saves so i dont think there could be anything corrupt but when i try go into a map after a few seconds on the loading screen it freezes forever
please any possible solutions
curious question, is there a way to make math.random lean towards one end of the range more than the other?
easiest way is probably using something like a sqrt
what's a sqrt
square root
oh no, math 
this makes it lean more towards 1
you can play around with functions in geogebra or desmos until you get something with the distribution you like
what's your range and what way do you want it to lean?
i currently have -25 to 25 but i want something like -100 to 100 with a lean at 0
maybe lua had a normally distributed function lemme check
https://stackoverflow.com/questions/59811630/normal-distribution-curve-and-random-number-in-lua
normal distribution approximation
you can take the same formula but with -100 and 100 instead
i'm not exactly sure how to use that but i think i can figure it out
function norm()
local x
repeat
x = math.ceil(math.log(1/math.random())^.5*math.cos(math.pi*math.random())*30)
until x >= -100 and x <= 100
return x
end
this will probably work
you can change the *30 to change the standard deviation if my interpretation is correct, lower values means values are closer to 0 on average and higher further away
@elfin yarrow does it need to be an integer?
i got it, thanks
if it doesn't need to be an in you can leave out the math.ceil()
no problem
Did you change your device?
nope i was literally on trailmappers yesterday
wth is this π
i'm trying to include a header file again since i really want the structure that gives me but i keep getting errors
i have a file called header.lua in the same folder as main.lua, and neither require("header.lua"), DoFile("header.lua") nor tm.os.DoFile("header.lua") seem to work
same if i just use "header" instead of "header.lua"
submodules are searched in the static_data folder, and you don't have to specify the extension to tm.os.DoFile
i get the same error when it's in data_static
post the code and error
if i do
require("data_static/header.lua")
or
require("header.lua")
i get this error code
C:/Program Files (x86)/Steam/steamapps/common/Trailmakers/Trailmakers_Data\..\mods\terminalMod2\main.lua:(1,7-33): attempt to call a nil value
Yeah dont put the file ending in the DoFile
I've added a video showing the rail switching and signal system that is being implemented into samjr01's map:
#1446840402274684968 message
I can't get my obj to export with textures
Wait how can I ad my texture to my obj in trailmappers
here
you load the texture and then spawn your object with your mesh and texture
You can select your texture after you've placed the object too.
Also you can drag a texture from the custom objects bar onto an object in the 3d window.
Ohhb that's why their also on the bar
@latent pine in your command mod you should add a rules and a setrules command. I think this would be great for easily explaning stuff to new people who have joined. Also a command that allows you to set commands that run when someone joins would be also useful
I'll be back home Monday evening so I can probably work on it then. you'll probably have to wait a bit since I'm planning on restructuring the mod and possibly changing the ui π
yeah, no problem. Those ideas just appeared in my head and i thought it would be cool to have them in your command mod
they're good ideas :p
does anybody know why my missile turns my plane (custom Missile mod)
you should mess around with the targeting settings a bit iirc