Nfo question(s) Help needed.

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
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Nfo question(s) Help needed.

Post by metallicsomber »

Been looking over some NFO tutorials thinking about learning how to code them, since Im pretty good with C#, I figure maybe I can make some new stuff for TTD. Of course this is somewhat diffrent then C# I think I can catch on pretty quick by a few trial and errors (ok maybe A LOT of errors..)

The question I got is, With the size of the pixles with this line of code (from the tutorial here).

Code: Select all

// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
0 C:\TTD\SPRITES\trg1.pcx 530 10664 01 18 8 -3 -10
0 is obviously the sprite info number or Spritenum as its called there.
C:\TTD\SPRITES\trg1.pcx is of course the Pcx itself,
503 10664 points to the location cords for its upper left corner
Compression I don't quite understand the tut didn't really go into detail about that.
x and y size obviously is the hight and width of the sprite
but what is xrel and yrel?


[/code][/url]
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

http://wiki.ttdpatch.net/tiki-index.php ... ealSprites

Basically, xrel and yrel are the distance from the "middle" of the sprite to the upper left corner. They are used to position the sprite correctly on the screen.
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

wow that was fast hehe. Ok. so for a building with sevral peices for instance that would be very important?

*EDIT* oh joy those numbers look like A LOT of fun...
User avatar
stevenh
TTDPatch Developer
TTDPatch Developer
Posts: 759
Joined: 24 Jul 2005 05:07
Location: Canberra, Australia
Contact:

Post by stevenh »

Those numbers get to be great deals of fun when you're coding vehicles which like turning corners :twisted:

Best method:
:arrow: Open the GRF Status Window
:arrow: Select your GRF
:arrow: Ctrl-Click on the 'information' area to bring up the sprite 'editor'
:arrow: then use the sprite number (ie. the 0 in your example) and then adjust with the +,-
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

Humm... was using a TTD standard Road depo. I guess I need to make a GRF for the standard one first. I wanted to resize it to add a roof.

*EDIT* with the patest TTDPatch if I leave the x and y rel blank, will it tell me what they are?
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

metallicsomber wrote:*EDIT* with the patest TTDPatch if I leave the x and y rel blank, will it tell me what they are?
No.

If you're modifying default sprites, you can just use the original numbers, and adjust them appropriately if you change the size of the sprite. If you hang on a second I'll cook you up an example.

