NML - Flashing lights / Animated textures for a vehicle?
Moderator: Graphics Moderators
NML - Flashing lights / Animated textures for a vehicle?
Hello, I made some police, ambulance and firefighter vehicles, I would like them to have the animation of the Flashing lights on the roof.
Ithink I must have at least 2 textures of the car, for example, in the police car I must have one with the blue light on and another texture with the red light on.
And I imagine that I organize that as frames in NML with a infinite loop, it´s that possible?
Where to start, I'm a bit lost.
Thanks in advance.
Ithink I must have at least 2 textures of the car, for example, in the police car I must have one with the blue light on and another texture with the red light on.
And I imagine that I organize that as frames in NML with a infinite loop, it´s that possible?
Where to start, I'm a bit lost.
Thanks in advance.
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: NML - Flashing lights / Animated textures for a vehicle?
Yes you can, using the animation_counter variable to switch frames. AFAIA the vehicle graphics will only be updated when the vehicle moves or when the user moves the view, so the resulting animation may not be very smooth.
Re: NML - Flashing lights / Animated textures for a vehicle?
Have you tried applying a MASK and then use the 8bpp animated colors?
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Re: NML - Flashing lights / Animated textures for a vehicle?
Thanks for reply Pal, Now yes, I found an old topic of yours: viewtopic.php?p=1235260#p1235260
And modified these part in my code,However it doesn't work, surely I have to add something in the vehicle property ? i missing something right?
spriteset(realbus2_empty, "gfx/realbus.png") { tmpl_realbus2(0) }
alternative_sprites(realbus2_empty, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realbus_32.png", "gfx/realbus_mask.png")
{ tmpl_32_realbus2(0) }
spriteset(realbus2_full, "gfx/realbus.png") { tmpl_realbus2(260) }
alternative_sprites(realbus2_full, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realbus_32.png", "gfx/realbus_mask.png")
{ tmpl_32_realbus2(260) }
spritegroup realbus2 {
loaded: [realbus2_empty, realbus2_full];
loading: [realbus2_empty, realbus2_full];
}
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: NML - Flashing lights / Animated textures for a vehicle?
Are you sure that
is a 8bpp paletted graphicsfile, that ONLY has the animated colors (and for the rest just transparent blue box)?
And have you also read this:
viewtopic.php?p=1235274#p1235274
As you need to make some changes to the template (or a new one for MASK)
And, yes, the vehicle property may also need
However, I never coded vehicles, so not sure if this property applies to them too
Finally, also read this:
viewtopic.php?p=1236805#p1236805
So, You can either use an uniform grey color in your 32bpp graphic, that gets overlayed by the animated MASK color.
Or (for example for the extra zoom level), you can add a bit of extra detail, by using different shades of grey...
Worth experimenting with
Code: Select all
"gfx/realbus_mask.png"
And have you also read this:
viewtopic.php?p=1235274#p1235274
As you need to make some changes to the template (or a new one for MASK)
And, yes, the vehicle property may also need
Code: Select all
OBJ_FLAG_ANIMATED
Finally, also read this:
viewtopic.php?p=1236805#p1236805
So, You can either use an uniform grey color in your 32bpp graphic, that gets overlayed by the animated MASK color.
Or (for example for the extra zoom level), you can add a bit of extra detail, by using different shades of grey...
Worth experimenting with
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Re: NML - Flashing lights / Animated textures for a vehicle?
I went back to work on this, I think OBJ_FLAG_ANIMATED only works for objects, I'm trying to figure out how to do it for vehicles, so far I only found this:Quast65 wrote: ↑26 Apr 2022 14:38 Are you sure thatis a 8bpp paletted graphicsfile, that ONLY has the animated colors (and for the rest just transparent blue box)?Code: Select all
"gfx/realbus_mask.png"
And have you also read this:
viewtopic.php?p=1235274#p1235274
As you need to make some changes to the template (or a new one for MASK)
And, yes, the vehicle property may also needHowever, I never coded vehicles, so not sure if this property applies to them tooCode: Select all
OBJ_FLAG_ANIMATED
Finally, also read this:
viewtopic.php?p=1236805#p1236805
So, You can either use an uniform grey color in your 32bpp graphic, that gets overlayed by the animated MASK color.
Or (for example for the extra zoom level), you can add a bit of extra detail, by using different shades of grey...
Worth experimenting with
viewtopic.php?p=1245831&hilit=vehicle+a ... n#p1245831
and this
viewtopic.php?p=1245763&hilit=vehicle+a ... n#p1245763
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: NML - Flashing lights / Animated textures for a vehicle?
that's right, vehicles don't have an animation counter like objects, only a motion counter. this means you cannot start and stop the animation yourself, or adjust the animation speed. the game does that in a fixed way.
Re: NML - Flashing lights / Animated textures for a vehicle?
Just to be clear, what exactly is it that you want to do?
1. Use a MASK-file so you can use the animated (flashing) colors from the 8bpp palette?
A very simple solution, but maybe not the most elegant.
2. Use a proper animation with multiple frames?
With 2. I cannot help you
1. Use a MASK-file so you can use the animated (flashing) colors from the 8bpp palette?
A very simple solution, but maybe not the most elegant.
2. Use a proper animation with multiple frames?
With 2. I cannot help you
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Re: NML - Flashing lights / Animated textures for a vehicle?
Hi Quast65!Quast65 wrote: ↑19 May 2022 09:38 Just to be clear, what exactly is it that you want to do?
1. Use a MASK-file so you can use the animated (flashing) colors from the 8bpp palette?
A very simple solution, but maybe not the most elegant.
2. Use a proper animation with multiple frames?
With 2. I cannot help you
I'm not sure if 1 is possible in vehicles (Does it work for houses? I like the lights of the Japan Buildings or Total Town Replacement, I think the lights / animations give it an extra touch)
I solved in vehicles using 2, I share my code here in case it helps someone in the future:
realbus_nolight: vehicle with no light.
realbus_light1: Light 1
realbus_light12: Light 2
in my example light 1 is the left light of a siren and light 2 is the right light but it can be any variant that comes to mind, for example a light 1 a front light and light 2 a rear light, or the same light that changes color, It is also possible to add more frames, the possibilities are limitless.
I think "no light" is superfluous but now I did it like this, later I will clean the code.
Code: Select all
spriteset(realbus_nolight, "gfx/realbus.png") { tmpl_realbus(0) }
alternative_sprites(realbus_nolight, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realbus_32.png")
{ tmpl_32_realbus(0) }
spriteset(realbus_light1, "gfx/realbus.png") { tmpl_realbus(1) }
alternative_sprites(realbus_light1, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realbus_32_light1.png")
{ tmpl_32_realbus(1) }
spriteset(realbus_light2, "gfx/realbus.png") { tmpl_realbus(2) }
alternative_sprites(realbus_light2, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realbus_32_light2.png")
{ tmpl_32_realbus(2) }
switch(FEAT_ROADVEHS, SELF, switch_realbus_animation, motion_counter % 3) {
0: return realbus_nolight;
1: return realbus_light1;
return realbus_light2;
}
Code: Select all
graphics {
default: switch_realbus_animation;
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Who is online
Users browsing this forum: No registered users and 13 guests