Police Lights

Post topics regarding Level Building/Design and Entity Usage with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Police Lights

Post by metal_head »

I don't know if you know this :D, but in my game "Metal Force" is some kind of Police, they work with the police too, soo I have a cool sort-of-a-Buggy-scifi-vehicle model and I want to make police lights on it. Now the problem is not modeling the lights, but making them in the editor, there has to be one blue and one red light, which are flashing. But how do I make when the blue light is off, the red light to be on and than the opposite? If possible I want to make a flipbook or corona entities that flash with the lights, but I have no idea of how to make it... Some help?
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Police Lights

Post by Juutis »

See DynamicLight in the manual. Basically you should add two of them and give them opposite RadiusFunctions. For example, the RadiusFunction for the blue light would be 'aza' and for the red 'zaz', so whenever the blue light is on its highest brightness the red one is on its lowest, and vice versa.
Pain is only psychological.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Police Lights

Post by metal_head »

Oh, I forgot to edit my post, I actually made that after I posted it, but now the problem is with the coronas or flipbooks, can I make them appear and disappear? They don't have radius functions and stuff, so it smells like scripting to me (please, tell me no scripting will be required :D )
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Police Lights

Post by Juutis »

You can specify a trigger for both of them so it should be possible to turn them on and off. You just have to play around with triggers a lot. I think an easier way would be to add a FlipBook with a sequence of bitmaps where the image fades in and out.
Pain is only psychological.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Police Lights

Post by metal_head »

yeah,that would be simle, but I don't know how would I make one of the bitmaps appear when the other disappears in the same time, I'll think about it!
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Police Lights

Post by Jay »

You could make two sets of flipbook images and compare frame by frame. For example you have 10 frames for each. Then on frame number 1 (bitmap0.bmp) the first one is fully faded in, while the second is fully faded out and during 2-5 the first one fades out while the second fades in. Then on frame number 6 (bitmap5.bmp) it's reversed: first one fully faded out, second one fully faded in. and then from frame 7-10 the first one fades in again and the second fades out.

0 - visible - not visible
1 - fade out - fade in
2 - fade out - fade in
3 - fade out - fade in
4 - fade out - fade in
5 - not visible - visible
6 - fade in - fade out
7 - fade in - fade out
8 - fade in - fade out
9 - fade in - fade out

Then you add them with the same speeds and it should work.
Tip: You can make one set of images and just switch the first 5 with the last 5 for the second set.

An alternative method may be (if it's implemented) the SetCurFlipbook command. You would use one set of images and then write in your setup order at the beginning of your scripted player (the setup order must be in low level)
SetCurFlipbook("Red",0);
SetCurFlipbook("Blue",5);

Hope this helps. :)
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Police Lights

Post by metal_head »

yep, that helps a lot ! Only not sure how I'm gona synchronize the fading in&out with the lights, but I'll think of something :) thanks!
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Police Lights

Post by Juutis »

Shouldn't be too hard. Just make sure Speed in your FlipBook matches RadiusSpeed in the DynamicLight. Say, your FlipBook animation is 10 frames long and the DynamicLight takes 2 seconds to fade in and out. So you have to show 10 frames within 2 seconds. With basic math this equals 5 frames per second (so the Speed of the FlipBook should be 5).
Pain is only psychological.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Police Lights

Post by metal_head »

whoooo, thanks, I didn't though it would be that simple!
Post Reply