DJ Nekkids & Bennythen00b's NFO lessons

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

Moderator: Graphics Moderators

User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by PikkaBird »

lawton27 wrote: However the part at the top which sets the ID number
What makes you think that? D: The part at the top appears to be a broken fragment of an action 0 (setting 30 properties for one ID, ID 00, and then.. nothing). Doesn't renum complain loudly about that? I'm surprised the grf would compile and run at all with that there.

You need to set the vehicle ID in your action 3, 4 and 0 (sprite 1303 to 1305).
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DJ Nekkid »

the correct code would be: (untested, but cleaned)

Code: Select all

// My Locomotive (0C) -----------------------------------------------------------------
-1 * 0  00 00 \b23 01 0C // 0C is the ID
  12 FD            // New gfx
  00 \w1963-01-01  // introdate
  02 14            // reliability
  03 \b20          // vehicle life
  04 \b40          // class life
  0D 88            // running cost
  17 25            // purchase cost
  19 28            // Traction Type; 00 Steam, 08 Diesel, 28 Electric, 32 Mono, 38 Mlev
  09 \w100         // speed
  16 \b98          // weight
  0B \w2000        // power
  1F 41            // Tractive effort
  1E 00            // callbacks
  27 02            // flags
  21 00            // shortened
  0E 30 4C 00 00   // run cost base
  05 05            // rail type
  06 07            // climate
  13 00            // doublehead
  14 00            // capacity
  15 00            // cargo
  08 00 // AI passenger
  18 20 // AI rank

// Action1 with 1 set(s) and 8 sprites
 1290 * 4    01 00 01 08
 1604 SPRITES\pcx\Train1.pcx 0 0 01 24 8 -3 -12
 1605 SPRITES\pcx\Train1.pcx 16 0 09 17 22 -14 -9
 1606 SPRITES\pcx\Train1.pcx 48 0 01 12 32 -16 -8
 1607 SPRITES\pcx\Train1.pcx 96 0 09 17 22 -6 -9
 1608 SPRITES\pcx\Train1.pcx 128 0 01 24 8 -3 -12
 1609 SPRITES\pcx\Train1.pcx 144 0 09 17 22 -14 -9
 1610 SPRITES\pcx\Train1.pcx 176 0 01 12 32 -16 -8
 1611 SPRITES\pcx\Train1.pcx 224 0 09 17 22 -6 -9
// Action 2
 1299 * 9    02 00 A0 \b1 \b1 \w0 \w0

// Action 3
 1303 * 10    03 00 01 0C 00 // ID 0C, 0 different cargos
                       A0 00 // Default gfx

// Action 4, name the train
 1304 * 23    04 00 7F 01 0C "Train 1" 00
Member of the
ImageImage
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

Thanks, for the help again, I've got that sorted, hopefully I shouldn't need help for a while now. :D
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

Hi, I'm coding a coal wagon atm, however I'm not shure how to get it to change livery depending on % full, can anyone help?
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DJ Nekkid »

that lies in the action2 itself...


Action1 with 4 sprites:
(-1 * 0 01 00 04 08, action1, for trains, 4 sets, 8 sprites each set)
0: empty
1: a little coal
2: quite a lot of coal
3: full

then you need the action2:

Code: Select all

-1 * 0  02 00 04 04
\w0 \w0 
\w1 \w1
\w2 \w2
\w3 \w3
See?
Member of the
ImageImage
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

DJ Nekkid wrote:that lies in the action2 itself...


Action1 with 4 sprites:
(-1 * 0 01 00 04 08, action1, for trains, 4 sets, 8 sprites each set)
0: empty
1: a little coal
2: quite a lot of coal
3: full

then you need the action2:

Code: Select all

-1 * 0  02 00 04 04
\w0 \w0 
\w1 \w1
\w2 \w2
\w3 \w3
See?
Ah, ok thanks :mrgreen:
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

Hi new problem, I've got a new rail type defined but when trains travel along it they loose all their speed at any corners, I think property 11 controls the speed lost, but by changing it I haven't been able to cause any noticeable effect, can anyone explain this to me?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by planetmaker »

