Hi,
Due to an ever increasing demand to make the trains in BRSet push pull, could someone in the know point me to a technical document or tutorial for NML on how to create DVT/Brake Vans which make a train into a push pull, ideally with sprite replacement rather than masking of the lights.
Push-Pull Trains in NML
Moderator: Graphics Moderators
Re: Push-Pull Trains in NML
I assume you mean swapping the graphics of the front and rear vehicle when a train reverses in a station.
To do that, put a switch into the graphics chain of both the lead and the rear vehicle.
The switches swap the graphics for front and rear vehicle. Important in the switch is the usage of "PARENT".
To do that, put a switch into the graphics chain of both the lead and the rear vehicle.
Code: Select all
switch(FEAT_TRAINS, PARENT, sw_front_vehicle, vehicle_is_reversed){
0: sw_front_graphics;
default: sw_rear_graphics;
}
switch(FEAT_TRAINS, PARENT, sw_rear_vehicle, vehicle_is_reversed){
0: sw_rear_graphics;
default: sw_front_graphics;
}
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: Push-Pull Trains in NML
mind you that this seemingly simple method quickly escalates if you use vehicles of different lengths in the same consist.
and you completely lost if vehicles from different NewGRFs are mixed.
and you completely lost if vehicles from different NewGRFs are mixed.
Re: Push-Pull Trains in NML
Following the above setup, I've added a pushpull to my set, however I've encountered 2 problems
1. The locomotive I am using can be used with an explicit livery refit, or a random livery choice on purchase. If I use a livery refit, the correct graphics show up on the opposite end when reversed - if I use the random selection, the two ends don't match; that is, the cabcar makes a separate random choice instead of using the lead unit's graphics. I've made a separate random_switch for the cabcar to choose locomotive graphics and made that random_switch dependent on the locomotive's random_switch, but that doesn't seem to fix the problem.
2. The cabcar is defined as a special case of the base coach. I have a livery_override on the locomotive that redirects the coach graphics through a switch to put the cabcar graphics (or a copy of the lead loco when reversed as per question 1) on the last unit of the consist. However, I cannot figure out how to do the same for the locomotive. Is there a way for a locomotive to determine what coaches it is pulling, since I only want the pushpull operation with this specific set of coaches - the locmotive is not a dedicated pushpull, just a general purpose unit with the facilities for pushpull operation.
I've tried running the loco graphics through this switch: I have the graphics line for the loco reference this switch. the coaches are set as vehicle_id 04 [that is, item(FEAT_TRAINS, item_ncr_t7_bilev, 04) in case I've just defined the vehicle id wrong here]. switch_cbatelec_gfx_t7_cabcar is a reverse of the coach graphics selection, switch_ncr_cbatelec_livery_select is the normal livery selection for the loco. In game (OTTD 1.6.1), this doesn't seem to do anything, and the loco never changes its graphics on reverse
EDIT: I've figured out question 2.works to put the cabcar graphics on the loco only when the correct stock is used.
1. The locomotive I am using can be used with an explicit livery refit, or a random livery choice on purchase. If I use a livery refit, the correct graphics show up on the opposite end when reversed - if I use the random selection, the two ends don't match; that is, the cabcar makes a separate random choice instead of using the lead unit's graphics. I've made a separate random_switch for the cabcar to choose locomotive graphics and made that random_switch dependent on the locomotive's random_switch, but that doesn't seem to fix the problem.
2. The cabcar is defined as a special case of the base coach. I have a livery_override on the locomotive that redirects the coach graphics through a switch to put the cabcar graphics (or a copy of the lead loco when reversed as per question 1) on the last unit of the consist. However, I cannot figure out how to do the same for the locomotive. Is there a way for a locomotive to determine what coaches it is pulling, since I only want the pushpull operation with this specific set of coaches - the locmotive is not a dedicated pushpull, just a general purpose unit with the facilities for pushpull operation.
I've tried running the loco graphics through this switch:
Code: Select all
switch(FEAT_TRAINS, PARENT, switch_cbatelec_ispushpull, vehicle_type_id){
04: switch_cbatelec_gfx_t7_cabcar;
switch_ncr_cbatelec_livery_select;
}
EDIT: I've figured out question 2.
Code: Select all
switch(FEAT_TRAINS, PARENT, switch_cbatelec_ispushpull, count_veh_id(04)){
0: switch_ncr_cbatelec_livery_select;
switch_cbatelec_gfx_t7_cabcar;
}
Who is online
Users browsing this forum: No registered users and 20 guests