BuildNewGRFRailStation

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
Hephi
Engineer
Engineer
Posts: 72
Joined: 25 Oct 2009 09:56
Location: Belgium

BuildNewGRFRailStation

Post by Hephi »

Hi, I'm writing a new AI that uses train stations in towns to carry mail around.
I wanted to use some new grf stations to add some flavour to it all but I can't get
my head wrapped around how they work.

Currently I'm using Industrial Station Renewal GRF and I wanted to check what things it could do.
By trial and error I iterated a counter to check on what it would build but I'ld rather find another
way of going over the possible buildings. Also it doesn't show all the buildings, only the stations.
How do I get the non station buildings?

Currently I'm using

Code: Select all

			AIRail.BuildNewGRFRailStation(station.Begin(),stat_direction,MailAI.station_width,MailAI.station_length,AIStation.STATION_NEW, counter, 2, 9,50,false);
Where the counter and the boolean at the end seems to be the only one that matters to change what building it builds. The values 2,9,50 seem to be off no importance.

I've searched high and low on IndustryTypes, examples or more information but to no avail.
I could use any pointers you guys have. I can make my station a covered valuables station (use counter=11,22 or 23) but I'ld like to add fluff buildings next to it and have some variation in how they look.

Thanks!

On a side not: I haven't looked in to this but is there a good way of detecting which grf's are enabled in the game so I can check those inside my AI code?
--------------------------------------------------
MailAI, a casual postal service for openTTD.
--------------------------------------------------
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: BuildNewGRFRailStation

Post by Yexo »

Hephi wrote:Where the counter and the boolean at the end seems to be the only one that matters to change what building it builds. The values 2,9,50 seem to be off no importance.

I've searched high and low on IndustryTypes, examples or more information but to no avail.
I could use any pointers you guys have. I can make my station a covered valuables station (use counter=11,22 or 23) but I'ld like to add fluff buildings next to it and have some variation in how they look.
The only things OpenTTD does with all those values is pass them along to a newgrf callback. The NewGRF decides which station will be build. It's not possible to build non-rail tiles this way, being able to do that is an open feature request but the current newgrf specs offer no support for it.

For the exact details on which values will result in which station type you'll have to ask the newgrf author (ask about callback 18).
On a side not: I haven't looked in to this but is there a good way of detecting which grf's are enabled in the game so I can check those inside my AI code?
Not possible, and won't be implemented.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Bing [Bot] and 10 guests