Zephyris' NML Questions

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

Moderator: Graphics Moderators

Post Reply
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Zephyris' NML Questions

Post by Zephyris »

Welcome to yet another NML question thread! Lets kick it off with: Question 1: Why won't my aircraft carry passengers?

I have a grf with a standard cargo translation table:

Code: Select all

//Define the cargo translation table
cargotable {
	PASS, //Passengers (pressurised)		Passengers & Covered (fallback to Covered instead of Pressurised)
	PRGD, //Pressurised goods			Piece goods & Covered
	GOOD, //General goods				Piece goods
	FOOD, //Food					Refrigerated & Covered
	ENSP, //Engineering supplies/machinery		Piece goods
	ORGN, //Organics				Bulk
	FERT, //Fertiliser				Liquid
	PLAS, //Plastic					Piece goods
	CPNT, //Components				Piece goods
	N2__, //Nitrogen				Liquid (fallback to Liquid instead of Gas)
	O2__, //Oxygen					Liquid (fallback to Liquid instead of Gas)
	H2__, //Hydrogen				Liquid (fallback to Liquid instead of Gas)
	CHEM, //Chemicals				Liquid & Hazardous
	ORES, //Mixed ores				Bulk
	WATR, //Water					Liquid
	RGTH, //Regolith				Bulk
}
And it disables the standard vehicles:

Code: Select all

//Disable all default vehicles
disable_item(FEAT_AIRCRAFT, 0, 41);
Then it defines a few aircraft:

Code: Select all

//Aircraft 1
spriteset (spriteset_DIRI_1, "../graphics/Vehicles/Blender_Aircraft/Dirigible_1/combined_8bpp.png") {
	template_blender_aircraft(0, 0)
}

item(FEAT_AIRCRAFT, item_DIRI_1) {
	property {
		name:				string(STR_NAME_DIRI_1);
		climates_available:		ALL_CLIMATES;
		introduction_date:		date(1938, 01, 01);
		model_life:			20;
		retire_early:			0;
		reliability_decay:		20;
		cost_factor:			9;
		running_cost_factor:		69;
		sprite_id:			SPRITE_ID_NEW_AIRCRAFT;
		speed:				283 km/h;
		acceleration:			6;
		passenger_capacity:		200;
		mail_capacity:			20;
		refit_cost:			0;
		//running_//cost_base:		PR_RUNNING_AIRCRAFT;
		//cost_base:			PF_BUILD_VEHICLE_AIRCRAFT;
		range:				0;
		aircraft_type:			AIRCRAFT_TYPE_SMALL;
		misc_flags:			bitmask(TRAIN_FLAG_2CC);
	}
	graphics {
		default:	spriteset_DIRI_1;
	}
}
The capacity is listed as 200 passengers and 20 mail, but they will never pick up any passengers! Why?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Zephyris' NML Questions

Post by Zephyris »

Question 2: How do I choose the running cost base and cost base for aircraft?

Code: Select all

		running_cost_base:		PR_RUNNING_AIRCRAFT;
		cost_base:			PF_BUILD_VEHICLE_AIRCRAFT;
This throws some errors! Is this the right way to go about this? Or is it not needed?
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Re: Zephyris' NML Questions

Post by Digitalfox »

Zephyris wrote:Welcome to yet another NML question thread! Lets kick it off with: Question 1: Why won't my aircraft carry passengers?

I have a grf with a standard cargo translation table:

Code: Select all

//Define the cargo translation table
cargotable {
	PASS, //Passengers (pressurised)		Passengers & Covered (fallback to Covered instead of Pressurised)
	PRGD, //Pressurised goods			Piece goods & Covered
	GOOD, //General goods				Piece goods
	FOOD, //Food					Refrigerated & Covered
	ENSP, //Engineering supplies/machinery		Piece goods
	ORGN, //Organics				Bulk
	FERT, //Fertiliser				Liquid
	PLAS, //Plastic					Piece goods
	CPNT, //Components				Piece goods
	N2__, //Nitrogen				Liquid (fallback to Liquid instead of Gas)
	O2__, //Oxygen					Liquid (fallback to Liquid instead of Gas)
	H2__, //Hydrogen				Liquid (fallback to Liquid instead of Gas)
	CHEM, //Chemicals				Liquid & Hazardous
	ORES, //Mixed ores				Bulk
	WATR, //Water					Liquid
	RGTH, //Regolith				Bulk
}
And it disables the standard vehicles:

