DJ Nekkids & Bennythen00b's NFO lessons

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

Moderator: Graphics Moderators

michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by michael blunck »

DJ Nekkid wrote:[...] can the price of the purchased wagon be alterted in any way?
How could it? Bought is bought. You want a reduction? 8)

regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by wallyweb »

michael blunck wrote:
DJ Nekkid wrote:[...] can the price of the purchased wagon be alterted in any way?
How could it? Bought is bought. You want a reduction? 8)

regards
Michael
Hmmm ... Are you offering discounts on some of those DBSetXL wagons? :wink:
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by DJ Nekkid »

no, rather the opposite. "True" mu's could have just as expensive wagons as engines, since all of them have power and all the needed "expensive gear". Compared to for example a TGV, where all the "expensive gear" are in the engines at each side. For example could a TGV cost 600k, and have cheap wagons, and a ICE3 could cost 80.000 for each unit. i.e. The "engine" as well as all wagons.
Member of the
ImageImage
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by PikkaBird »

The answer is still no; it's not possible. And I still think that the initial attachment is a very poor way of working out what the player intends to do with the carriages. If you want MU cars to be more expensive than unpowered passenger cars, making them a separate vehicle is definitely the better option.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by DJ Nekkid »

I guess i'll just up the price on the "engine" then, based more on speed and weight, and less on HP.
Member of the
ImageImage
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by michael blunck »

In addition, changing prop17 by CB36 isn´t supported in TTDPatch, IIRC. Possibly because of aforementioned problems. I wonder how this (and why it) is done in OTTD, though.

regards
Michael
Image
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by frosch »

Property 0x17 is evaluated before the vehicle is built. So you cannot use any vehicle variables, but e.g. current date and such.

Btw., Michael, according to newgrf specs TTDP supports ship property 0A.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by michael blunck »

frosch wrote: Btw., Michael, according to newgrf specs TTDP supports ship property 0A.
Yes, since 2.6 r1990.

regards
Michael
Image
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by DJ Nekkid »

hi again all.
As there are a feature i'd like to include in the 2cc set, im wondering if its possible, and then how i'd apply it.

Can a train (typically a MU) retain it's grapichal formation when turning around (stopped, and going the opposite direction at a terminus station)? Typically the mDDm and X2000, where it's a distinct difference between the head and end.
Member of the
ImageImage
dandan
Route Supervisor
Route Supervisor
Posts: 414
Joined: 17 Feb 2008 23:01

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by dandan »

Yes, you have to read vehicle variable FF bit 8 which is flipped every time the train reverses direction. You can then adapt your livery overrides accordingly.

If your configurations are complicated, it can be quite a bit of work but it definitely works. The only problem is that since the order of the wagons cannot actually be reversed, it only works properly if all wagons are of the same type (typically all passenger cars).

You can take a look at the Japan Set code where we use this for all the MUs. I could also post some of the code if you like.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids random NFO-problems - New issue: :)

Post by DJ Nekkid »

feel free :) ... Decifering decompiled code is at times trying to read gibberish :) But yes, it is typically only pax and/or mail wagons :)
Member of the
ImageImage
dandan
Route Supervisor
Route Supervisor
Posts: 414
Joined: 17 Feb 2008 23:01

Re: DJ Nekkids random NFO-problems - New issue: :)

Post by dandan »

Okay, here are the relevant bits of code for the 40 Series EMU from the Japan Set EMUs. The configuration is in blocks of 4: Driving cab + trailer with pantograph + trailer + driving cab with pantograph.

Code: Select all

The following are defined by action 2s:
01 Driving cab forward
02 Driving cab backward
03 Driving cab with pantograph forward
04 Driving cab with pantograph backward
05 Trailer (symmetric)
06 Trailer with pantograph forward
07 Trailer with pantograph backward 

[...]

//choose pax sprites depending on position modulo 4, counted from rear end of train (D1)
  367 * 29	 02 00 75 85 40 08 03 00 03
     02 00 00 00 00 00
     07 00 01 00 01 00
     05 00 02 00 02 00
     03 00

[...]

//check if first vehicle (D1) (we always want a driving cab in front)
  372 * 14	 02 00 72 81 40 00 FF 01 03 00 00 00 75 00

[...]

//choose pax sprites depending on position modulo 4, counted from front end of train (D0)
  374 * 22	 02 00 65 81 40 00 03 03
     01 00 00 00
     06 00 01 01
     05 00 02 02
     04 00

[...]

//check if last vehicle (D0)
  377 * 17	 02 00 62 85 40 00 00 FF 01 04 00 00 00 00 00 65 00

[...]

//check direction (D0 or D1):
  380 * 14	 02 00 60 82 FF 00 01 01 62 00 00 00 72 00

(The IDs of the action 2s are a little weird because I had to remove lots of stuff in between.)

Note that the direction must also be checked when processing callback 10 (powered wagons).
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids random NFO-problems - New issue: :)

Post by DJ Nekkid »

well, luckily dont the 2cc set have any of thoose callbacks :)

But things looks pretty good, and i'll have a look at this when I get home from work
Member of the
ImageImage
dandan
Route Supervisor
Route Supervisor
Posts: 414
Joined: 17 Feb 2008 23:01

Re: DJ Nekkids random NFO-problems - New issue: :)

Post by dandan »

DJNekkid wrote:well, luckily dont the 2cc set have any of thoose callbacks
The Japan Set also has all wagons powered in MUs, but CB10 is still needed to have visual effects (sparks over pantographs) in the right places.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: DJ Nekkids random NFO-problems - New issue: Wagon prices

Post by DaleStan »

dandan wrote:Yes, you have to read vehicle variable FF bit 8 which
... does not exist.

