Using callback 36 to modify vehicle prop 0F would seem to be a good solution here. I have code that appears to work to some extent. This produces the expected capacity, but only on refit, not when the vehicle is built. When built, the vehicle uses the capacity from the action 0 (90t). A screenshot may show this better: I suspect the answer is going to be related to this comment in the documentation:
(EDIT) Just thought of something that might be relevant: the vehicle in question is part of an articulated RV chain. I wondered if that's a factor?Wiki wrote:"Most properties will only change when the vehicle is bought, serviced (enters a depot), visits a station or on loading of a saved game. Other ones such as TE are called every time a TE calculation is run."
(EDIT 2) Capacities are coming out wrong: 19t instead of 78t, 21t instead of 87t etc. Probably I've misunderstood the correct way to return a value for this callback?
(EDIT 3) Current workaround is to define multiple vehicles IDs using multiple action 0s with different capacities. This works, but leaves me with a lot of redundant code, and uses a lot of IDs! A better solution would be nice to have.
Any help on this much appreciated.
cheers,
Andy
Code: Select all
1357 * 22 02 01 CC // refitted capacity
81 C4 00 FF // check date vehicle built
03 // range
4E 80 \b00 \b59 // before 1980 (78t)
57 80 \b60 \b70 // before 1991 (87t)
60 80 \b71 \b84 // before 2005 (96t)
68 80 // default (104t)
1358 * 14 02 01 CE //
81 10 00 FF // check which vehicle property to change
01 // range
CC 00 0F 0F // vehicle cargo capacity (as set in Action 0)
FF FF // default
1359 * 14 02 01 CA
81 0C 00 FF // handle callbacks
01 //check one range
CE 00 36 36 // change vehicle properties CB
CD 00 // go to ID A1
1360 * 7 03 01 01 0A // Action 3
00 // Number of different cargo types to support
CA 00 // default