question about variational action 2

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

broodje
Director
Director
Posts: 615
Joined: 13 Jul 2003 12:47
Location: Alphen aan den Rijn
Contact:

Post by broodje »

right I'm gona try to explain some calback stuf, like I said before I'm not realy good at explaining, but you have to live with it (nor do I have much time, I have to go in 30 minutes :o

I'm gona explain it a bit with the nfo I made for the thalys so here it is:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 40 00 00 00
    1 * 38	 08 05 00 16 1B 02 74 68 61 6c 79 73 00 43 72 65 61 74 65 64 20 62 79 20 62 72 6F 6F 64 6A 65 32 30 30 34 20 AE 00
    2 * 37	 00 00 0E 01 00 12 FD 00 01 6B 08 01 0B 0c 17 09 48 01 13 00 16 5c 19 28 1B 0c 17 06 01 05 00 14 00 23 5C 22 31
    3 * 11	 00 00 03 01 1B 1E 01 12 FD 22 40
    4 * 4	 01 00 06 08
    5 c:\ttd\sprites\thalys.pcx 98 8 01 21 8 -3 -10
    6 c:\ttd\sprites\thalys.pcx 114 8 09 19 22 -11 -12
    7 c:\ttd\sprites\thalys.pcx 146 8 01 14 32 -14 -10
    8 c:\ttd\sprites\thalys.pcx 194 8 09 19 21 -3 -9
   
   (snip)  

   49 c:\ttd\sprites\thalys.pcx 722 40 01 21 8 -3 -10
   50 c:\ttd\sprites\thalys.pcx 738 40 09 19 22 -11 -12
   51 c:\ttd\sprites\thalys.pcx 2 72 01 14 32 -14 -10
   52 c:\ttd\sprites\thalys.pcx 50 72 09 19 21 -3 -9
   53 * 9	 02 00 00 01 01 00 00 00 00
   54 * 9	 02 00 01 01 01 01 00 01 00
   55 * 9	 02 00 02 01 01 02 00 02 00
   56 * 9	 02 00 03 01 01 03 00 03 00
   57 * 9	 02 00 04 01 01 04 00 04 00
   58 * 9	 02 00 05 01 01 05 00 05 00
   59 * 14       02 00 06 81 40 00 FF 01 00 FF 09 09 40 FF
   60 * 26	 02 00 07 81 40 00 FF 04 02 00 01 01 04 00 05 05 03 00 08 08 05 00 09 09 01 00
   61 * 14       02 00 08 81 0C 00 FF 01 06 00 10 10 07 00
   62 * 7	 03 00 01 00 00 00 00
   63 * 7	 03 00 81 1B 00 08 00
   64 * 23       04 00 1F 01 00 54 68 61 6c 79 73 20 28 45 6c 65 63 74 72 69 63 29 00

(okey I have no clue how I will destroy the layout, sory for that :P)

okey I'm gona ignore the part above the sprites, (I'll get back to the action 00 later on) as you can see there are 6 spritesets, each with 8 directions.... I presume btw that you understand the basics, considering you were asking this :D

We should start from the back with the action 3 becouse those tell the patch wich spritesetid should be used for the wagonID. In this case the engine (line 62, with ID 00) uses spriteset 00 so nothing funky here everything is normal. The action 3 on line 63 however defining the pasenger cars is totaly diferend.

First of all it gives a wagon overide hence the 81, 2nd it tells it uses the wagon ID 1B, but it points to srpitesetID 08. wich is defined on line 61. Okey I first tell you what the first actions 2 do:

Code: Select all

The first 6 action 2 just define the sprite sets
setid 00= front engine
setid 01= normal pasenger car
setid 02= 2nd car
setid 03= 9th car 
setid 04= dining car
setid 05= back engine 
line 61 howeve is the place were the whole spritesetchoosing starts for the wagons. 02 00 08 is all normal, but then it sets 81 (becouse it is for the wagon) and the 0C. As you have seen in the wiiki this tells the patch that there is actualy a calback going to happen.
then you got 00 FF this is just becouse we are not gona spriteshift or varchange anything.
we are gona change only 01 set.
the I give the soritesetID it should use if the calback is used, this is a word value, so thats the 06 00.
Next thing is the range when the set ID I just gave should be used. I want the 10th car to use setid 06 00. so the range is 10 10.
last word value is the set ID it should use when it isnt in the range just given...07 00 (sprite set 07 gives only sprite changes not any calback!)



Okey sory I have to run now, I will explain the rest if you are still folowing what I told (and if you are still interested :P) tomorow, or if I'm still alive tonight I tell you tonight....
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

You only need callbacks if you don't want the same effects for all wagons in the trains.

Otherwise, simply set prop. 22 appropriately, for example to 00 to get power and weight but no steam/smoke/sparks.
User avatar
hovering teacup
Route Supervisor
Route Supervisor
Posts: 429
Joined: 03 Feb 2004 12:40

Post by hovering teacup »

broodje;
thanks kind man! seems that here it is not a case where the callback is needed, however i think it is probable that in futur there be.

patchman;
Wiki says different thing than your exemple for the property 22. has it changed the format? and what exactly i want now is to give weight and sparks, but no power to overridden wagons. and the engine should not have the sparks. (fact is that the head-wagon has power but no panto, the following wagon has no power but a panto.)

and still i don't understand how to change the loading speed of overridden wagons. or overriding automatically do it ? in that case, lucky am i.
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Hmm, the Wiki doesn't seem to have the info about train wagons, indeed. Only engines. Basically, the values for prop. 22 are the same as for the callback, though.

For the loading speed to be different depending on the loco, you do need to use callbacks. Otherwise the loading speed is the same for all instances of the wagon.
User avatar
hovering teacup
Route Supervisor
Route Supervisor
Posts: 429
Joined: 03 Feb 2004 12:40

Post by hovering teacup »

sorry for being dense, but could you show me how to define the values for loading speed callbacks? there's only powered wagon callback's how-to around. also, i'm curious what '40' does in the variational action 2 variable.
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Well, nobody's written a tutorial yet. However, you can download http://www.ttdpatch.net/src/newgrfdemo/callback.grf and look at it. It's my test file to test this and other callbacks. Basically, in this file the length of the tender depends on its position in the train, so you have to buy several tenders to see the effect.

About variable 40, it simply tells the patch to count the vehicles in the current train, and return the count plus the current vehicle's position counted from the front and rear. So it allows you to change graphics etc. depending on where in the train your wagon is.
broodje
Director
Director
Posts: 615
Joined: 13 Jul 2003 12:47
Location: Alphen aan den Rijn
Contact:

Post by broodje »

hmm I told you at the start you don't need them, the part about I shouldnt post now, becouse I don't have acces to the wiki etc :D

But I didnt mind writing about calbacks, actualy I will finish it one day (if there is still interest and no one else finished it...) and put it on the wiki
User avatar
hovering teacup
Route Supervisor
Route Supervisor
Posts: 429
Joined: 03 Feb 2004 12:40

Post by hovering teacup »

many thanks to both, patchman and broodje.
im gonna hava pause for a couple o'days on this project. then i'll set on analysis of the callback.grf.

btw patchman, is it possible to change patch so that "additional weight" be applied to all overridden wagon, even in absense of added power?
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

hovering teacup wrote:btw patchman, is it possible to change patch so that "additional weight" be applied to all overridden wagon, even in absense of added power?
No. Power and weight go together.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 30 guests