NML/NFO to GRF Related problem......

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

I have figured out how to keep them looks nice, including cutting the excessive blue. (I still left some, though - just to ease me in the xrel/yrel position)

I have tried to code 2 station tile type, but I get a problem in-game....
station problem 3.png
station problem 3.png (23.71 KiB) Viewed 7072 times
As you can see, its a problem with sprite... but grfcodec didn't show this error...

heres the .nfo code :

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel    
    0 * 4    15 00 00 00
    1 * 51    08 07 "PJ" 00 00 "Underground Metro Station version 0.0" 00
    "By YNM" 00
    2 * 6    01 04 01 FF 04 00
    3 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 1 46 49 39 64 -31 -08
    4 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 81 46 49 39 64 -31 -08
    5 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 161 46 49 39 64 -31 -08
    6 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 241 46 49 39 64 -31 -08
    7 * 62    00 04 02 01 00 08 "UDBL" 09 02

	F4 03 00 00
	00 00 00
	10 05 03
	2D 84 00 00
	00 00 00
	10 10 08
	2E 84 00 00
	80

	F3 03 00 00
	00 00 00
	05 10 03
	2F 84 00 00
	00 00 00
	10 10 08
	30 84 00 00
	80
	
    8 * 7    02 04 00 00 01 00 00
    9 * 7    02 04 01 00 01 00 00
   10 * 10    03 04 01 00 01 FE 01 00 00 00
   11 * 42    04 48 FF 01 00 "┼Underground Metro Tile - South Side" 00
   12 * 32    04 48 FF 01 00 "─Underground Metro Station" 00
   
   13 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 1 01 49 39 64 -31 -08
   14 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 81 01 49 39 64 -31 -08
   15 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 161 01 49 39 64 -31 -08
   16 C:\Users\THINKCENTRE\Pictures\Projects\Metro_Station\metroRET_blue.pcx 241 01 49 39 64 -31 -08
   17 * 62    00 04 02 01 00 08 "UDBL" 09 02

	F4 03 00 00
	00 00 00
	10 05 03
	2D 84 00 00
	00 00 00
	10 10 08
	2E 84 00 00
	80

	F3 03 00 00
	00 00 00
	05 10 03
	2F 84 00 00
	00 00 00
	10 10 08
	30 84 00 00
	80
	
   18 * 7    02 04 00 00 01 00 00
   19 * 7    02 04 01 00 01 00 00
   20 * 10    03 04 01 00 01 FE 01 00 00 00
   21 * 42    04 48 FF 01 00 "┼Underground Metro Tile - North Side" 00
here's the graphic (in .png due to me using MS paint to edit it):
metroRET_blue.png
(64.24 KiB) Downloaded 1 time
and the .grf in case anyone want to test it quickly:
Attachments
undergroundmetro.grf
(5.97 KiB) Downloaded 179 times
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NML/NFO to GRF Related problem......

Post by Yexo »

Grfcodec never looks for errors, use nforenum for that. It most likely would have spit out either an error or a warning for your code. The problem: the second set of real sprites is missing an action1.
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

Is action 1 is this line of code ? :

Code: Select all

2 * 6    01 04 01 FF 04 00
I'm no longer on my computer and my batteries run low, so just say which one of them, but I suspect this one.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML/NFO to GRF Related problem......

Post by Quast65 »

Yes it indeed misses the action1.
Furthermore, I know you are in a test fase but could you please change the PJ in your action 08 for your grf-ID. Those are my initials that I also use in my grf's and they might conflict if they get the same ID. I know that I used that in my tutorial, but it was an example and should be changed to your own unique ID.

EDIT:
Is action 1 is this line of code ? :
Yes
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

A quick question : could I assign more than 2 characters on that "PJ" part ?
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML/NFO to GRF Related problem......

Post by Quast65 »

Uhm, yes

You have 4 bits available for the ID, now you use "PJ" 00 00 (PJ is two and the 00's make up the other two). This is a very common use for an ID. So you use two letters of your initials to make the ID rather unique to others and you use the two 00's to give them numbers. So 00 00 is your first set 01 00, your second, etc etc. All in hexadecimal off course.
I hope this clears it up a bit ;-)
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: NML/NFO to GRF Related problem......

Post by Eddi »

small correction, it's "4 bytes".

you can have 4 letters, or 4 numbers, or any combination thereof. the very common example given here is 2 letters and 2 numbers, but you don't have to stick to that. the point is that you need to choose something that nobody else in the whole world will choose.
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

