Contents of STORM.ZIP

	STORM.TXT
	STORM.MAP
	STORM.RMF
	STORM.BSP


'Twas a dark and stormy night... and Murderous thought "didn't Hipnotic do dat?"


This lesson shows you how to make those cool looking storms from the Hipnotic mission pack, 
Scourge of Armagon.

It has flashes of lightning and crescendos of thunder, and plays different animation 
sequences of them randomly.

I don't know if this is the EXACT method used by Hipnotic, but it works.


NOTE: This simply cannot be done in standard Quake (prove me wrong if you like!). 
You require the Hipnotic mission pack progs.dat. If you want to make your own progs.dat for
your level, you should include the following Hipnotic qcs: hipdefs.qc (variables), 
hipcount.qc (counters), hipmisc.qc (thunder sounds).

Try www.planetquake.com/qref for help on QuakeC.


These are the entities you will need:

	func_counter 	(just the one, this is the entity that controls the entire storm)
	func_oncount	(as many different sequences of storm as you want)
	trigger_relay 	(a variable amount per sequence)
	play_sound_triggered	(as many locations as you want thunder OR 
				once if you want thunder on the ENTIRE level -see below-)
		(you CAN use the random thunder ones, if you prefer, I LIKE control :-)
	light		(as many as it takes to light your areas with lightning)

In a nutshell, here's how it works. The func_counter constantly and randomly chooses to 
target one of the func_oncount. The func_oncount selected (I call each one a "sequence") 
triggers a number of trigger_relay which themselves turn on and off the bright lights, and 
plays the thunder. Simple!

{People who know their cookies: whilst it's not absolutely necessary to use trigger_relay, 
it keeps things more manageable, especially for newbies, and you only increase the number of
used entities by a very few.}

Our example uses :two func_counter, 4 func_oncount, 18 trigger_relay (!!) 
(5 for the first sequence, 6 for the second sequence, 7 for the third sequence, 2 for a 
serpate sequence), 2 play_sound_triggered (it will do the entire level!!), 
2 triggered lights (plus 3 in the building), and some monsters and weapons and ammo just 
for fun :-) and to show you how they light (ammo boxes do not light properly). Of course, 
the stuff in (brackets) below is just for you to read ... don't try and put it into your 
entities!!!