The curve speed for trains depends upon a few things:
- the max speed of the tracks (obviously)
- the the curve length wrt the train.
- the traction type of the track (rail, monorail, maglev give rise to use different formula each).
- the acceleration model being used.
- whether the train is defined as 'tilt' train which would give it 20%(?) advantage over non-tilt trains.
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

Hello again, back for some more, help, picked a nice small project for my-self this time, again involving rail types.

When I define a rail type I know it's possible to define brige overlays from what I hear. My question is is it possible to define an overlay for an entire track type, so it goes over all track pieces, much like electric wires do.

If so how?

Thanks, Lawton27
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by FooBar »

If you mean an overlay on top of one of the original track sprites: no. Railtype overlays are drawn on top of the terrain tile (so you shouldn't add terrain to your own track sprites).
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

Ok thanks for the help, I suppose that makes things simpler, once I've drawn my sprites, I've already defined my rail type but I don't know how to define sprites for it how would I do that?

Thanks for the help.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by FooBar »

Have a look at the Action 3 page, as combined with Action 2 and Action 1 that's what you need.

Here is an example:

Code: Select all

//Track overlays for junctions and PBS
-1 * 0 01 //action 1
	10 //feature: rail types
	01 //num-sets
	\b10 //num-sprites
//flat
-1 sprites/traratrk.pcx 2 10 09 21 40 -19 5
-1 sprites/traratrk.pcx 82 10 09 21 40 -19 5
-1 sprites/traratrk.pcx 162 10 01 7 40 -19 4
-1 sprites/traratrk.pcx 242 10 01 7 40 -19 20
-1 sprites/traratrk.pcx 322 10 01 19 12 11 6
-1 sprites/traratrk.pcx 402 10 01 19 12 -21 6
//slopes
-1 sprites/traratrk.pcx 482 10 09 39 64 -31 -8
-1 sprites/traratrk.pcx 562 10 09 23 64 -31 0
-1 sprites/traratrk.pcx 642 10 09 23 64 -31 0
-1 sprites/traratrk.pcx 722 10 09 39 64 -31 -8

-1 * 0 02 //action 2
	10 //feature: rail types
	A1 //set id
	01 //num-ent1
	00 //num-ent2
	00 00 //entry number
	
-1 * 0 03 //action 3
	10 //feature: rail types
	01 //n-id
	03 //ID
	01 //num-cid
	01 //cargo type: Track overlays for junctions and PBS
	A1 00 //cid
	A1 00 //def-cid
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by lawton27 »

Thanks for the help, unfortunately, I've got my grf working with no errors and for some reason the sprites don't replace the rails, I'm using exactly the code you have pasted there (and a blank(white) pcx file so I can tell when it works) except I have changed the line '03 //ID' to '00 //ID' so it changes the regular rails but they just appear as normal.

I can't work out what's wrong with the grf.

Thanks,
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by FooBar »

You need to define a new railtype (via Action0) and preferrably install a railtype translation table. The ID (03 in my case) also references that translation table. So basically you need a lot more than my small example.

Please find attached the complete NFO of (an unreleased version of) my transrapid tracks.

The reason why your graphics don't show up might be because a large number of graphics is mandatory: if you define less, most likely everything is ignored.
Attachments
traratrk.nfo
License: GNU GPL v2.0
(10.4 KiB) Downloaded 121 times
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DJ Nekkid »

iirc is overlay and underlay/ballast the req min.
Member of the
ImageImage
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by planetmaker »

You necessarily need to define also the level crossings or you get undefined sprites. And it's better to also define the overlay for bridges or they look out-of-place, too.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DJ Nekkid »

As I have my own sticky topic i guess this is the appropiate place to post :D Its been a while since i've had a problem, but parameters and stuff isnt my best field, yet :D

Im currently working on the NuTracks set, and trying to get it to a 0.9.0 state (1.0 will come when I dont need the track enabler engines, and i can sort the list, see flyspray #4393 and #4394)

But to the problem. The set will featureseveral subsets, selectable by parameter0:

Code: Select all

Value | Meaning
    0 | Autoslect if suitable trainsets is loaded
    1 | Default
    2 | With metrotracks
    3 | With 3rd rails


Anyone have any ideas or solutions?

The auto-thingy is ment to autoselct the metrotracks or the 3rd rails (or even more in the future). I've tried a few approaches, but nothing seems to work yet.

Here is the code i've tried with:

Code: Select all

// Set parameter20 to something if parameter0 is 0 :D (i.e. the autoselect)
-1 * 6  09 PARAM0  01 \7! 00 F0           // Skip to F0 if parameter0 isnt 0. I.e. execute if it is
    // METRO TRACKS
    // Check 2cc trainset
    -1 * 6  07 88 04 0A                   // Jump to, 4 byes range, grfID is not nor will be active - i.e. execute if 2cc set is loaded
            GRFID_2CCSET                  // GRF-ID
            01                            // skip 1 sprite
    -1 * 0  0D PARAM20   80 FF FF \d2     // Sets Parameter 0 to 2 (select metro trackset)
    -1 * 6  09 PARAM20   01 \7= 02 F0     // Skip to F0 if one of the above sets' set parameter0 to 02

    // 3rd RAIL TRACKS
    // Check UKRS2
    -1 * 6  07 88 04 0A                   // Jump to, 4 byes range, grfID is not nor will be active - i.e. execute if UKRS2 set is loaded
            GRFID_UKRS2                   // GRF-ID
            01                            // skip 1 sprite
    -1 * 0  0D PARAM20   80 FF FF \d3     // Sets Parameter 0 to 3 (select 3rd rail trackset)
    // Check BROS
    -1 * 6  07 88 04 0A                   // Jump to, 4 byes range, grfID is not nor will be active - i.e. execute if BROS set is loaded
            GRFID_BROS                    // GRF-ID
            01                            // skip 1 sprite
    -1 * 0  0D PARAM20   80 FF FF \d3     // Sets Parameter 0 to 3 (select 3rd rail trackset)
    -1 * 6  09 PARAM20   01 \7= 03 F0     // Skip to F0 if one of the above sets' sets parameter0 to 03 (might not be neccesary, but in case there is more subsets in the future)    

    -1 * 0  0D PARAM20   80 FF FF \d1     // Sets Parameter 0 to 1 (select default trackset)

-1 * 2	 10 F0                            // Target of skip
What happens is, the metro trackset is loaded no matter what. No trainsets get metro trackset, bros and ukrs2 gets metro tracks.

When PARAM20 is set to this or that it selects different sets of Action0s (and when I get so far, different action1-2-3's)

Code: Select all

-1 * 6  09 PARAM20  01 \7! 01 11
<default trackset Action0s>
-1 * 2  10 11 // Target of skip

-1 * 6  09 PARAM20  01 \7! 02 11
<metro trackset Action0s>
-1 * 2  10 11 // Target of skip

-1 * 6  09 PARAM20  01 \7! 03 11
<3rd rail trackset Action0s>
-1 * 2  10 11 // Target of skip
Member of the
ImageImage
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by frosch »

You are doing weird stuff with PARAM20. No idea what you intend with that, but I think your problem relates from:
Action 7/9 Spec wrote:If ["variable"] is a GRF parameter that wasn't specified in the newgrf(w).cfg file (...), the action 7 or 9 is ignored and no sprites are skipped (...)
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by PikkaBird »

frosch, he's (attempting to) set the value of parameter 20 in the first part of the code.

I believe part of the problem may be your very first line there...

Code: Select all

-1 * 6  09 PARAM0  01 \7! 00 F0           // Skip to F0 if parameter0 isnt 0. I.e. execute if it is
A parameter being undefined is not the same thing as = 0. You might want something like this in there;

Code: Select all

   -1 * 9	 0D 00 80 FF 00 00 00 00 00 // set para 0 to 0 if it is not defined
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: DJ Nekkids & Bennythen00b's NFO lessons

Post by DJ Nekkid »

pikka:
that was set by an action14 :)

However, after some chatting on IRC it solved itself :)
Member of the
ImageImage
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 11 guests