Code: Select all

//Disable all default vehicles
disable_item(FEAT_AIRCRAFT, 0, 41);
Then it defines a few aircraft:

Code: Select all

//Aircraft 1
spriteset (spriteset_DIRI_1, "../graphics/Vehicles/Blender_Aircraft/Dirigible_1/combined_8bpp.png") {
	template_blender_aircraft(0, 0)
}

item(FEAT_AIRCRAFT, item_DIRI_1) {
	property {
		name:				string(STR_NAME_DIRI_1);
		climates_available:		ALL_CLIMATES;
		introduction_date:		date(1938, 01, 01);
		model_life:			20;
		retire_early:			0;
		reliability_decay:		20;
		cost_factor:			9;
		running_cost_factor:		69;
		sprite_id:			SPRITE_ID_NEW_AIRCRAFT;
		speed:				283 km/h;
		acceleration:			6;
		passenger_capacity:		200;
		mail_capacity:			20;
		refit_cost:			0;
		//running_//cost_base:		PR_RUNNING_AIRCRAFT;
		//cost_base:			PF_BUILD_VEHICLE_AIRCRAFT;
		range:				0;
		aircraft_type:			AIRCRAFT_TYPE_SMALL;
		misc_flags:			bitmask(TRAIN_FLAG_2CC);
	}
	graphics {
		default:	spriteset_DIRI_1;
	}
}
The capacity is listed as 200 passengers and 20 mail, but they will never pick up any passengers! Why?
Maybe add?

Code: Select all

refittable_cargo_classes    : bitmask(CC_PASSENGERS); 
	non_refittable_cargo_classes: 0;
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Re: Zephyris' NML Questions

Post by Digitalfox »

Zephyris wrote:Question 2: How do I choose the running cost base and cost base for aircraft?

Code: Select all

		running_cost_base:		PR_RUNNING_AIRCRAFT;
		cost_base:			PF_BUILD_VEHICLE_AIRCRAFT;
This throws some errors! Is this the right way to go about this? Or is it not needed?
You have to add for example at the beginning (or elsewhere):

Code: Select all

basecost {
	PR_BUILD_INDUSTRY	:  4; //Affects PR_TOWN_ACTION and PR_BUILD_TOWN
	PR_BUILD_TOWN		:  1; //Price to build Town
	PR_TOWN_ACTION 		: -1; //Interactions with local authority
	PR_CLEAR_INDUSTRY 	:  9; // Deleting industries must also be expensive
}
But it's only one needed to adjust if you disagree with the values you're getting using the below code.

Code: Select all

graphics {
    default: Douglas_DC3_sprites;
    purchase: Douglas_DC3_purchase_sprite;
    speed: Douglas_DC3_speed;
    running_cost_factor: Douglas_DC3_running_cost_factor;
    cost_factor: 50;
    purchase_running_cost_factor: 50;
    purchase_speed: int(27); //Multiply by 12,87 to give speed in KM/h
  }
Take a look at http://bundles.openttdcoop.org/worldair ... ST/WAS.nml

WAS example helps a lot!
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Zephyris' NML Questions

Post by Eddi »

Zephyris wrote:

Code: Select all

	PRGD, //Pressurised goods			Piece goods & Covered
probably unrelated, but: mail is a special case in a lot of places, you may be better off keeping the MAIL cargo label, and just change the displayed name.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Zephyris' NML Questions

Post by PikkaBird »

Question 1: Why won't my aircraft carry passengers?

