I want to add new planes to existing grf - av8_Aviators_Aircraft_Set. After few days of reading ttd wiki I decided to just start with something more simple - edit one of existing planes. I succesfully changed all action0 properties that I want. But many of them are modified by callbacks(running cost, speed, ...). So I am trying to decode those callbacks using wiki. The only thing I was succesfull are two first bytes - its action 2 and its airplane Can anybody guide me how to decode those callbacks?
Just create an NML override grf, much like this NARS override grf (source has some nice instructional comments). It'll be vastly easier than trying to mess around with NFO.
Those override grf actually modifies the properties of the existing vehicles in the given grf.
If you're just adding new vehicles, do you need to do anything with the existing grf, other than perhaps check if the other grf is loaded or not, and perhaps read the grf parameters given to the original grf?
Supercheese wrote:Just create an NML override grf, much like this NARS override grf (source has some nice instructional comments). It'll be vastly easier than trying to mess around with NFO.
That is interesting option. Problem is that I dont know what callbacks I should change.
It's not that well commented, unfortunately. What do you want to change? Speed is in sprite 6780, running cost in sprite 6785 and non-passenger capacity 6795.
PikkaBird wrote:It's not that well commented, unfortunately. What do you want to change? Speed is in sprite 6780, running cost in sprite 6785 and non-passenger capacity 6795.
Thank you very much. Now I can try to change something. But still dont understand meaning of bytes. For exammple speed call back:
02 - action 2
03 - airplane
09 - ID of this callback - some magic number you choose, probably not important if you don't refer this callback later?
81 - wiki says <num-ent1> without any clue what it is
now Iam totally lost. I cant find any of the bytes followed in this table of the callbacks http://newgrf-specs.tt-wiki.net/wiki/Callbacks.
6780 Enumerated sprite ID. you don't have to fill this out, NFORenum will correct this (people generally put -1 here)
* This is a Pseudo-Sprite
26 Length of the sprite in bytes, likewise this can be filled out by NFORenum
02 Action 2
03 Feature 3
09 ID (will be used at some place further down in another action 2 (or 3))
81 Type of the variable (Byte, Word, DWord. in this case, Byte)
E2 Variable you read (Movement state)
see http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#_VehicleArray, entry 62(+80)
00 FF Varadjust (no shift, all bits)
04 4 options
\b50 80 return value 1 (highest bit must be 1 for callback results)
0D 0F range 1
\b200 80 return value 2
12 12 range 2
\b50 80 return value 3
10 14 range 3
\b25 80 return value 4
15 16 range 4
\b200 80 default value
MildaIV wrote:I want to add new planes to existing grf
For that use case you better make your own add-on NewGRF with your own planes. You then can make your life a bit easier and write that in NML rather than the rather cryptic NFO
6780 Enumerated sprite ID. you don't have to fill this out, NFORenum will correct this (people generally put -1 here)
* This is a Pseudo-Sprite
26 Length of the sprite in bytes, likewise this can be filled out by NFORenum
02 Action 2
03 Feature 3
09 ID (will be used at some place further down in another action 2 (or 3))
81 Type of the variable (Byte, Word, DWord. in this case, Byte)
E2 Variable you read (Movement state)
see http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#_VehicleArray, entry 62(+80)
00 FF Varadjust (no shift, all bits)
04 4 options
\b50 80 return value 1 (highest bit must be 1 for callback results)
0D 0F range 1
\b200 80 return value 2
12 12 range 2
\b50 80 return value 3
10 14 range 3
\b25 80 return value 4
15 16 range 4
\b200 80 default value
Ty, now I understand whole line with exception of return values. I changed them. As I dont know how this values are transformed to speed in km/h i just copied ones from diferent Airplane
orig 6780 * 26 02 03 09 81 E2 00 FF 04 32 80 0D 0F C8 80 12 12 32 80 10 14 19 80 15 16 C8 80
new 6780 * 26 02 03 09 81 E2 00 FF 04 1C 80 0D 0F 46 80 12 12 1C 80 10 14 14 80 15 16 46 80
I have successfuly changed speed, runing cost. Still can't find range. There's no 1F property, and no mention about range callback in pikkabirds post. Also 0A property is overwriten by some callback, which I can't found.
Ranges in av8 (for the non-generational aircraft) are set en bloc in sprites 8210-8213. This particular aircraft already has the longest range in the set, 4096 tiles.
I successfully modified some small planes to planes Iam using in game like Vickers Vanguard or Boeing 757. After that I slightly changed some airplanes to be more realistic(ie. small increase in pax count for Widebodies, increasing capacity of Boeing 727 to 116 passangers, decreasing its range a little, ...). But still I am not able to change any properties of planes with upgrades like Boeing 737 or 747(ie decrease range of original 737 and increase pax count for 747). Also adding new upgrade would be nice, but probably too complicated (B727-200A upgrade for B727).
Eddi wrote:these "upgrades" really should be split into separate vehicles...
The main reason for the generational aircraft in Av8 was the small number of vehicle IDs available in TTDPatch.
If anyone wants to take the Av8 sprites and use them for their own aircraft set (as WAS does) they should feel free. Alternatively, when I get a moment, I'll set up a patreon account so you can bribe me to update av8 myself.