OK, so it does, but it's not associated with the vehicle in question.
Try "variable FE bit 8", or "variable FF bit 0".
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids random NFO-problems - New issue: :)

Post by DJ Nekkid »

Edit:

Solved by pikka@irc











Hi nfo-guys and gals :)

Im currently trying something that dont seem to bee too much success so far, but here goes, the clue is to be able to attach up to 4 1E's after eachother, and up to total 3 (double head, hence the 5)

Code: Select all

-1 * 0  02 00 A7 81 C6 00 FF 01   E1 80 3B 3B   FF 80 // <-- Dissalows VehID 3B with Text message E1
-1 * 0  02 00 A8 81 C6 00 FF 01   E0 80 1E 1E   FF 80 // <-- Dissalows VehID 1E with Text Message E0 
-1 * 0  02 00 A9 81 0C 00 FF 01   A7 00 1D 1D   AF 00 // Dissalow 3B and attach grapics
-1 * 0  02 00 AA 81 0C 00 FF 01   A8 00 1D 1D   AF 00 // Dissalow 1E and attach grapics

-1 * 0  02 00 B0 81 60 1E 00 FF 01    AA 00 03 FF    AF 00 // in my eyes; look for 1E, if it's more then 3 or 4, then use AA, i.e. dissalow attaching, else use Grapichs.
-1 * 0  02 00 AF 82 60 3B 00 FF 01    A9 00 05 FF    B0 00 // In my eyes: look for 3B, if it's more then 3 double heads, use A9, i.e. dissalow attaching, else use Grapics
Any clues where im doing wrong? Btw, this is action3'ed to the Engine
Member of the
ImageImage
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Bennythen00b's NFO problems.

Post by Benny »

I followed the tutorial in the TTDPatch Wiki, and I ended up with a grf file that doesn't do a thing. It uses the graphics from the sub-tropical diesel train MJS 250, and is supposed to replace the SH/Hendry '25'. It actually does something actually, it moves the SH/Hendry '25' to the bottom of the "Rail Vehicles" list.

What did I do wrong? And also, how do I make this file not replacing another train?

The NFO:

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 0D 00 00 00
    1 * 8 08 06 "BV" 01 01 00 00
    2 * 4 01 00 01 08
    3 sprites/lala.pcx 18 8 01 17 8 -3 -10
    4 sprites/lala.pcx 34 8 09 14 20 -14 -5
    5 sprites/lala.pcx 66 8 01 12 28 -14 -6
    6 sprites/lala.pcx 114 8 09 16 20 -4 -8
    7 sprites/lala.pcx 146 8 01 18 8 -3 -10
    8 sprites/lala.pcx 162 8 09 16 20 -14 -7
    9 sprites/lala.pcx 194 8 01 12 28 -14 -6
    10 sprites/lala.pcx 242 8 09 14 20 -4 -6
    11 * 9 02 00 00 01 01 00 00 00 00
    12 * 7 03 00 01 0D 00 00 00
    13 * 7 00 00 01 01 31 12 FD
Last edited by Benny on 12 Apr 2009 08:51, edited 1 time in total.
Image
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: Bennythen00b's NFO problems.

Post by Benny »

Oh, oh! I am getting there! :D

I have set the wrong number at line 13. "31" were supposed to be 0D. And The SH/Hendry '25' is a 4 sprite train, while MJS 250 is a 8 sprite one. So that means that 0D has to be 16, causing the MJS 250 to replace the SH '125' instead. I'm gonna fix this and edit this post when done.

Edit: Okay, so now the MJS 250 sprites replaces the SH '125' sprites completely! :D It works fine and everything, but the only thing replaced is the sprites. And now I have got a dual-headed MJS 250! :P

Image
Last edited by Benny on 12 Apr 2009 09:33, edited 3 times in total.
Image
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Bennythen00b's NFO problems.

Post by XeryusTC »

Good thing you found the solution yourself :) there are usually quite some problems you run into when coding NFO but most of them are easilyy solvable by yourself :)
One small tip though, it is usually more useful that you go to the TTDP graphics section as that is where most coders and artist hang around.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
Benny
Tycoon
Tycoon
Posts: 2185
Joined: 25 Aug 2007 17:03
Location: ~/

Re: Bennythen00b's NFO problems.

Post by Benny »

@XTC: Well, I had no intention of making my graphics TTDPatch compitable, but I am using a TTDPatch wiki, so I suppose it will be compitable with The Patch anyways. I've sent a request to Hyro.


New question:

Which strings tells OpenTTD to override trg1r with lala.grf? I suppose 12 and 13?
To make this file standalone, do I have to change this? Can I replace string 12 and 13 with Action2 strings filled with vehicle information?

Edit: Or replace string 12 and 13 with Action0 strings?


New NFO:

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 0D 00 00 00
    1 * 8 08 06 "BV" 01 01 00 00
    2 * 4 01 00 01 08
    3 sprites/trg1r.pcx 594 10824 01 17 8 -3 -10
    4 sprites/trg1r.pcx 610 10824 09 14 20 -14 -5
    5 sprites/trg1r.pcx 642 10824 01 12 28 -14 -6
    6 sprites/trg1r.pcx 690 10824 09 16 20 -4 -8
    7 sprites/trg1r.pcx 722 10824 01 18 8 -3 -10
    8 sprites/trg1r.pcx 738 10824 09 16 20 -14 -7
    9 sprites/trg1r.pcx 2 10856 01 12 28 -14 -6
    10 sprites/trg1r.pcx 50 10856 09 14 20 -4 -6
    11 * 9 02 00 00 01 01 00 00 00 00
    12 * 7 03 00 01 16 00 00 00
    13 * 7 00 00 01 01 16 12 FD
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests