Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Jan 16, 2018 5:27 pm

All times are UTC




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jul 05, 2017 7:41 pm 
Offline
Engineer
Engineer

Joined: Wed Jul 05, 2017 7:35 pm
Posts: 3
Hello!

I want to develop newGRF's for OTTD. I searched for tutorials, found a few of them, but nothing that can really help. I want to make an industry, (similar to bank), producing something, what I can transport outside the city. So I begin my GRF like this:
[+] Spoiler
grf {
grfid: "HT\01\01";
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESCRIPTION);
version: 0;
min_compatible_version: 0;
}

cargotable {
TOYS
}

item (FEAT_INDUSTRIES, garbage_collector) {
property {
substitute: INDUSTRYTYPE_TOWN;
layouts: IND_LIFE_TYPE_PROCESSING;
closure_msg: TTD_STR_NEWS_INDUSTRY_CLOSURE_GENERAL;
prod_increase_msg:TTD_STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL;
prod_decrease_msg:TTD_STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL;
fund_cost_multiplier: 2;
prod_cargo_types: cargotype(TOYS);
prod_multiplier: 2;
min_cargo_distr: 1;
prob_random: 255;
prob_map_gen: 255;
prob_in_game: 255;
spec_flags: bitmask(IND_FLAG_ONLY_IN_TOWNS);
map_colour: 0;
name: string(STR_GRF_NAME);
nearby_station_name: string(STR_GRF_NAME);
}
}


At compile I get this error: "[Knmlc ERROR: "mygrf.nml", line 21: Cargo list must be an array with no more than 2 values"

Okay, I think I looking for what NML means an array. And I found nothing. But thats not all. There is not a single tutorial for this. How can I do this?


Top
   
PostPosted: Wed Jul 05, 2017 8:41 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Thu Oct 07, 2004 12:51 pm
Posts: 290
Replace...
Code:
prod_cargo_types: cargotype(TOYS);
with...
Code:
prod_cargo_types: [cargotype(TOYS)];

And later, if you want more cargotypes...
Code:
prod_cargo_types: [cargotype(TOYS), cargotype(BOYS)];


Top
   
PostPosted: Thu Jul 06, 2017 5:27 am 
Offline
Engineer
Engineer

Joined: Wed Jul 05, 2017 7:35 pm
Posts: 3
Cadde wrote:
Replace...
Code:
prod_cargo_types: cargotype(TOYS);
with...
Code:
prod_cargo_types: [cargotype(TOYS)];

And later, if you want more cargotypes...
Code:
prod_cargo_types: [cargotype(TOYS), cargotype(BOYS)];



okay, so it must been prod_cargo_types: [TOYS, ...].

Thanks!

I have a second question realated to this. Ia I said I want to create a custom industry. Is there any tutorial for that?


Top
   
PostPosted: Thu Jul 06, 2017 10:16 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Thu Oct 07, 2004 12:51 pm
Posts: 290
Not that i know of no, but i assume you know what you want your industry to do. Right?
And you already have the necessary properties and sprites set up for that industry?

Then you go over the nml documentation and find stuff that's relevant to your interests. If you can't find an answer on the Wiki or here on the forums then do ask.

I am pretty sure a lot of people have gone through the basics of NML without a tutorial and once they know NML well enough to write a tutorial, they don't feel like writing a tutorial. :P


Top
   
PostPosted: Thu Jul 06, 2017 9:08 pm 
Offline
Engineer
Engineer

Joined: Wed May 24, 2017 12:51 pm
Posts: 14
Location: East Texas
Code:
layouts: IND_LIFE_TYPE_PROCESSING;

That's incorrect, layouts is used to layout the tiles for graphical display while IND_LIFE_TYPE_xxx is for defining the life_type of the industry.

At some point in my learning I turned from tutorials to looking at how other people have dealt with the topic of concern. For industries, I learned a lot from Yeti and OpenGFX+ Industries. This Yeti page is as close to a tutorial as I have seen:
http://dev.openttdcoop.org/projects/yeti/wiki/Code

To some extent, I view most of the OpenGFX+ code as tutorial: they are examples of how to do it right with minor variations from vanilla.
http://dev.openttdcoop.org/projects/ogfx-industries

A lot of projects use build systems that can make it harder for to a beginner to understand so here's a simplified but functional oil well that I wrote when I was first getting started with industries.


Attachments:
File comment: trivial oil well
eg.nml [925 Bytes]
Downloaded 20 times

_________________
Unless otherwise stated, all my code is GPL v2.
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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-2018 phpBB Limited

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