Locomotive Startup Sequence

xero

Member
I'm creating an engine for Trainz 2012. I have really gotten into the process of it all! I wanted know, how exactly do I build a start up sequence into my locomotive.

Note: I'm going to say what it is just yet...
 
Hello,
in my locomotive I implemented a startup sequence. I try to resume you here the main things that I used:

1) First of all you have to implement your own sound system in the locomotive script. It means that your "enginesound" asset (that you need to have, or your loco will not work in Trainz!) needs to be empty, and you put your wav sounds directly in your loco asset. Then you will start the sounds using a thread when you turn on the loco.

2) In order to have the loco not to move, you can use the SetMaximumTractiveEffort(0.0) method of Vehicle, when your loco is off (i.e. in Init() at startup), and then you will put it back to the correct value when you turn it on. You can also set initial brake parameters to set the braking system is discharged, in the enginespec config file, and using the SetCompressorEfficiency() and SetBrakePipeEfficiency() to 0.0 when the train is off. When you turn on engine, you will reset efficiencies to 1, and the brake system will charge.

3) You can turn your loco on via a custom Detail window, or from the cabin operated in Cab mode.. In the second case, you can exchange messages between loco and cabin to issue startup/stop commands i.e. when the user is pressing some buttons. If you want a full detailed startup sequence, you need to script it all in your cabin....i.e. check position of levers, pantos, etc...

This is the way I am implementing it in my loco, I used as a reference, the M62 locomotive model that you can find on trainzup.com... it is all written in russian, you will have to use google translate, if you don't speak russian :)
 
Last edited:
1) First of all you have to implement your own sound system in the locomotive script. It means that your "enginesound" asset (that you need to have, or your loco will not work in Trainz!) needs to be empty, and you put your wav sounds directly in your loco asset.

you could do this, but it is kind of messy. just my opinion. engine sounds should stay in the engine sound assets so they can be easily changed.
 
If you keep sounds in the engine sound asset, with the default Trainz sound naming, you cannot turn it "off" when you want the train to be off, because Trainz will automatically manage the sound.

In theory you can omit the "enginesound" kuid row from the config file, and link the sounds asset via script, then call the sounds in your thread that manages engine sound...but it happened to me in some Trainz builds that if I didn't specify the "enginesound" kuid for a locomotive asset, it turned not usable in Trainz... (red name in the list, not either showing in the Railyard).

Maybe you can put in the engine sound your wav files with other names than the default sounds, and again you can call via the script...but I didn't try that and I am not sure it will work. It worths a try...
 
If you keep sounds in the engine sound asset, with the default Trainz sound naming, you cannot turn it "off" when you want the train to be off, because Trainz will automatically manage the sound.

In theory you can omit the "enginesound" kuid row from the config file, and link the sounds asset via script, then call the sounds in your thread that manages engine sound...but it happened to me in some Trainz builds that if I didn't specify the "enginesound" kuid for a locomotive asset, it turned not usable in Trainz... (red name in the list, not either showing in the Railyard).

Maybe you can put in the engine sound your wav files with other names than the default sounds, and again you can call via the script...but I didn't try that and I am not sure it will work. It worths a try...

it does work. that is how I do it.
 
Locomotive start up and shutdown is a feature I haven't seen in Trainz before. I thought I was going to be the first to implement, but I as I am seeing, I'm not. I'm going to make it happen, regardless of the time frame.
 
there are locomotives built-in to the games you have registered with a startup and shutdown feature. many have accomplished this goal in different ways.
 
you could do this, but it is kind of messy. just my opinion. engine sounds should stay in the engine sound assets so they can be easily changed.
Not only messy but Chris B., lead programmer, says it is not the propper use of scripting. They want engine sounds run by game engine. A few payware diesels have had a startup and shut down sequence since TRS06 also had fuel comsumption. Some people have used a script I wrote some years back also for trs06 that will make any diesel consume fuel as it runs. So while not used a lot it's been around for some years.

As mentioned some Russian content has detailed startup and shutdown scripts included.

Bob Pearson
 
Not only messy but Chris B., lead programmer, says it is not the propper use of scripting. They want engine sounds run by game engine. A few payware diesels have had a startup and shut down sequence since TRS06 also had fuel comsumption. Some people have used a script I wrote some years back also for trs06 that will make any diesel consume fuel as it runs. So while not used a lot it's been around for some years.

As mentioned some Russian content has detailed startup and shutdown scripts included.

Bob Pearson

BTW, can i get some locomotive with startup and shutdown locomotive basicly on DLS or other? I will implementing to my project locomotive. Thanks before! :)

Alifiardi Maulana.
 
Back
Top