Animated Junctions

I played with these junctions when TRS2006 first came out but stopped because there simply didn't seem to be enough script hooks to be able to do everything I wanted to do.

There was a fairly fundamental script issue in that old style junctions can never be unnamed so that junction scripts didn't really need to check that a junction was named. In consequence any script which failed to check would crash if there were any new style junction objects on the current map. Scripts falling foul of this included some of Auran's own code, especially that in navigate.gs. This might have been fixed with SP1.

This was all a long time ago but as I recall I was able to get the following to work:

Junctions on a grade - you need to build the junction along the Y axis to get this to work.

Operation in Surveyor - script the blade animation so that it can be operated via object properties and include a World.ModuleInit() call to have the junction switch to match its own animation when you enter Driver.

Levers - you don't actually need them, just clicking on any visible part of the junction will make it work, whether or not there is a lever mesh present.

Multiple junction objects (3 ways and slips) You can build these and the AI will be able to handle them. The issue is that ONLY the first junction on a multi-junction asset can be operated by clicking on the object. To get around this there are two potential methods:

1. Scripting to enable the object to cycle through its various settings. This may or may not be possible given the limited hooks available.

2. Building the object from a 'kit of parts' In the case of a three way switch you need two separate objects clipped together. For a slip you need five. I did get these to work but its messy.

There were one or two very detailed threads in the TPS forum during development (lost in the forum crash of course) and, whilst Auran were perfectly willing to provide information and discuss possibilities, they were either unable or unwilling to come up with the additional facilities needed.
 
Last edited:
Thanks, Andi!

From what I can see, it looks like the game treats the levers and the points in exactly the same way - as objects that get their animation played when the main mesh is clicked upon. In fact, for simplicity, they could even be parts of the same mesh.

I haven't played with World.ModuleInit() before - that sounds interesting. I've generally saved / loaded states to the soup instead.

For the 3-way switch, I was going down your path 1: trying to intercept a click on the switch, set an internal variable to one of three paths; set the animation to the correct state, and use SetDirection(SwitchDir) to set the junction to one of the 3 defined states (0, 1, or 2). I don't really know what I'm doing though, so I'm just fumbling around in-between other projects :)

Alas that the detailed threads were lost...
 
The key is the junction-vertices table which links the junction node (such as a.track0b) with your animation. Whenever the direction of the junction at that node changes, TRS manipulates the specified animations to match.

This can only work with true/false animations which means that you can't use it for three way points.

To get a three way to work you need to omit the junction-vertex table and track the state of the junction and its animations in script. Its easy enough to do this when the junction direction is set by the AI, but to be able to react properly to a user clicking on the junction you need to be able to detect whether the toggle results from the AI or a user mouse click. There isn't any way to do this as far as I can see.

Incidentally these junctions can't be changed via the minimap.
 
I hadn't thought of that, but yes - if the animations were moved to be under script control, it would be best to remove the meshes from the junction table.
time to play some more....
 
Well, no luck so far. I can script the junction to hide / display various levers, but I can't make it respond to any junction commands. I tried a simple 'hello world' type script, but to no avail. I don't even see the message in the jetlog. Am I doing something blindingly obviously wrong?

Code:
include "junctionbase.gs"
class StubSwitch isclass JunctionBase
{
   public void Init(Asset asset)
   {
      SetDirection(1);
      Interface.Print("Stub switch: setting direction");
   }
};

Thanks,
Curtis
 
OK, with Bob Pearson and Andi06's help, here's a new version. This one now defaults to the straight track, and the initial direction can now be set in the surveyor properties.
Feel free to use any / all of the script in your own creations....

http://www.carsoncarshops.com/files/turnout.cdp

normal_stub_switch.jpg
 