func_counter
	(spawnflags to set ON, leave all others OFF)
	loop 		(otherwise you only get to see each frame once!)	
	random 		(keeps things looking dynamic, but is optional)
	start_on  	(unless you want your storms to start after some event)

	count	3 	(the number of sequences/number of func_oncount)
			(in our example:
				1: slow flash slow flash with thunder sounds on each flash
				2: slow flash with thunder sound and two quick silent flashes
				3: a quick flash with thunder then a slow flash with thunder
				that "jumps" on top of the first one)
	wait	4	(the delay in seconds before starting each "sequence")
	delay	0	(this is not a triggered func_counter, so it does not need a value)
	target 	focstorm (the name of the func_oncount you're hitting

func_counter		(this one act independntly of the main noise/light makers, just to 
			give some more light)
	(spawnflags to set ON, leave all others OFF)
	loop
	start_on

	count	1	(a single flash)
	wait	1.8	(a different value to above to make things less predictable)
	delay	0	(this is not a triggered func_counter, so it does not need a value)
	target 	focst2 	(the name of the func_oncount you're hitting
	

func_oncount
	targetname 	focstorm
	target 		storm1
	delay		0	(we will make all our delays in the trigger_relay fields)
	count 		1

func_oncount
	targetname 	focstorm
	target 		storm2
	delay		0
	count 		2

func_oncount
	targetname 	focstorm
	target 		storm3
	delay		0
	count 		3

func_oncount			(this is the independed extra light generator).
	targetname 	focst2
	target 		st5
	delay		0
	count 		1


(FIRST SEQUENCE : slow flash slow flash with thunder sounds on each flash )

(Remember, you have 4 seconds to do everything in -- that was set in the func_counter delay
...Also, the delay you see here do not add on to each other, the func_oncount triggers each 
one simultaneously, so the delay of 0.5 is half a second after the func_oncount was 
triggered and the delay 2 is two seconds after the func_oncount was triggered, so be careful
not to accidentally overlap stuff
...Finally, make sure you have an EVEN number of targets to the LIGHT or you will leave the 
LIGHT on! and you cannot have more than FOUR dynamic (switchable) lights on any single 
brush face).

trigger_relay
	targetname 	storm1
	target		slite		(this is the name of the LIGHT)
	delay		0

trigger_relay
	targetname 	storm1
	target		sthund		(this is the name of the THUNDER)
	delay		0

trigger_relay
	targetname 	storm1
	target		slite
	delay		0.5		(turns off after half a second)

trigger_relay
	targetname 	storm1
	target		slite
	delay		2		(a good pause after the first flash)

trigger_relay
	targetname 	storm1
	target		sthund		(play the THUNDER a second time)
	delay		2

trigger_relay
	targetname 	storm1
	target		slite
	delay		2.5


(SECOND SEQUENCE : slow flash with thunder sound and two quick silent flashes)

trigger_relay
	targetname 	storm2
	target		slite
	delay		1		(give this one a slight initial pause)

trigger_relay
	targetname 	storm2
	target		slite
	delay		1.75		(this one lasts 3/4 of a second)

trigger_relay
	targetname 	storm1
	target		sthund
	delay		1		(to play with the initial flash)

trigger_relay
	targetname 	storm2
	target		slite
	delay		2.5		(these ones are silent)

trigger_relay
	targetname 	storm2
	target		slite
	delay		2.7		(and very quick)

trigger_relay
	targetname 	storm2
	target		slite
	delay		3.5

trigger_relay
	targetname 	storm2
	target		slite
	delay		3.7

(THIRD SEQUENCE : a quick flash with thunder then a slow flash with thunder that "jumps" 
on top of the first one)

trigger_relay
	targetname 	storm3
	target		slite
	delay		0.5

trigger_relay
	targetname 	storm3
	target		slite
	delay		0.8

trigger_relay
	targetname 	storm3
	target		sthund
	delay		0.5		(to play with the initial flash)

trigger_relay
	targetname 	storm3
	target		slite
	delay		1		(second flash)

trigger_relay
	targetname 	storm3
	target		slite
	delay		1.75		(slightly longer)

trigger_relay
	targetname 	storm3
	target		sthund
	delay		1		(this one will cause the thunder to play again even 
					tho it hasn't finished the play from 0.5 seconds.. 
					makes for a cool sound effect)



(INDEPENDENT SEQUENCE : a double-tap flash for more light)

trigger_relay
	targetname 	st5
	target		slite
	delay		0

trigger_relay
	targetname 	st5
	target		slite
	delay		0.5



(NOW we're onto the LIGHT and THUNDER)

light
	START_OFF	(you should set this spawnflag, Worldcraft calls it "initially dark")
	
	targetname	slite
	light_lev	1000		(varies but should be BRIGHT!)

light
	START_OFF
	
	targetname	slite
	light_lev	700		(enough for a confined space)



play_sound_triggered 
	(do NOT NOT NOT set ANY spawnflags on this)

	volume		1	(unless it's thru a window or at a distance, then maybe less)
	noise		"ambience/thunder1.wav"	(unless you got a better one?)
	impulse		0		(default)
	speed		-1		(no attenuation)
	targetname	sthund

(SPEED is important)

(If SPEED is set to -1 it will play on the ENTIRE level at the volume, this is good if your 
whole level is out of doors like An Old, Old, Evil's map "The Graveyard Trail". So you only 
need ONE entity, anywhere inside the map)

(If your level just has storms thru a portal/window like the Hipnotics or An Old, Old, Evil's
map "The Church of Suffering" then you should set multiple play_sound_triggered, each where 
you want a noise to be heard, and use SPEED 1 for normal attenuation)

(there are 2 of these on the level, so the sound isn't from just one speaker).



SUPER MINI (SPICE GIRL?) FAQ

Q : Why bother having 2 lights in your level? You could have made that stained glass windows
a misc_illusionary (or other entity) and allow the outside lightning to come thru it!
A : Two reasons. It would not have brightened the window on the INSIDE, only the outside; 
and VIS does NOT take ANY entities into account when making it's calculations (because 
entities do NOT block VIS) and this will help reduce the fps (not an issue here, but it is 
on "proper" maps).

Q : Why not use the random thunders as in the Hipmisc.qc?
A : Because I wanted to control when the thunder starts. Random works well too.

Q : Your ligtning looks pretty random to me. You could have done that with a lot fewer
entities.
A : Of course. Try removing one of the func_counters to start seeing some order. I did
both to show some options.

Q : This is not realistic!! In a storm, the flash happens first, then the thunder, depending 
on how far away the storm is.
A : PENDANT! Your options are to use the random thunders (not much better, as storms are 
supposed to have the timing between light and noise change incrementally, not randomly), or 
to do something like this:

On the trigger_relay, make a longish delay between the flash and the sound, and make several
sets (different names) of them with the gap getting narrower until they happen at the same 
time (between 4 and 10 sets of trigger_relay, I'd say).

Set the func_counter spawnflag "random" OFF, and set the COUNT to twice or four times as 
many sets of trigger_relay.

Have the func_oncount low numbers call the big-gap relays, maybe have the next one in the 
sequence call the same trigger_relay to stop the storm "approaching" too quickly, and call 
them until you get to the end. You should make enough func_oncount that you can call the 
trigger_relay in "reverse", so the storm goes away. Assuming LOOP was set, the storm will 
then approach again.

Remember, the difference in seconds (divided by 5) between the flash and the boom is the 
number of "miles" the storm is away.

Or you can make a series of switched func_counts (for 5 miles away, 4 miles away) or BETTER 
STILL hard-code a new entity in QuakeC.


AND BESIDES!!!



Who is to say that light and sound move at different speeds in the Netherworlds?????  ;)





This level is a promotion for An Old, Old, Evil : The Quake Mission Pack #3 (unofficial). 
The web in in the process of re-design, I will bomb the newgroups with the URL. 



You can use this tutorial/example as you wish, put on your site, and distribute as you wish, 
but please keep this text file attached and intact, and EMAIL me if you use it or like it
or just want advice on it, or just want to speak to me! (people like me THRIVE on feedback!!)

Murderous
murderous@btinternet.com


