Large houses in NML

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
Zley_Muffle
Engineer
Engineer
Posts: 43
Joined: 10 Sep 2018 17:49

Large houses in NML

Post by Zley_Muffle »

Hello guys, I need some help with NML code for large houses that occupy more than one tile, them - has someone experience with that?

Ofc I have studied documentation (https://newgrf-specs.tt-wiki.net/wiki/N ... #House_IDs), but I am no programmer so it is trial and error for me and I am seriously stuck.

Thanks for any advice!
Image
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: Large houses in NML

Post by Andrew350 »

Well a good starting point would be showing us what you've tried and what exactly you're stuck on. Without that we're just guessing.

Try looking at this file, it shows a good example of an NML multi-tile house: https://dev.openttdcoop.org/projects/po ... type1.pnml

Basically you need to set the right parameter in the item definition (HOUSE_SIZE_XXX) and then use callbacks to define the graphics for the different pieces. But we need to know what you're trying in order to figure out where you're going wrong :)
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Large houses in NML

Post by Erato »

Hey! I've had this problem before. It's not really obvious, but for substitute you need to refer to a house of the same size: https://newgrf-specs.tt-wiki.net/wiki/N ... properties

Source code:

Code: Select all

item(FEAT_HOUSES, SMALLSTADIUM, ITEM_SMALLSTADIUM, HOUSE_SIZE_2X2) {//HOUSE_SIZE_2X2 tells the game that this is 2x2. 1x2 and 2x1 should also work just fine.
	property {
		substitute: 20;//This has to refer to a house with the same size, so also 2x2. See documentation.
		name: string(STR_SMALLSTADIUM);
		availability_mask: [bitmask(TOWNZONE_EDGE, TOWNZONE_OUTSKIRT), ALL_CLIMATES];
		accepted_cargos: [[PASS, 8], [MAIL, 8], [WOOD, 2]];
		population: 15;
		probability: 15;
		building_flags: bitmask(HOUSE_FLAG_STADIUM); //Flag means: build only one
		years_available: [0,50000];
	}
	graphics { //use graphics_DIRECTION instead of default
		graphics_north: SPRITELAYOUT_SMALLSTADIUM1;
		graphics_east: SPRITELAYOUT_SMALLSTADIUM2;
		graphics_west: SPRITELAYOUT_SMALLSTADIUM3;
		graphics_south: SPRITELAYOUT_SMALLSTADIUM4;
		construction_check: sw_test_small; //Only build in small towns
	}
}
Hope this helps.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Zley_Muffle
Engineer
Engineer
Posts: 43
Joined: 10 Sep 2018 17:49

Re: Large houses in NML

Post by Zley_Muffle »

I got stuck in the phase when you have to define NSWE graphics - I thought that you must define ALL 4 tiles separately as 4 different IDs, but if I see it correctly, you just defined one and the game made the othe three, right?
Image
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Large houses in NML

Post by Erato »

Zley_Muffle wrote: 12 Jan 2020 12:04 I got stuck in the phase when you have to define NSWE graphics - I thought that you must define ALL 4 tiles separately as 4 different IDs, but if I see it correctly, you just defined one and the game made the othe three, right?
I just have 4 different layouts for the four different tiles. That's it.
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
Zley_Muffle
Engineer
Engineer
Posts: 43
Joined: 10 Sep 2018 17:49

Re: Large houses in NML

Post by Zley_Muffle »

I just have 4 different layouts for the four different tiles. That's it.
Would you kindly share part of your NML code? I believe I can figure it out from there on my own. Many thanks!
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

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