Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Mar 20, 2019 4:52 pm

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Sep 07, 2004 7:29 pm 
Offline
Director
Director
User avatar

Joined: Sun Jan 04, 2004 10:11 pm
Posts: 519
I've decided I want to "get" NFO coding, so I've started fiddling around with my first .grf. I followed the tutorial on the wiki and managed to replace the UU 37 with more real looking, green Class 37. I even extended that work a bit by specifying the real name for the engine and changing its stats around a bit. This all worked fine.

Now, I want to add a second livery (large logo blue) to appear later on in time. As I understand it, I need to declare:

1 x action 2 for each set of sprites (green and blue)
1 x action 2 for the years each set is valid

1 x action 3 to connect the new vehicle to an existing slot
1 x action 3 for each livery to connect the set IDs to the slot

Making a total of four action 2s and three action 3s. Am I barking up the right tree here, or have I written down a load of essentially random bytes in an attempt to make it look like I know what I'm doing? Any help much appreciated!


Code:
// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel

// first pseudosprite
    0 * 4 0f 00 00 00
// action 8 - 20 bytes - sf 37 - Class 37
    1 * 15 08 06 73 66 03 07 43 6c 61 73 73 20 33 37 00
// action 1 - train - two sets of gfx - 4 views
    2 * 4 01 00 02 04
// the sprites - BR green
    3 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 66 8 01 18 8 -3 -10
    4 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 82 8 09 15 20 -14 -6
    5 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 114 8 01 12 28 -14 -6
    6 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 162 8 09 15 20 -4 -7
// the sprites - BR large logo blue
    7 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 193 8 01 18 8 -3 -10
    8 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 209 8 09 15 20 -14 -6
    9 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 241 8 01 12 28 -14 -6
   10 C:\MPS\TTD alpha\newgrf\SPRITES\mytrain.pcx 289 8 09 15 20 -4 -7
// 7 - action 2 - train - cargo 0 - one set for moving - one set for loading - use first in both cases
// 8 - action 2 - train - cargo 1 - one set for moving - one set for loading - use second in both cases
    7 * 9 02 00 00 01 01 00 00 00 00
    8 * 9 02 00 01 01 01 01 00 01 00

    9 * 14 02 00 10 81 01 00 ff 01 00 00 27 41 00 00
   10 * 14 02 00 11 81 01 00 ff 01 01 00 42 ff 01 00

// action 3 - train - one vehicles - replaces UU 37 - no special graphics - cargo 0
// 11 * 7 03 00 01 0e 00 00 00

   11 * 10 03 00 01 0e 01 FF 00 00 00 00
   12 * 8 03 00 01 0e 00 00 00 00
   13 * 8 03 00 01 0e 01 00 01 00

// action 0 - train - one property - one vehicle - starting at UU 37
// set prop 0 (intro date to 96 37 - 1959) prop 9 (speed to 80 00 - 128kmh)
// prop 0b (power to d6 06 - 1750hp) prop 12 (sprite type to FD - new graphics)
   14 * 16 00 00 04 01 0e 00 96 37 09 80 00 0b d6 06 12 FD
// action 4 - train - english - 1 string - starting at UU 37 - 'BR Type 3 Class 37 (Diesel)'
   15 * 33 04 00 02 01 0e 42 52 20 54 79 70 65 20 33 20 43 6c 61 73 73 20 33 37 20 28 44 69 65 73 65 6c 29 00


Last edited by cornelius on Wed Sep 08, 2004 5:37 pm, edited 1 time in total.

Top
   
 Post subject: Re: Action 2/3 question
PostPosted: Tue Sep 07, 2004 7:36 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Oct 02, 2002 6:57 pm
Posts: 5552
Location: Ithaca, New York
cornelius wrote:
1 x action 3 to connect the new vehicle to an existing slot
1 x action 3 for each livery to connect the set IDs to the slot


You can only have one action 3 for each vehicle. You don't choose between the liveries in the action 3, but instead in a variational or random action 2 (depending on what you want).

