Page 1 of 1

trigger music

Posted: Wed Sep 28, 2005 7:13 pm
by egohavoc
In one of my maps I have a "radio" that plays music. After awhile the song gets annoying.

So, I was wondering.. how do you add a play/stop trigger? (preferably without having to change much of the scripting)

Posted: Wed Sep 28, 2005 9:35 pm
by Green Beret
If the sound is a script _sumtin
give it a targetname and have the trigger setthread, then
$targetname remove
in the script.

Posted: Thu Sep 29, 2005 3:21 pm
by egohavoc
thanks, these forums sure are quiet as of late

Posted: Thu Sep 29, 2005 4:01 pm
by At0miC
You can also try something like this,

radio_on:

$speaker loopsound (a sound)
$trigger waittill trigger
thread radio_off

end

radio_off:

$speaker stoploopsound (a sound)
$trigger waittill trigger
thread radio_on

end

Posted: Sat Oct 01, 2005 12:45 am
by egohavoc
This is my existing code for the sound:

Code: Select all

local.master = spawn ScriptMaster

local.master aliascache snd_besideyouintime sound/bestest2_music/besideyouintime.mp3 soundparms 

1.0 0.1 1.0 0.0 300 2500 auto loaded maps "obj dm"

level waittill spawn

$musicspeaker loopsound snd_besideyouintime

end
Should the new one be like this?:

Code: Select all

local.master = spawn ScriptMaster

local.master aliascache snd_besideyouintime sound/bestest2_music/besideyouintime.mp3 soundparms 

1.0 0.1 1.0 0.0 300 2500 auto loaded maps "obj dm"

level waittill spawn

radio_on:

$speaker loopsound (a sound)
$trigger waittill trigger
thread radio_off

end 

radio_off:

$speaker stoploopsound (a sound)
$trigger waittill trigger
thread radio_on

end

Posted: Sat Oct 01, 2005 1:29 am
by Master-Of-Fungus-Foo-D
egohavoc wrote:This is my existing code for the sound:

Code: Select all

local.master = spawn ScriptMaster

local.master aliascache snd_besideyouintime sound/bestest2_music/besideyouintime.mp3 soundparms 

1.0 0.1 1.0 0.0 300 2500 auto loaded maps "obj dm"

level waittill spawn

$musicspeaker loopsound snd_besideyouintime

end
Should the new one be like this?:

Code: Select all

local.master = spawn ScriptMaster

local.master aliascache snd_besideyouintime sound/bestest2_music/besideyouintime.mp3 soundparms 

1.0 0.1 1.0 0.0 300 2500 auto loaded maps "obj dm"

level waittill spawn

radio_on:

$speaker loopsound (a sound)
$trigger waittill trigger
thread radio_off

end 

radio_off:

$speaker stoploopsound (a sound)
$trigger waittill trigger
thread radio_on

end

no need for any of that ;)

take a look at this:

Code: Select all

 local.master aliascache [aliasname] [soundfile] soundparms [basevolume] [randvolume] [basepitch] [randpitch] [mindist] [maxdist] [channel] loaded maps "obj dm"
[mindist] [maxdist]

just edit max distance to the distance that you want the sound to be played (for exmple, if you wanted ti to be played in a 128x128x128 room, youd set it to 128 ;)) and v?ola, itll only be heard in the radius of the max distance! (the way you have it now, is itll be played until the player is units feet away)

Posted: Sat Oct 01, 2005 1:48 am
by Green Beret
Still has to be triggered some how.

Posted: Tue Oct 04, 2005 7:51 pm
by JUDGE
try it on a timer then it can be re triggered later on

radioroom:

$rad_trigger1 waittill trigger
$rad_speaker loopsound musicpain
wait 100
$range_speaker stoploopsound

end