Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Dec 13, 2017 5:18 am

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Fixed consists in NML
PostPosted: Thu Mar 05, 2015 2:07 pm 
Offline
Tycoon
Tycoon

Joined: Sun Dec 09, 2007 9:28 pm
Posts: 1919
Hi

I'm looking at implementing a couple of trains in NML, but I can't find any information on how to make fixed length consists

In an ideal world I'd have a few options

Type 1: Fixed consist (eg 3-car, nothing else)
Type 2: Fixed consist, but with a couple of options (eg 3 or 4 car, nothing else)
Type 3: Fixed consist, with multiple configurations and multiples allowed (eg 3 or 4 car, but with an ability to stack these, eg 3+3, 4+4, 3+4 etc)

As an advanced option, would it be possible to also only allow certain liveries with certain combinations

eg if I take a 3-car type 2, it has liveries One and Two, but if I take a 4-car it has liveries Two, Three and Four?

I don't necessarily need someone to write the code up for this, just an idea of where I can get some information on these kinds of techniques would be great.

Thanks

_________________
Jon


Top
   
PostPosted: Thu Mar 05, 2015 2:26 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9025
Location: Sol d
You are looking for articulated vehicles and you want to make use mostly of the articulated_part callback. As for refit (type 2 and type3) you need to make use of the cargo_subtype_text callback - and maybe fudge a bit by hiding unused vehicles when you want to refit between different number of displayed vehicles.
Type3 could also be done by simply allowing to attach wagon(s) and displaying the vehicle however it should look for the actual length (might be the most user-friendly version for that).

I'm sure you find many code examples in existing train sets like the DutchTS, IronHorse, 2ccTS, NUTS,...

EDIT: please don't double-post the question in separate forum sections

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Thu Mar 05, 2015 2:39 pm 
Offline
Tycoon
Tycoon

Joined: Sun Dec 09, 2007 9:28 pm
Posts: 1919
Whoops, I thought I deleted the other post when I made this one! I realized the other was in the wrong section and went to delete it, but I must have missed a step

Thanks for the pointer, I'll take a look and see how I get on. More questions to follow, most likely

_________________
Jon


Top
   
PostPosted: Thu Mar 05, 2015 10:26 pm 
Offline
Tycoon
Tycoon

Joined: Sun Dec 16, 2007 10:24 pm
Posts: 1631
Location: Idaho, USA
The most relevant portions of the NML tutorial for you I believe will be the Three-part Articulated example and subsequent Four-part Refit. These should cover pretty much all of what you indicated you want to do.

_________________
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.