Tutorials

quake2 - target_lightramp


The target_lightramp entity is another easy entity to use. What it does is makes a light fade in or fade out. I actually don't really remember seeing this used in quake2 but it is such a sutle effect that I just probably didn't notice.

The first thing you need to do is do create the light that you want to fade in or fade out. Give it a light value. This light value will be the maximum the brightness of the light will be when it is all the way faded in.

The second thing you need to do is decide if you want the light to start dark and become bright or start bright and become dark. If you want to the light to start dark then you need to set the spawnflag start_off on the light entity. If you want the light to start light and become dark then you need to have the start_off spawnflag off. You must also give the light a targetname. Lets just give it a targetname of light. targetname light.

Next you need to make the actual target_lightramp entity. It doesn't matter where it goes because it will not be visible. The first thing you need to do to the target_lightramp is to give it a target to the light. target light. While your at do also give the target_lightramp a targetname. Lets give it a targetname of ramp. This is because the lightramp doesnt start on and must be triggered by another entity, but we will get to that in just a minute. There are two key value pairs that you can set for the target_lightramp. They are speed and message. Speed determines how many seconds it will take for the light to fade in or fade out. So if you have speed set to 20 then the light will gradually fade in or fade out within 20 seconds. The message key value pair must have 2 letters and only 2 letters. These 2 letters determine the starting light level and the ending light level. The range of these letters is a to z. So if you want the light to fade in from dark to light then the message would be az. message az. if you want it to fade out from light to dark them the message would be za. message za. Just think of it as A getting brighter and brighter as it goes towards z, with z being the brightest.

There is also one spawnflag called toggle for the target_lightramp. If this is on and you have the target_lightramp triggered with a func_button or a trigger_multiple then if you trigger it again with the button or trigger_multiple it will turn on and turn off as many times as you trigger it. So in other words you can use it more then once.(turn the light on then turn it off)

The last thing you need to do is create the entity that will turn on the target_lightramp. This can be any kind of trigger you want. It all depends on the effect that you are looking for. You could use a func_button if you wanted it to be like a light switch that you could turn off and on. You could use a trigger_once, trigger_multiple, trigger_always, etc. You could even use a func_timer which would make the light fade in and fade out multiple times in row. So make the trigger entity that you wish to use and set the target to the target_lightramp. For this example it would be target = ramp.

That's all there is to a target_lightramp. Pretty cool little entity which can provide you with some very interesting effects. In the [example .map] I included a target_lightramp that is triggered with a func_button. So the lightramp can be turned on or off. Any other questions please post them in the discussion board.

Return to Tutorials Page...







Copyright Crap