Need help with switching train graphics in NML
Posted: 21 Aug 2024 23:40
I'm making a grf using NML where I need to be able to be able to switch between the spritesets of a locomotive based on 2 factors:
-1: Vehicle Refit, I have 3 different liveries which can be chosen to be used on the locomotive.
-2: If the Locomotive has been flipped (facing forward or backward within the consist), Each livery has 2 spritesets, one for if the locomotive is not flipped, and one for if it is flipped.
what I currently have is this
The cargo_subtype switch block is used to identify which of the 3 liveries was chosen, for each livery there is a switch block which checks if the loco is flipped and switch between the forward facing spriteset, and the backwards facing one.
My problem is that I'm getting an error that the "vehicle_is_flipped" switch blocks seem to not exist, the compiler will get to the choose livery switch, but will then give me a "Unrecognized identifier 'switch_GP38_2_CP_Red_facing' encountered" error for option 0 of the choose livery switch block
I can't seem to find anything in the documentation about this, nor can I find any articles in the forum that cover this issue. Any help will be appreciated.
-1: Vehicle Refit, I have 3 different liveries which can be chosen to be used on the locomotive.
-2: If the Locomotive has been flipped (facing forward or backward within the consist), Each livery has 2 spritesets, one for if the locomotive is not flipped, and one for if it is flipped.
what I currently have is this
Code: Select all
//cargo subtype text for GP38-2 refits
switch(FEAT_TRAINS, SELF, switch_GP38_2_cargo_subtype_text, cargo_subtype) {
0: return string(STR_CP_BASIC_RED);
1: return string(STR_CP_RED_WITH_BEAVER);
2: return string(STR_CP_RAIL_SYSTEMS_FLAG);
return CB_RESULT_NO_TEXT;
}
//choose livery
switch(FEAT_TRAINS, SELF, switch_GP38_2_livery, cargo_subtype) {
0: switch_GP38_2_CP_Red_facing;
1: switch_GP38_2_CP_Beaver_facing;
2: switch_GP38_2_CP_Flag_facing;
}
//CP Red GP38-2
switch(FEAT_TRAINS, SELF, switch_GP38_2_CP_Red_facing, vehicle_is_flipped) {
0: spriteset_GP38_2_CP_Red_engine_forward;
spriteset_GP38_2_CP_Red_engine_reverse;
}
//CP Golden Beaver GP38-2
switch(FEAT_TRAINS, SELF, switch_GP38_2_CP_Beaver_facing, vehicle_is_flipped) {
0: spriteset_GP38_2_CP_Beaver_engine_forward;
spriteset_GP38_2_CP_Beaver_engine_reverse;
}
//CP Dual Flag GP38-2
switch(FEAT_TRAINS, SELF, switch_GP38_2_CP_Flag_facing, vehicle_is_flipped) {
0: spriteset_GP38_2_CP_Flag_engine_forward;
spriteset_GP38_2_CP_Flag_engine_reverse;
}
My problem is that I'm getting an error that the "vehicle_is_flipped" switch blocks seem to not exist, the compiler will get to the choose livery switch, but will then give me a "Unrecognized identifier 'switch_GP38_2_CP_Red_facing' encountered" error for option 0 of the choose livery switch block
I can't seem to find anything in the documentation about this, nor can I find any articles in the forum that cover this issue. Any help will be appreciated.