Page 1 of 2

Pulsing lights..

Posted: Thu Oct 02, 2003 1:15 pm
by Franaticus Satanii
What would be the proper way to create a pulsing light (not flashing) as in the kind of light found on top of antenna towers?

I would like to use a red caged light that goes from 100% to 30% then back to 100% slowly.

I have searched the forums...but I don't think I saw anything close except the street light thread.

I'm still a new mapper (2nd map) and I know near to nothing about scripting (but I AM learning). Please reply in layman's terms...I confuse easily when on new ground :wink: ....I appreciate any response.

Posted: Thu Oct 02, 2003 2:57 pm
by bdbodger
The light from a light entity is compiled by mohlight.exe and can't be changed from script . How ever you can make a script_model fx/dummy.tik and use dynamic that is not compiled light what you do is make a script_model and give it a targetname lets say towerlight .

main:
thread tower_Pulse
end

tower_pulse:

$towerlight light 1 0 0 400 // red green blue lightradius

// no end here we want it to run into the next thread to pulse

start_pulse:
$towerlight lighton
wait 4
$towerlight lightoff
wait 4
goto start_pulse
end

Posted: Thu Oct 02, 2003 4:28 pm
by Franaticus Satanii
Thanks for the response..I assume that this is inserted into my script file after "waitill prespawn"....correct?

I don't follow what you mean when you say
make a script_model fx/dummy.tik and use dynamic that is not compiled light what you do is make a script_model and give it a targetname lets say towerlight
I'm not clear on what a script model is OR how to create/use a dummy.tik

Please be patient...I'm still learning....and lord knows there is a lot of stuff to learn!! :shock:

Posted: Thu Oct 02, 2003 5:28 pm
by bdbodger
Make a brush right click on the 2d window select script->script_model
then press n to open the entity window give
your script_model the

Key: model
Value: fx/dummy.tik

that model is a non drawing model used for things like emitters and effects and in this case dynamic light which is scripted light which is not as good as compiled light but can be scripted . If you make a light like this and it is too close to a wall for instance it will shine on both sides of the wall because it is scripted . You can spawn this type of light as well by spawning a script_model and useing the key/value above . Adjust brightness by radius and light color you can't make this kind of light linear or shine down like a compiled light .

light

Posted: Thu Oct 02, 2003 6:38 pm
by tltrude
A dynamic light will light up objects near the light, but I think what you want is a corona that changes size. There is no red corona--only an orange one. So, You would probably have to make a new one. If you manage that, I'm sure we can figure out a way to change it's size in the script. Or, make a larger one fade in and out.

Posted: Thu Oct 02, 2003 9:09 pm
by Franaticus Satanii
A corona is a model correct? Or is it a texture?

I know there is a tutorial for creating new textures...is there one for creating / editing models?

I wil try to worm my way through bdbodger's solution, but I have a feeling it won't pulse as much as blink on and off.

If you ever really look at an antenna warning beacon, it actually goes from bright (100%) to dim (20%+/-) and then back. It never really shuts off.

Oh well, beggars can't be choosers. I just wish I knew more about this stuff. Thanks guys.

Posted: Thu Oct 02, 2003 10:53 pm
by wacko
tltrude is right, a dynamic light won't be visible, it would just light up things. So a corona is the right way. Here's a red one (u get a pk3 with just the red corona, which you will then find in mohradiant in the entities/static/corona/red), but for making it pulse, u need help from someone else, sorry.

if u still want dynamic light (maybe additionally to the corona) go here. I once wanted flickering torches, and jv made a nice script/map thing about it, which might be what u need!! Search for jv's post, it's the 5th...

Posted: Fri Oct 03, 2003 12:01 am
by Franaticus Satanii
Wacko, thanks for the corona.....and the info from jv_map.

Now does anyone know enough about scripting to make it grow and shrink?

By the way...I don't need this light to actually produce lighting...just to give the appearance of pulsing slowly.

I really wish I knew more so I didn't have to rely so much on everyone else...but I appreciate the help and patience with the newbie.

Again...I'm learning from all of you, thanks.

Posted: Fri Oct 03, 2003 1:40 am
by Bjarne BZR
For the light: once you made it with something like:

Code: Select all

$towerlight light 1 0 0 100 // red green blue lightradius
Place this method in the scritpt (after the main method):

Code: Select all

pulsate_light local.lighted_object local_corona_model:
	local.acending = 1
	local.new_radius = 100
	local.light_step = 10 // Play with this value

	local.loop_wait_time = 0.5 // Play with this value
	while(1) // forever
	{
		if (local.acending)
		{
			local.new_radius = local.new_radius + local.light_step
			if (local.new_radius > 400)
			{
				local.acending = 0
			}
		} else {
			local.new_radius = local.new_radius - local.light_step
			if (local.new_radius < 100)
			{
				local.acending = 1
			}
		}
		local.lighted_object lightRadius (local.new_radius)
		wait local.loop_wait_time
	}
