i.e. Vehicle is built, then user refits and first vehicle uses different sets of real sprites depending on cargo type. (this a tractor / trailer combination, where first vehicle carries no cargo).
I have been talking to Zephyris about it, the simplest way appeared to be to have the action 3 target different action 2 chains dependent on cargo. This creates some redundant code, but seemed to be conceptually simple. However it doesn't work when the cargo capacity of the lead vehicle is zero. Based on Pikka's comment in a previous thread, this is possibly expected.
Subject: Problems with coding refit cycle
I've copied my code below in case the cause is coder error. I think the nfo is valid because if I give the lead vehicle a capacity of 1, livery override works as expected on refit (although the vehicle's capacity is then horribly incorrect - does not seem to include the capacity of trailing vehicles).PikkaBird wrote:You cannot create or destroy articulated parts on the fly; the articulation callback is run only once when the vehicle is bought.
Is there a way to achieve what I want with a reasonable amount of effort and code (possibly using variable 42)? NB this is different to the issue I had in a previous thread where I wanted to change the number of vehicles in an articulated vehicle on refit.
Code: Select all
582 * 9 02 01 A1 01 01 00 00 00 00 // set of real sprites
583 * 9 02 01 A2 01 01 01 00 01 00 // set of real spries
584 * 4 01 01 01 01 // will be used for buy menu sprites (unfinished)
585 Y:\Documents\OTTD graphics\HEQS_build\Full HEQS\sprites\tractors/fourtrac_1CC.pcx 242 9 01 16 36 -18 -8
586 * 9 02 01 A0 01 01 00 00 00 00 // will be used for buy menu sprites (unfinished)
// the variation action 2 is thanks to Zephyris who supplied the original nfo for this grf
587 * 14 02 01 B0
81 10 00 FF //check byte value of variable 10 (no bit shift, FF andmask)
01 //check one range(s)
00 80 01 01 //give callback result of 00 for value 01*
FF FF //otherwise end the callback chain
588 * 14 02 01 B1
81 0C 00 FF //check byte value of variable 81 (no bit shift, FF andmask)
01 //check one range
B0 00 16 16 //go to ID B0 for value 16 (ie. go to the articulated vehicle building instructions)
A2 00 //otherwise go to ID A1 (ie. apply vehicle graphics)
589 * 14 02 01 C0
81 10 00 FF //check byte value of variable 10 (no bit shift, FF andmask)
01 //check one range(s)
00 80 01 01 //give callback result of 00 for value 01*
FF FF //otherwise end the callback chain
590 * 14 02 01 C1
81 0C 00 FF //check byte value of variable 81 (no bit shift, FF andmask)
01 //check one range
B0 00 16 16 //go to ID B0 for value 16 (ie. go to the articulated vehicle building instructions)
A1 00 //otherwise go to ID A1 (ie. apply vehicle graphics)
591 * 10 03 // Action 3
01 // RV
01 // Number of vehicles this action associate graphics with
80 // Vehicle ID
01 // Number of different cargo types to support
07 // wood
C1 00
B1 00 // default Action 2 ID