(yeah, I realise I used "point" and "spot" when I should've used the same word twice)
Attachments
I hope this makes some sort of sense
I hope this makes some sort of sense
Image1.gif (7.33 KiB) Viewed 3282 times
Last edited by PikkaBird on 21 Sep 2006 22:12, edited 1 time in total.
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

Right thats kinda what I had in mind Ok good enough. I failed math lol glad I don't got to get too technal with the numbers. (thanks Windows for its handy calc with hex...)
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

Ok two new questions.

First, I guess you moved the whole pic down to add that right? If I added something to the bottom of the sprite, Id subtract however many pixles I added instead of adding them?

and second, When I hit control in the sprite helper, and type in the number of the sprite (#15 in the custom grf 2719 in the original TTD grf) It don't show anything. Do I need to use hex here? or is there some other trick to get them to show?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

metallicsomber wrote:First, I guess you moved the whole pic down to add that right? If I added something to the bottom of the sprite, Id subtract however many pixles I added instead of adding them?
Only if adding things to the bottom of the sprite happens to move the upper-right corner, too.

As for the GRFAuthorHelperWindow, make sure you selected the correct .grf before opening it, and make sure you aren't trying to modify an Action A sprite.
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
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

As the manual states, the sprite helper window does not support action A sprites.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

(Join from elsewhere.)
metallicsomber wrote:Really all of the cargo actions. The Tutorial just talks about an engine for a train, it don't really talk A LOT about how to make something that uses cargo.
Then you mostly need to read about train props 1D, 28, and 29, and their siblings for the other three vehicle features (16/1D/1E, 11/18/19, and 13/18/19). Unless you are defining your own cargos (which is not the impression I got) Action0Cargos, Action2Cargos, &c. are not of interest.

Also, Action 0 feature 08 property 09 is useful, but not absolutely required.
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
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

Ok heres what I am wanting to do. I got the USset for the trains, and I got George's ECS. Since there are so many good graphics that come with the US train set I want to change what some of their cargo does for my game (personal use only not distrubited)

I am really wanting to learn this stuff it just confuses me a bit.

for my learning process I want to try and keep it as simple as I can. So I'll do sprites 4371-4387. I am going to make a seprate GRF for it so that I can place it below the USset and over ride the original.

Ok after the 8 facings both full and empty, there are these two lines:

Code: Select all

 4388 * 13	 02 00 B3 02 02 01 00 00 00 01 00 00 00
 4389 * 4	 01 00 01 08
Ok the first 00 after the action 2 means its a train item right?

then we got the B3 Not sure what that means if converted back to decmil its 179 but acording to the tutorial that should be the cargo ID and theres no odd cargo id numbers that resembles that.

for my version I will put 18 there which acording to this should be Vehicles/Rubber or am i understanding this wrong?


Next two lines as I understand it means it has both a full and empty set of sprites.

Rest of that line is A LOT longer then in the tutorial. the tut just says that:
00 00 Use the first set while in motion
00 00 And also while loading/unloading
I could use a little more details on that one. I don't quite understand. 01 01 01 01 would mean one set of graphics for full and empty?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

metallicsomber wrote:Ok the first 00 after the action 2 means its a train item right?
Yes.
metallicsomber wrote:then we got the B3 Not sure what that means if converted back to decmil its 179 but acording to the tutorial that should be the cargo ID and theres no odd cargo id numbers that resembles that.
"Cargo ID" and "cargo type" are two different things. Read it as "ID" and be done with it; it's just a magic number that serves no purpose save being fed to another action 2 or an action 3.
metallicsomber wrote:for my version I will put 18 there which acording to this should be Vehicles/Rubber or am i understanding this wrong?
No. That's a cargo type, and those go in the "<cargo-type>" block of an action 3.

Code: Select all

 4388 * 13	 02 00 B3 02 02 01 00 00 00 01 00 00 00
 4389 * 4	 01 00 01 08
4388:
02 00: Action 2 for trains
B3: ID
02 02: Two views for each of loaded and loading
01 00: Use the second view when less than half full
00 00: Use the first vies when more than half full
01 00 00 00: Same as above, but for loading, not loaded
4389:
01 00: Action 1 for trains
01: 1 set
08: Eight sprites per set
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
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

ahh ok that actually helps A LOT. I don't see an action3 that seems to go with this set that I can override. I may have to use a diffrent example to learn from.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Comment that line out and see if NFORenum finds any errors.
If not, add //@@LOCATEID2 B3 near that sprite and comment out the sprite it points to too.

Lather, rinse, repeat. Eventually, NFORenum will complain that ID B3 is undefined somewhere after sprite 4388 and the offending sprite may be the action 3. You may find a variational 2, or a random 2, though.
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
metallicsomber
Engineer
Engineer
Posts: 61
Joined: 05 Sep 2004 14:12

Post by metallicsomber »

Well when I comment it out it complains about the number orders.

Code: Select all

Warning: Found sprite 6285 looking for sprite 6284.
Warning: Found sprite 6286 looking for sprite 6285.
Warning: Found sprite 6287 looking for sprite 6286.
Warning: Found sprite 6288 looking for sprite 6287.
Warning: Found sprite 6289 looking for sprite 6288.
Warning: Found sprite 6290 looking for sprite 6289.
etc. etc. etc.
So I guess I'll try that other method.

*EDIT* *smacks head* Oh wait you talked about the renumber probram... duh lol. let me try that...
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot] and 17 guests