Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Im looking for a cog...
Im looking for a cog...
2001-04-22, 4:16 AM #1
Im looking for a cog the plays a .wav file in certain sectors after pressing a switch.
My Site
2001-04-23, 9:14 AM #2
Hey Sammy, here's some "sound advice" :-) ... try this. You can modify it if you need more than 4 sectors or if you want the switch to be green (1 = on) instead of red (0 = off) when the sound is on. If you don't want the switch to turn the sound off again, then delete the second part of the activate code.

Code:
# Jedi Knight Cog Script
#
# prl_sectorsound.cog by Sylvicolus (23 April 2001)
#
# Sound triggered by activating switch.  Use 1 or 2 switches.
# Activate switch again to turn sound off.
# Sound is heard inside of 1 to 4 sectors.
# Choose volume and wav sound.
#
# This cog is not supported by LucasArts Entertainment Co.

                                                         
symbols
message		activate	

surface		switch0		linkid=1
surface		switch1		linkid=1
sector		sector0 	nolink
sector		sector1 	nolink
sector		sector2 	nolink
sector		sector3 	nolink

flex       	volume=1.0	
sound       	wav0=00AlarmLoop03.WAV

int		channel0	local
int		channel1	local
int		channel2	local
int		channel3	local
int 		soundstatus=0	local
flex		FadeOut=0.2	local

end

# ===============================================

code

startup:
	setwallcel(switch0, 1);
	if (switch1) setwallcel(switch1, 1);
	return;
## Sets the switch mat to the 2nd cell, which is green or off position. 


activate:
	if (soundstatus==0) 
	{
	   soundstatus=1;
	   setwallcel(switch0, 0);
	   if (switch1) setwallcel(switch1, 0);
	   channel0 = SectorSound(sector0, wav0, volume);
	   if (sector1) channel1 = SectorSound(sector1, wav0, volume);
	   if (sector2) channel2 = SectorSound(sector2, wav0, volume);
	   if (sector3) channel3 = SectorSound(sector3, wav0, volume);
	   return;
	}
	soundstatus=0;
 	setwallcel(switch0, 1);
	if (switch1) setwallcel(switch1, 1);
	StopSound(channel0,FadeOut);
	if (sector1) StopSound(channel1,FadeOut);
	if (sector2) StopSound(channel2,FadeOut);
	if (sector3) StopSound(channel3,FadeOut);
	return;

end


------------------
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2001-04-23, 9:35 AM #3
Thanks alot!
My Site

↑ Up to the top!