Also, the code you propose
Code: Select all
cargo_subtype: PRAGA_N_LIVERY_SWITCH;
Moderator: Graphics Moderators
Code: Select all
cargo_subtype: PRAGA_N_LIVERY_SWITCH;
Code: Select all
default:
Code: Select all
spriteset(spriteset_Example_Purchase, "gfx/Example.png") {
template_purchase(237, 488)
}
spriteset(spriteset_Example_Livery2, "gfx/Example.png") {
template_electrostar(0, 468)
}
spriteset(spriteset_Example_Livery, "gfx/Example.png") {
template_electrostar(0, 546)
}
spriteset(spriteset_Example_Livery3, "gfx/Example.png") {
template_electrostar(0, 0)
}
switch(FEAT_TRAINS,SELF, sw_Example,cargo_subtype){
0:spriteset_Example_Livery;
1:spriteset_Example_Livery2;
2:spriteset_Example_Livery3;
}
switch(FEAT_TRAINS,SELF,sw_Example_cargo_subtype_text,cargo_subtype){
0: return string(str_Livery2);
1: return string(str_Livery);
2: return string(str_Livery3);
return CB_RESULT_NO_TEXT;
}
item (FEAT_TRAINS, item_Example, xxx) {
property {
name: string(STR_NAME_Example);
climates_available: ALL_CLIMATES;
introduction_date: date(1987,4,21);
model_life: 15;
retire_early: 1;
vehicle_life: 50;
reliability_decay: 7;
refittable_cargo_classes: 0;
cargo_allow_refit: [PASS];
loading_speed: 25;
cost_factor: 61;
running_cost_factor: 37;
sprite_id: SPRITE_ID_NEW_TRAIN;
speed: 161 km/h;
misc_flags: TRAIN_FLAG_MU;
refit_cost: 0;
track_type: BR_3RDC;
ai_special_flag: AI_FLAG_CARGO;
power: 1438 hp;
running_cost_base: RUNNING_COST_ELECTRIC;
dual_headed: 0;
default_cargo_type: PASS;
cargo_capacity: 82;
weight: 168 ton;
engine_class: ENGINE_CLASS_ELECTRIC;
tractive_effort_coefficient: 0.03;
air_drag_coefficient: 0.05;
length: 8;
effect_spawn_model_and_powered: EFFECT_SPAWN_MODEL_ELECTRIC;
extra_weight_per_wagon: 0;
bitmask_vehicle_info: 0;
}
graphics {
additional_text: return(str_purchase_text);
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
cargo_subtype_text: sw_Example_cargo_subtype_text;
articulated_part: switch_articulated_Example;
default: sw_Example;
purchase: spriteset_Example_Purchase;
}
}
I expect that will be possible, for each property you would have one switch based on the cargo_type_in_veh variable, and that switch then points to additional switches that set the value based on the cargo_subtype.Greyfur wrote:Thank you!
I was able to make it work. However I was not able to set any other properties of the refitted vehicle - is it possible to have cargo capacity, speed, runing costs or others changed for the refitted vehicle, when the refit is based on cargo subtype?
Each sprite can be in a separate file if you want to, but you can also put all sprites in 1 file, and everything in between.TrainLover wrote:Can you get spritesets and liveries from different graphics files? I'm working on basically an extremely large livery set, which basically includes the liveries of the major Class I railroads of North America and I would like to use the 2cc template. I would not want to make hundreds of different purchase files for each individual railroad, I would just want someone to be able to refit for the desired livery.
Code: Select all
switch(FEATURE, [SELF|PARENT], sw_switchname, cargo_subtype){
Code: Select all
switch(FEAT_ROADVEHS, SELF, power_B731yob_switch, build_year) {
1982..1985: 202;
1986..1996: 211;
}
item (FEAT_ROADVEHS, ITEM_B731) {
property {
...
power: 211 hp;
...
}
graphics {
cargo_subtype_text: sw_B731_CARGO_SUBTYPE_TEXT;
sw_B731_LIVERY_SWITCH;
power: power_B731yob_switch hp;
}
}
What does "sw_B731_LIVERY_SWITCH;" do there? I am guessing it needs a callback name prefix?Greyfur wrote:Ok, good to know!
Any idea on the error?
I guess it is the default callback, so I expect that the error happens because the default callback is before the final callback. @Greyfur: Can you move the callback in the graphics-block up, so that the sw_B731_LIVERY_SWITCH is the last one?Alberth wrote:What does "sw_B731_LIVERY_SWITCH;" do there? I am guessing it needs a callback name prefix?Greyfur wrote:Ok, good to know!
Any idea on the error?
Code: Select all
item (FEAT_RAILTYPES, NG600RAIL)
{
property
{
label: "NG6R";
introduction_date: date(1883, 1, 1);
name: string(STR_NG6R_NAME);
toolbar_caption: string(STR_NG6R_TOOLBAR);
menu_text: string(STR_NG6R_MENU);
build_window_caption: string(STR_NG60_BUILD_CAPTION);
autoreplace_text: string(STR_NG60_AUTOREPLACE);
new_engine_text: string(STR_NG60_NEW_ENGINE);
compatible_railtype_list: ["NG6R", "NG60", "NAAN", "RAIL", "ELRL"];
powered_railtype_list: ["NG6R", "NG60", "NAAN", "RAIL"];
speed_limit: 60 km/h;
acceleration_model: ACC_MODEL_RAIL;
railtype_flags: bitmask();
}
Users browsing this forum: No registered users and 15 guests