Delete train wagon with command

Hello there 👋 Anyone knows how I could remove a Create train contraption using a command block ? Or perhaps a KubeJs script ? (or any other method really) I'm working on a wagon delivery system for my minecraft server and I'm stuck with a wagon Here are the current steps and my progress :
1. Wagon spawns in :check: 2. Player takes wagon (using an automated SnR coupler) :check: 3. Player gets a train station target where he needs to bring the wagon :check: 4. Delivers the wagon to the specified location (again, using an automated SnR coupler)* . :check: 5. Wagon gets deleted once delivered :cross: 6. Player gets reward for completing delivery :cross:
30 Replies
Steam 'n' Rails Bot
Steam 'n' Rails Bot•5mo ago
Hello @Mowzy! Someone will help you shortly, please do not ping moderators or other people and just wait for someone to come help.
Joseph Franci
Joseph Franci•5mo ago
I think theres like /c trains remove uuid
Szedann
Szedann•5mo ago
also pretty interesting idea
Joseph Franci
Joseph Franci•5mo ago
yeah
'Mowzy
'Mowzy•5mo ago
thing is, how would I get that uuid 🤔
Joseph Franci
Joseph Franci•5mo ago
maybe /data get entity uuid Or similar
'Mowzy
'Mowzy•5mo ago
the /railways train_uuid command doesn't work on split off contraptions and /data get entity @e[type=create:carriage_contraption,limit=1,distance=..5] UUID returns this : (wich is not useable)
No description
Szedann
Szedann•5mo ago
uh it probably has some different property that stores the train id bit that'd probably also be stored like that cause this is the standard way of storing uuids in mc
'Mowzy
'Mowzy•5mo ago
Right, so... I finally got the uuid of the train using a KubeJs script, now the problem is that the command /create killTrain 17b4659c-c9ae-4659-8e2c-35d998c6c205 won't work.... Using /kill 17b4659c-c9ae-4659-8e2c-35d998c6c205 will make the train contraption disappear for 1 tick (so I know the uuid is good) but the contraption will just re-appear on its own
Szedann
Szedann•5mo ago
yeah cause that's killing the entity the entity id is different than the train id
'Mowzy
'Mowzy•5mo ago
:pepethink: :pepehmm: how the flippity floppity hello kitty am I supposed to get that special Id... SnR has a command /railways train_uuid <name> but I can't use it on a split off contraption since it's name is Split off from:<train name>
Szedann
Szedann•5mo ago
it's the TrainId property
'Mowzy
'Mowzy•5mo ago
Bruh.... Extracted the TrainId, used it to try and remove the train check out the error output..... [14:21:00] [Server thread/INFO]: Invalid UUID
Szedann
Szedann•5mo ago
hm
'Mowzy
'Mowzy•5mo ago
No description
'Mowzy
'Mowzy•5mo ago
Train Id looks like this, perhaps if I make it into a string :pepethink:
Szedann
Szedann•5mo ago
uh you need to convert it somehow...
'Mowzy
'Mowzy•5mo ago
that might be tricky...
Szedann
Szedann•5mo ago
you're using kubejs right?
'Mowzy
'Mowzy•5mo ago
Yup
Szedann
Szedann•5mo ago
there's probably something for uuids
'Mowzy
'Mowzy•5mo ago
Alright some guy helped me out on the KubeJS discord 😄 Still, thank you for the help @Szedann and @Joseph Franci The KubeJs code looks more like a minecraft enchantment than actual code, but hey... it works 😄
Joseph Franci
Joseph Franci•5mo ago
np, what ur making sounds really cool
'Mowzy
'Mowzy•5mo ago
@Joseph Franci and @Szedann I made a little video to better show off the feature 🙂 https://youtu.be/NQ93Akh_Usc
Mowzy
YouTube
Train Delivery system using Create and Steam'n'Rails + KubeJs
Big thanks to Ucandango from the latvian.dev discord server for helping me out in coding the KubeJs script needed for deleting the train ! This system was made for my French minecraft server, in order to give some new and interesting ways to get money to my players.
Joseph Franci
Joseph Franci•5mo ago
Pretty damn cool
Daveytje21
Daveytje21•5mo ago
Epic, just commented on the vid. Id love to get this into my realistic steam yard map one day Just imagine having to take a train from the shed on the turntable, drive through the yard onto a set of wagons whilst also looking at signals Oef
sherk
sherk•5mo ago
You can do /create trains Then press remove on the train in the menu that comes up
'Mowzy
'Mowzy•5mo ago
Yeah, but for an automated train removal, /create trains is not gonna cut it I had to create a custom KubeJs script to make it work I might make the code available. I'm also planning to make the system work with multiple wagons (with each their own destination) I already found a way to make a system to identify a train (since you can't use train ID or UUID cause they change every time you assemble / disassemble trains), this will allow me to make sure the wagon you delivered is the right one :coolcolor:
GWP
GWP•5mo ago
Amazing idea! It makes for a reasonable usage of the coupler block. I’ll try to incorporate this idea for my standards as well
Want results from more Discord servers?
Add your server