is there any ng30 animated fixed turnouts
given up with gmax keeps saying no bones to export and it really fustrating:'(:'(
would someone be able to make some
tharnks
 
The only NG animated points available to my knowledge are my 2ft ones and Fred24's metre gauge ones. Perhaps when Andi06 perfects his new system we may see some more NG ones. Unfortunately being a rather incompetent GMax user I have to rely on modifying existing meshes to get my results.
 
hi,

I use the Andi06 system for all my animated juctions and stations, all i can say realy great stuff. When you got use to using his juctions it realy get alot faster to build then when you dont use the animated junctions. Laying track goes realy fast using his stuff.

Greetz
 
Hi,
a simple question. Is it possible within trs 2006 to modify animated junctions in that way that they can get names and respond as normal junctions ( also in the list ) so that they can be used with signals to determine what to do regarding the direction?
 
I'm trying to find Andi06's animated junctions for TS2009. They don't seem to be builtin, the Wiki link mentioned in one of Andi's posts in TrainzDev General forum doesn't work. CMP shows a lot of JK assets, but apart from Help files (which I downloaded but couldn't view) they're all a few years old so can't be TS2009. I'm obviously missing something basic - please help!
 
I'm trying to find Andi06's animated junctions for TS2009. They don't seem to be builtin, the Wiki link mentioned in one of Andi's posts in TrainzDev General forum doesn't work. CMP shows a lot of JK assets, but apart from Help files (which I downloaded but couldn't view) they're all a few years old so can't be TS2009. I'm obviously missing something basic - please help!

Google is your friend. ;)

http://www.ajsmith.nildram.co.uk/trs/junction01.shtml
 
Thanks Jamie and Andi. I finally got the link to work - not sure how; I tried *displaying* cookies (they were already enabled) and somehow then it managed to remember that I was already logged in. Anyway, I'm looking forward to trying them. For me they're essential for the simulation: junctions and signals get the juices flowing more than locos! It takes all sorts... Thanks Andi for providing all this. (I note your caveat.)

BTW, is there more discussion on these junctions going on anywhere? The thread in TrainzDev General seems to end abruptly 2 months ago.
 
The link is: http://www.trainzdev.com/components/com_mambowiki/index.php/User:Andi06 You may need to log onto the WIKI first.

By way of a warning however, these are experimental objects and the current TS2009 patch appears to have broken the scripts.

EDIT - see below: I hope you are planning to fix these. I imported my Crewe route into TS2009 which uses your junctions but can confirm they are not working. Have SP1 and latest patch.

Segy

Please ignore: I found that one or two components had not imported correctly. The junctions switch OK in TS2009 - haven't yet tried other functions yet due to other issues with TS2009 e.g. no ground textures
 
Last edited:
Andi, I imported your library, and all the junctions, crossings etc showed up in the Objects list, but when I add a junction to the baseboard it comes up with a script error
"JK Stub: Thread exception:ER_NullReference, line 23, file jkstub.gs(1)"
"JK Stub: Junction Kit 2 Code Library"..."is either not installed or has become corrupt".

Is this the script problem you referred to, or have I misunderstood what to do?

The junctions did appear on the baseboard, though without the coloured diamonds (even when zooming in).

For the record the Code Library and AJS Utility Code both seem to be installed. Repeating the whole installation gave the same result.

Thanks, Peter
 
Default Switch Lever

Is it Possible, when creating a switch, to change the default switch lever to one of my choosing from the DLS? Im using TS2009.
 
Last edited:
To save some of your time, jkinzel - just delete the ugly default lever in Trackside Objects mode and replace it with one that you like. Just don't place it too far away or both arrows turn red and it won't work.

Cheerio,
Nicholas.
 
If it hasn't been mentioned yet there are some animated switchs made by Raildumper called UCI54 turnouts. You can get them at www.vias3d.net.
What I like about these switchs over Andi's is you can roll/tilt these end wise to fit the slope of a hill where as andi's only roll side to side which dosen't do any good for grades. I wish Andi's would tilt the correct direction. But he would have to turn them 90 degrees in Gmax for that to happen.
 
Back
Top