showing different sprites according to different cargos

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

Post Reply
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

showing different sprites according to different cargos

Post by a.locritani »

Hi! I've a problem with a simple grf.
just to test how it works, I tried to change the sprite of full-loaded coal wagon.so i coded in this way:

Code: Select all

[...]
    2 * 4	 01 00 02 04
    3 sprites/new.pcx 66 8 01 16 8 -3 -8
    4 sprites/new.pcx 82 8 09 14 20 -14 -5
    5 sprites/new.pcx 114 8 01 10 28 -14 -4
    6 sprites/new.pcx 162 8 09 14 20 -4 -6
    7 sprites/new.pcx 194 8 01 16 8 -3 -8
    8 sprites/new.pcx 210 8 09 14 20 -14 -5
    9 sprites/new.pcx 242 8 01 10 28 -14 -4
   10 sprites/new.pcx 290 8 09 14 20 -4 -6
   11 * 0     02 00 00 02 02 00 00 01 00 00 00 01 00
   12 * 0	 03 00 01 1D 00 00 00
   13 * 0	 00 00 04 01 1D 12 FD 28 00 00 29 00 00 1D 0A 01 00 00
new.png
new.png (1.84 KiB) Viewed 1596 times
now something strange happens: on TTDPatch correct sprites appear but the refitting option is wrong: in the buying window, it is shown as "cargo: coal; refittable to rubber, oil, copper ore" instead of "cargo: coal; refittable to coal, oil, iron ore". on actual refit window the correct string appears.
on OTTD, instead, cargo refittability is ok, but sprite for full-loaded status only appear when train is full-loaded, instead of appearing when >50%, as in TTDP and as I expect.

and also:

Code: Select all

[...]
    2 * 4	 01 00 03 04
    3 sprites/new2.pcx 66 8 01 16 8 -3 -8
    4 sprites/new2.pcx 82 8 09 14 20 -14 -5
    5 sprites/new2.pcx 114 8 01 10 28 -14 -4
    6 sprites/new2.pcx 162 8 09 14 20 -4 -6
    7 sprites/new2.pcx 194 8 01 16 8 -3 -8
    8 sprites/new2.pcx 210 8 09 14 20 -14 -5
    9 sprites/new2.pcx 242 8 01 10 28 -14 -4
   10 sprites/new2.pcx 290 8 09 14 20 -4 -6
   11 sprites/new2.pcx 322 8 01 16 8 -3 -8
   12 sprites/new2.pcx 338 8 09 14 20 -14 -5
   13 sprites/new2.pcx 370 8 01 10 28 -14 -4
   14 sprites/new2.pcx 418 8 09 14 20 -4 -6
   15 * 13	 02 00 00 02 02 00 00 01 00 00 00 01 00
   16 * 13	 02 00 01 02 02 00 00 02 00 00 00 02 00
   17 * 10	 03 00 01 1D 01 08 01 00 00 00
   18 * 18	 00 00 04 01 1D 12 FD 28 00 00 29 00 00 1D 0A 01 00 00
new2.png
new2.png (2.03 KiB) Viewed 1596 times
if I understand the wiki this grf should show different sprites, according to different cargos loaded. in particular it should use action 2 defined in sprite 16 (the blue-cargo one) if cargo is oil (08) and action2 defined in sprite 15 (the red-cargo one) otherwise. but both in OTTD and TTDPatch it always use sprite 15 action2.

so, I'm sure I'm doing something wrong, but what?

Thanks in advance
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: showing different sprites according to different cargos

Post by Lakie »

Actually you've set it to show red when refitted to "iron ore", you use Type A of the cargo number from this table for action3s.

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: showing different sprites according to different cargos

Post by a.locritani »

you say "red" for iron ore, but maybe "blue"? or I'm still missing something?
on the other hand, you're i've read wrong column; later i'll try using the correct code (03) for oil and let you know the results.

However, problems on first half of my post still apply. any idea about them?
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: showing different sprites according to different cargos

Post by Lakie »

I don't get the first issue with my version of TTDpatch (2045, old I know but I have yet to reload cygwin).
Shows the correct cargoes in the refit text on the buy menu with your code in a grf I've compiled.
My buy train menu on TTDpatch 2.6 r2045m
My buy train menu on TTDpatch 2.6 r2045m
buy menu.png (3.54 KiB) Viewed 1396 times
And with the second one, I mean that the colour of the stuff in your wagon, as it was the easiest way to distinguish them from each other.
Yes, I got them muddled up however, blue for iron ore and red for default, how silly of me, but still you get the idea.
That's what I get for writing in a rush before leaving for town.
Trains in game with the 08 (Iron Ore) in the action3 as 03 (Oil).
Trains in game with the 08 (Iron Ore) in the action3 as 03 (Oil).
trains.png (24.32 KiB) Viewed 1399 times
~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: showing different sprites according to different cargos

Post by a.locritani »

thanks Lakie. you're right. i've put the correct code for my second example and it works as intended.
for my first example, strange, i've tried with 2.6 r2045 as you say and still doesn't work, same problem.
anyway, i attach the grf. may be some patch setting change this behaviour? i've delete ttdpatch.cfg and i'm using a clear one but nothing changes.

for ottd problem (full-load sprites shown only when 100% full and not when 50% full as i expect) any idea?

edit: just another quick question: to use the second company color, i only need to paint an area with the patch company 2 colors as shown here? or i've to set something else in the .nfo file?
Attachments
new.grf
(1.43 KiB) Downloaded 42 times
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: showing different sprites according to different cargos

Post by Lakie »

For 2cc on train vehicles, you need to set the bit (bit 1) in action0 property 27. Reference

Not sure about configuration, it is quite possible that you could be missing something which refit relies upon, but I can't think of what off the top of my head.
I've attached my ttdpatch.cfg if you want to find out what stops it working for you.

~ Lakie
Attachments
ttdpatch.cfg
(37.14 KiB) Downloaded 52 times
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: showing different sprites according to different cargos

Post by a.locritani »

thanks again, Lakie. I was able to find the 2colors stuff just after posting my question, anyway thanks.

regarding the problem of wrong displayed cargo on buying window, I've found that it's caused by having newcargos off. it's strange, but it's true.

thanks.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: peter1138 and 5 guests