end
and call it with the newly lit object like this in the main method:

Code: Select all

thread pulsate_light $towerlight
And for the corona: I think you can set the scale of the model like this (never actually tried it however...)

Code: Select all

$targetname scale 1.04
So if you add that to the code above you get:

Code: Select all

pulsate_light local.lighted_object local.corona_model:
	local.acending = 1

	local.new_radius = 100
	local.light_step = 10 // Play with this value

	local.new_corona_scale = 1.0
	local.corona_scale_step = 0.05 // Play with this value

	local.loop_wait_time = 0.5 // Play with this value

	while(1) // forever
	{
		if (local.acending)
		{
			local.new_radius = local.new_radius + local.light_step
			local.new_corona_scale = local.new_corona_scale + local.corona_scale_step
			if (local.new_radius > 400)
			{
				local.acending = 0
			}
		} else {
			local.new_radius = local.new_radius - local.light_step
			local.new_corona_scale = local.new_corona_scale - local.corona_scale_step
			if (local.new_radius < 100)
			{
				local.acending = 1
			}
		}
		local.lighted_object lightRadius (local.new_radius)
		local.corona_model scale local.new_corona_scale
		wait local.loop_wait_time
	}
end
After the code change the call looks like this in the main method:

Code: Select all

thread pulsate_light $towerlight $towercorona
Finally: If you don't understand the code, go to http://www.planetmedalofhonor.com/rjuka ... guage.html

(Disclaimer: The code above is written directly in the browser, there may be errors in the code.)

Posted: Fri Oct 03, 2003 8:57 pm
by wacko
it's probably easier this way (as u wanted no lighting but just a corona):

open the above redcorona.pk3

open scripts/corona_red.shader:
corona_red
{
qer_editorimage textures/sprites/corona_red.tga
deformVertexes lightglow
cull none
{
map textures/sprites/corona_red.tga
blendfunc add

tcMod stretch sin 1.5 0.75 1 0.1
}
}

add the red line

and take a look in mohaa.

the tcMod stretch comes with 5 parameters:
tcMod stretch <function> <base> <amplitude> <phase> <frequency>
u might want to change some of them to adjust the pulsing to your needs, so the Q3 Shader Manual(850kB doc file) is what u have to read (in your case especially 2.4.8 and 6.6.4
learn the whole doc and we can ask u next time :wink:

ps: forgot to say: if the whole corona is just too small, give it a higer scale value in mohradiant (select it, press n, change scale/1 to scale/what u like)


stop!!
sh**, i forgot something else :oops: :
i changed the texture as well... here's the new one. Unzip and put the tga in the pk3 where the old image was, sorry

Posted: Fri Oct 03, 2003 10:01 pm
by Bjarne BZR
Nice one Wacko :D

Posted: Fri Oct 03, 2003 11:28 pm
by wacko
:oops: :D thanks

Thanks All!!

Posted: Tue Oct 07, 2003 12:50 am
by Franaticus Satanii
Thank you guys. I appreciate all your efforts.

I apologise for the late response, but I was out of the country working on a jobsite.

I will attempt to add the above to my map and let you know the outcome.

Again, Thanks.

Pulsing Lights......Revisited

Posted: Wed Oct 08, 2003 8:55 pm
by Franaticus Satanii
If I wanted to use wacko's corona method...
open the above redcorona.pk3

open scripts/corona_red.shader:
corona_red
{
qer_editorimage textures/sprites/corona_red.tga
deformVertexes lightglow
cull none
{
map textures/sprites/corona_red.tga
blendfunc add
tcMod stretch sin 1.5 0.75 1 0.1
}
}
add the red line

and take a look in mohaa.
I know that the .shader goes into my scripts folder in my .pk3.....but....what gets added (if anything) to my script? How do I actually get this entity into my map? What defines the coord values and what defines the entity values itself?

Do I simply pick the red corona by right clicking for an insertion point?

I'm a little beyond my level of expertise here. Any help?

Thanks.

Posted: Wed Oct 08, 2003 9:12 pm
by wacko
sorry for having made such a mess...
okay, d/l the new newredcorona.pk3
it has included the edited shader and the new image

when u have that newredcorona.pk3 in your mohaa/main folder, u can in mohradiant select the red corona like the other coronas.
if u want to give it away with your map in your pk3, just put everything from newredcorona.pk3 in your pk3 file (in same directories).

Answering to your question, this means, you'd need everything in newredcorona.pk3 in your pk3 as well:
models/fx/unitsquare.tik
models/static/corona_red.tik
scripts/corona_red.shader
textures/sprites/corona_red.tga

including the directories
But: you won't need no scripting. Just use it like other coronas!
hope this helps

edited: made a new pk3 to avoid all the editing stuff and corrected this post