trigger music

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

Post Reply
egohavoc
Corporal
Posts: 36
Joined: Sun Jun 06, 2004 5:14 am

trigger music

Post 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)
Image
ego.havoc (embrace|my|hate)
personal site: retetched.com
clan site: easy-clan.com
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post 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.
Image
egohavoc
Corporal
Posts: 36
Joined: Sun Jun 06, 2004 5:14 am

Post by egohavoc »

thanks, these forums sure are quiet as of late
Image
ego.havoc (embrace|my|hate)
personal site: retetched.com
clan site: easy-clan.com
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post 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
egohavoc
Corporal
Posts: 36
Joined: Sun Jun 06, 2004 5:14 am

Post 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
Image
ego.havoc (embrace|my|hate)
personal site: retetched.com
clan site: easy-clan.com
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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)
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

Still has to be triggered some how.
Image
JUDGE
Corporal
Posts: 38
Joined: Thu Nov 25, 2004 9:46 pm
Location: UK
Contact:

Post 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
Image
Post Reply