Hi,
I just added a diesel flatback tram to the 2cc tram set, but I noticed ingame that it seems like the diesel effect is applied not just to the engine, but allso to all of the wagons.
Looking back at my steam/electric vehicles I am now wondering if the same unwanted effect is allso applied there.
From how I understand the documentation there is a means of limiting the visual effect by means of a switch and callback.
What I am looking for is a way to limit the effect to the default position in consist, part 0.
I'm having a hard time finding an example of this.. if anyone could give me an example that would be awesome.
Visual effects in NML
Moderator: Graphics Moderators
Visual effects in NML
Coder for the 2cc trams (passenger) and the 2cc cargo trams
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Visual effects in NML
Don't make your life complicated without need. Use a different vehicleID for the wagons - unless you plan to use more than 65k different vehicles. They look different, they behave different --> different vehicle. Just disallow buying it via climate availability, so it only is available in the refit option of the tram(s).
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Visual effects in NML
Or if you don't want to use different IDs for the wagons, you would need a switch that looks at the position_in_articulated_veh or position_in_vehid_chain variables (or their _from_end versions). For trams those will be the same at this moment as you can't combine trams to 1 long vehicle like you can do with trains, so in the example I have to do a modulo 3 (the % 3) to make sure that 2 trains behind each other get the correct working. You don't need it, unless in the future trams can be combined.
You would get a switch like this:
And in the graphics-block of your vehicle, you would have
You would get a switch like this:
Code: Select all
switch(FEAT_TRAINS, SELF, switch_emu_FLIRT3III_visual_effect_and_powered, (position_in_vehid_chain % 3)) {
0: return visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 0, DISABLE_WAGON_POWER);
return visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER);
}
Code: Select all
visual_effect_and_powered: switch_emu_FLIRT3III_visual_effect_and_powered;
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Visual effects in NML
That is exactly the kind of example I was looking for, adapted it for roadvehicles and its working, so in the next update for the 2cc cargotrams the visual effects will be fixed.Transportman wrote: 03 Dec 2019 20:26 Or if you don't want to use different IDs for the wagons, you would need a switch that looks at the position_in_articulated_veh or position_in_vehid_chain variables (or their _from_end versions). For trams those will be the same at this moment as you can't combine trams to 1 long vehicle like you can do with trains, so in the example I have to do a modulo 3 (the % 3) to make sure that 2 trains behind each other get the correct working. You don't need it, unless in the future trams can be combined.
You would get a switch like this:And in the graphics-block of your vehicle, you would haveCode: Select all
switch(FEAT_TRAINS, SELF, switch_emu_FLIRT3III_visual_effect_and_powered, (position_in_vehid_chain % 3)) { 0: return visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 0, DISABLE_WAGON_POWER); return visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER); }
Code: Select all
visual_effect_and_powered: switch_emu_FLIRT3III_visual_effect_and_powered;
Edit: the mistake I made was trying to reference the switch from the item block rather than the graphics block, that obviously didnt work, silly beginners mistake I guess lol
Coder for the 2cc trams (passenger) and the 2cc cargo trams
Who is online
Users browsing this forum: No registered users and 18 guests