Well, I have sorted out all and using it in my game ! :D Thanks to all !

But I get a problem when I use the station :
Station Problem 4.png
Station Problem 4.png (29.33 KiB) Viewed 6969 times
The train below is showing up over the station "roof", despite I have using the underground metro track. (well, the station itself is using normal metro tracks due to using on the underground metro track would result in my station "roof" disappear - well if you have any suggestion to overcome this, too)

Any way out of this ?

Also, i have a question : is it possible for a station tile to automatically detect a road nearby ?
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML/NFO to GRF Related problem......

Post by planetmaker »

Yoursnotmine wrote: Also, i have a question : is it possible for a station tile to automatically detect a road nearby ?
Somewhat: you can detect the tile type, e.g. that there is a road - but not which layout or configuration

http://newgrf-specs.tt-wiki.net/wiki/Va ... s_.2867.29
http://newgrf-specs.tt-wiki.net/wiki/Va ... s_.2860.29
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML/NFO to GRF Related problem......

Post by FooBar »

I'm hazarding a guess, but it may be that your graphics are defined for the back part of the station rather than the front part.
The drawing order is ground tile - back station part - vehicle - front station part. Thus the front station part is drawn overtop everything, and that's what you need for this type of station.
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

planetmaker wrote:
Yoursnotmine wrote: Also, i have a question : is it possible for a station tile to automatically detect a road nearby ?
Somewhat: you can detect the tile type, e.g. that there is a road - but not which layout or configuration

http://newgrf-specs.tt-wiki.net/wiki/Va ... s_.2867.29
http://newgrf-specs.tt-wiki.net/wiki/Va ... s_.2860.29
Meh, I don't need configuration, just are there any roads or not :D (Hmm, probably also empty tiles if no road detected ?)

Also, I would need to know how does it affect the way the station drawed. Any lights on this ? (as theres no example and i don't know any GRF which also use this)
FooBar wrote:I'm hazarding a guess, but it may be that your graphics are defined for the back part of the station rather than the front part.
The drawing order is ground tile - back station part - vehicle - front station part. Thus the front station part is drawn overtop everything, and that's what you need for this type of station.
No, Foobar - if you mean the vehicle, maybe thats what we need, but for catenary, due to my "roof" is drawn in the same height to your camouflage catenary, it'll always draw a catenary on top of my roof, only the RET signs will appear over. You could test it yourself.



(and the grf file if anybody wonder :
undergroundmetro.grf
(5.98 KiB) Downloaded 320 times
)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: NML/NFO to GRF Related problem......

Post by FooBar »

It may be best to set the station tile to not draw catenary, and then draw your own roof instead.
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

Hmm, now I have to ask something...

How do we apply the additional action and var action ? I know now that adding sprite, even define new things is an action, but for additional (like the var action 2), how does it needs to be added ? Just directly after the defining the station (all with what offsets, boundingbox, etc.), after adding sprite, or how ?

(or just say that for a GRF which use this, we have to put action n after this, etc. I'm haven't get in touch on building tgings with these, as NML seems to don't have any)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: NML/NFO to GRF Related problem......

Post by Eddi »

the varaction2 must come before the action 3 that references it, or before any other varaction2 that references it (to form a chain). and it must come after all (var)action2 that it references itself.


the game starts at the action 3, goes backwards through all varaction2, until it arrives at an action1/realsprite, which it then draws. [alternatively, the varaction2 chain may end with a callback result, but only if the game was trying to resolve a callback]
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

Eh, if I already finished around the detecting road nearby, how (exactly : what action) can make the station draw its RET sign (and stairs) paralleling to the roads ? If in the var action 2 rail continuation info, the road is either on tile no. 2 and 3. The sprite is also available, it will fuse the north (and south) side tile station into one this way.


Quite much, now I'm understand what to write on the code at least (i still have no idea either how make it works)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
User avatar
YNM
Tycoon
Tycoon
Posts: 3570
Joined: 22 Mar 2012 11:10
Location: West Java

Re: NML/NFO to GRF Related problem......

Post by YNM »

Well, maybe it's the right time to resurrect the topic...

I just wanted to ask a few questions :

- How to create spritesets for buildings and multi-tile buildings ?
- How to do a graphic refit ? Do I need to add things to the item - graphics ?
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 16 guests