So you'd have

action 2 (green)
action 2 (blue)
variational action 2
action 3 set to use the variational action 2


Top
   
 Post subject: Re: Action 2/3 question
PostPosted: Wed Sep 08, 2004 1:29 am 
Offline
Director
Director
User avatar

Joined: Sun Jan 04, 2004 10:11 pm
Posts: 519
edit: to restore the entire post

Patchman wrote:
You can only have one action 3 for each vehicle. You don't choose between the liveries in the action 3, but instead in a variational or random action 2 (depending on what you want).

So you'd have

action 2 (green)
action 2 (blue)
variational action 2
action 3 set to use the variational action 2


Okay that makes sense.

So now I have this, where I hoped that the variational action 2 would saying "my set-id is 10, use sprite set 0 if the year is between 0 and 60 after 1920, use sprite set 1 if the year is 61 - 120 years after 1920, otherwise use set 0 again".

The action 3 should then be using set-id 10 with FF set to show it in the purchase list (if I set the action 3 to set-id 01 instead it picks up the blue livery).

I'm guessing it's a dodgy variational action 2?

Thanks for your help - if I get to the bottom of this I'll write up a tutorial for the wiki.

Code:
   11 * 9 02 00 00 01 01 00 00 00 00
   12 * 9 02 00 01 01 01 01 00 01 00

   13 * 18 02 00 10 81 01 00 00 02 00 00 00 3c 01 00 3d 82 00 00

   14 * 10 03 00 01 0e 01 FF 10 00 00 00


Top
   
 Post subject:
PostPosted: Wed Sep 08, 2004 4:24 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Oct 02, 2002 6:57 pm
Posts: 5552
Location: Ithaca, New York
Almost got it, I think. This line:
Code:
13 * 18 02 00 10 81 01 00 00 02 00 00 00 3c 01 00 3d 82 00 00 

should be
Code:
13 * 18 02 00 10 81 01 00 FF 02 00 00 00 3c 01 00 3d 82 00 00 


The "FF" there is the bit mask, if you set it to 0 you clear all the bits in the value and always get 0.


Top
   
 Post subject:
PostPosted: Wed Sep 08, 2004 8:05 am 
Offline
Director
Director
User avatar

Joined: Sun Jan 04, 2004 10:11 pm
Posts: 519
Fantastic! The action 3 needed a bit of tweaking too but it's working fine now. Thanks :)


Top
   
 Post subject:
PostPosted: Wed Sep 08, 2004 3:06 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu May 22, 2003 9:59 am
Posts: 2138
I would recommend changing this:
Code:
13 * 18 02 00 10 81 01 00 FF 02 00 00 00 3c 01 00 3d 82 00 00
to this:
Code:
13 * 14 02 00 10 81 01 00 FF 01 01 00 3d 82 00 00

They both work perfectly but the latter is just a touch more efficient (and I'd say more readable too).

_________________
US Train Set v0.87.1 now released: viewtopic.php?t=8754
Don't forget to read the manual: http://wiki.ttdpatch.net/tiki-index.php?page=Manual


Top
   
 Post subject:
PostPosted: Wed Sep 08, 2004 5:36 pm 
Offline
Director
Director
User avatar

Joined: Sun Jan 04, 2004 10:11 pm
Posts: 519
Oracle wrote:
They both work perfectly but the latter is just a touch more efficient (and I'd say more readable too).


Yep that makes sense. It also seems to make pre-1980 locos keep their green livery, which I'd been trying to work out how to do ;)

So here it is: My First Grf. It contains a class 37 in two liveries, replacing TTD's UU 37. I haven't tested it with any other sets, and the graphics aren't accurate - just enough to see the test working - but I'm dead chuffed.


Attachments:
File comment: Windows version
class37.zip [1.38 KiB]
Downloaded 113 times
File comment: BR green and Large Logo blue (actually I think it might be Scotrail with the dog on the side?)
class37.png
class37.png [ 19.15 KiB | Viewed 2064 times ]
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.