"This doesn't work, why?" questions are always hard to answer, especially with nothing to test or even a screenshot. You might want to try setting the loading_speed parameter, or there might be some game issue which isn't obvious from your description.

Question 2: How do I choose the running cost base and cost base for aircraft?

You don't. The only cost base you can choose in newgrf is running cost base for trains. Haven't you coded a newgrfs or two before?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Zephyris' NML Questions

Post by Zephyris »

PikkaBird wrote:Question 1: Why won't my aircraft carry passengers?

"This doesn't work, why?" questions are always hard to answer, especially with nothing to test or even a screenshot. You might want to try setting the loading_speed parameter, or there might be some game issue which isn't obvious from your description.

Question 2: How do I choose the running cost base and cost base for aircraft?

You don't. The only cost base you can choose in newgrf is running cost base for trains. Haven't you coded a newgrfs or two before?
You can get the grf from here: http://www.tt-forums.net/viewtopic.php? ... 4#p1135284
I have coded several grfs before, but I have never coded planes, never used nml and never tried to troubleshoot with only slow mobile phone internet access... After 3h stuck sometimes it is just best to ask!

I'll try out the refittable classes idea though, maybe that will help.
Eddy Arfik
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 09 Apr 2014 11:10

Re: Zephyris' NML Questions

Post by Eddy Arfik »

PikkaBird wrote:You might want to try setting the loading_speed parameter
I would start with this, I had similar problem in road vehicle set I'm working on, it seems that default value for this is 0, so unless you are simply modifying a default vehicle it needs to be explicitly defined
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Zephyris' NML Questions

Post by Zephyris »

Assuming that the stated default behavior is correct then it shouldn't be the loading speed:
Units of cargo loaded per time unit. Default vehicles use 5 for trains and road vehicles, 10 for ships and 20 for aircraft. This amount of cargo is loaded to or unloaded from the vehicle every 40 ticks for trains, every 20 ticks for road vehicles and aircraft and every 10 ticks for ships.
I haven't had a chance to try these corrections yet though...
Eddy Arfik
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 09 Apr 2014 11:10

Re: Zephyris' NML Questions

Post by Eddy Arfik »

Zephyris wrote:Assuming that the stated default behavior is correct then it shouldn't be the loading speed:
Units of cargo loaded per time unit. Default vehicles use 5 for trains and road vehicles, 10 for ships and 20 for aircraft. This amount of cargo is loaded to or unloaded from the vehicle every 40 ticks for trains, every 20 ticks for road vehicles and aircraft and every 10 ticks for ships.
I haven't had a chance to try these corrections yet though...
I read that as a guide to what default vehicles use, not what the values initialize at. In any case, I just cracked it open with grfcodec, defined a loading speed and recompiled, the vehicles now load passengers :)
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Zephyris' NML Questions

Post by Zephyris »

Awesome, I'll make that update then :)

I think things like this are why nml can be confusing; loading speed defaults to a useless value (0) but aircraft base cost defaults to a useful value (the plane base cost)... It is hard to spot what must be set.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Zephyris' NML Questions

Post by planetmaker »

Zephyris wrote:Awesome, I'll make that update then :)

I think things like this are why nml can be confusing; loading speed defaults to a useless value (0) but aircraft base cost defaults to a useful value (the plane base cost)... It is hard to spot what must be set.
Welcome to the wonderful land of NewGRF specs.

Those are not NML-specific. That's how the grf specs are. Default values for every property is 0 - except for the IDs of the default vehicles where the default values are those of the corresponding default vehicle. For additional IDs the default values for all properties are 0.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Zephyris' NML Questions

Post by Zephyris »

planetmaker wrote:Those are not NML-specific. That's how the grf specs are. Default values for every property is 0 - except for the IDs of the default vehicles where the default values are those of the corresponding default vehicle. For additional IDs the default values for all properties are 0.
Sounds like the problem is between the chair and the keyboard then... Sorry! :)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 6 guests