I'm happy to announce the first release of the Source on Rails mod, along with a small demo level that shows the basic concepts. Information, a demo movie and the mod itself can be gotten from http://divinity.watlock.be/sourceonrails/

There's almost no programming involved to use the mod's functionality. In fact, the only scripting code in the demo level is the following:
Code
IF
GlobalEventSet("RAILS_TracksConnected")
THEN
CharacterItemSetEvent(CHARACTER_SelfDrivingCart,ITEM_RAILS_MINE_Track_4m_Straight_A_008,"RAILS_SetNextTrack");

IF
CharacterItemEvent(_,_,"SourceOnRailsDemo_Pause")
THEN
CharacterSetEvent(CHARACTER_SelfDrivingCart,"RAILS_Pause");

IF
CharacterItemEvent(_,_,"SourceOnRailsDemo_Resume")
THEN
CharacterSetEvent(CHARACTER_SelfDrivingCart,"RAILS_Resume");

As an aside: the reason the signs indicating the settings of the track switches sometimes make a 270 degree turn rather than turning 90 degrees the other way, is that ItemRotateY() doesn't accept negative angles smile

The scripts and story code are extensively documented, so they may also be useful to people learning about the scripting system.

Finally, since trains by themselves are nice, but not particularly useful (except possibly for creating a train heist scenario/quest), I've already started on implementing the next step towards having full Transport Tycoon-style production chains in D:OS. Or, in other words: since crafting everyday items is often not the most interesting to do in CRPGs (has a nice reference to Larian/D:OS2 btw), why not have the characters in the game do it for you?

What already works in my Resources mod (which combines well with Source on Rails, but is independent from it):
  • • A planter/harvester that can plant and harvest stuff, and while the plants are growing also tends them. After harvesting, he can drop off the produce in a container or (if the container has been destroyed) on a platform
  • • Plants that grow smoothly! (well, some of them)
  • • A platform worker that loads the items the farmer drops off on a train (any character) that halts when it reaches the platform, and when finished tells the train it can leave (which it does)

The next steps are workers to unload trains (characters), and artisans to produce stuff based on availability (wheat -> flour, flour + water -> bread, wheat + water -> beer, ...).

It's sometimes a bit tricky due to having to spread things over char/itemScripts and the story due to missing functionality in one or the other, but I managed to resolve all problems I've encountered until now. I'll record and upload a movie tomorrow of the WIP. I'm very happy with my strolling wheat farmer smile