activating sound doesnt work SOLVED


(]UBC[ McNite) #1

Ok here we go: I want to get a sound by activation (pretty much like the piano in venice for example).

So this is what I got:

entities for activation:
func_invisible_user targeted at a target_script_trigger (target phone1play)

script:

phone1
{
	trigger phone1play
	{
		wm_announce "^1phone1 activated"
		togglespeaker 	phone1sound
		wm_announce "^1togglespeaker was activated"		}
}

I get both wm_announces, so this means the trigger and trigger_script work fine.

Here is my sound entitity:

// entity 918
{
"scriptname" "phone1"
"volume" "140"
"origin" "-1272 -5168 1136"
"classname" "target_speaker"
"noise" "sounds/tr2r/phonering.wav"
"targetname" "phone1sound"
}

So what am I missing? In the LDR it tell you to use togglespeaker <targetname> which I clearly did.
And yes the sound works… at least it did in combination with a func_timer with random/wait set.


(kamikazee) #2

The fact you’re missing is: togglespeaker is for sound scripts only.
To let a target_speaker play, use

alertentity <speaker>

Slight difference, but hard to find the problem/solution. :wink:


(]UBC[ McNite) #3

sometimes mapping just fucking sucks


(]UBC[ McNite) #4

Ok… screw togglespeaker or alertentity… back to something that works for my lift-switches:

phone1
{
	spawn
	{
		wait 500
		accum 6 set 1
	}
	
	trigger phone1play
	{
		accum 		6 abort_if_not_equal 1
		accum 		6 set 2
		wm_announce "^1phone1 activated"
		playsound sound/movers/switches/switch_01.wav //sound/tr2r/phonering.wav
		wait 2000
		wm_announce "^1wait is done"		
		accum		6 set 1
		wm_announce "^1accum 6 is 1 again"		
	}
}

I even use the sounds that work for the switches… only problem now… i get all wm_announces, but no sounds :angry:


(MrLego) #5

Here is a small code snippet from one of my maps, it uses entities rather than scripting and does not utilize the built-in sound editor (mapname.sps file)

It makes a rooster crow when played.


// entity 65
{
"targetname" "rooster"
"noise" "sound/world/rooster.wav"
"origin" "240 1040 136"
"classname" "target_speaker"
}
// entity 66
{
"classname" "func_invisible_user"
"cursorhint" "hint_activate"
"target" "rooster"
// brush 0
{
( 304 992 192 ) ( 312 992 192 ) ( 312 992 80 ) common/trigger -32 -32 0 0.500000 0.500000 0 7 0
( 304 1088 192 ) ( 304 992 192 ) ( 304 992 80 ) common/trigger -48 -32 0 0.500000 0.500000 0 7 0
( 312 1088 192 ) ( 304 1088 192 ) ( 304 1088 80 ) common/trigger -32 -32 0 0.500000 0.500000 0 7 0
( 312 992 192 ) ( 312 1088 192 ) ( 312 1088 80 ) common/trigger -48 -32 0 0.500000 0.500000 0 7 0
( 312 992 192 ) ( 304 992 192 ) ( 304 1088 192 ) common/trigger 0 16 0 0.500000 0.500000 0 7 0
( 304 1088 80 ) ( 304 992 80 ) ( 312 992 80 ) common/trigger 0 16 0 0.500000 0.500000 0 7 0
}
}

(kamikazee) #6

That’s the good old Q3 way of doing things, but it should work.


(]UBC[ McNite) #7

works perfectly… thx a lot

dunno why my shit didnt work though :disgust:


(=PoW= Kernel 2.6.5) #8

Thread revival time.

I used the /editspeakers function to make a speaker.
The .wav is good and it’s set to loop.

Do I leave the .sps file in the sounds/maps folder or does it go somewhere else?

Even thought the speaker is set to loop forever - there is no sound.
Do I need to activate it in scripts or will it start playing when the map loads.

Does the code to activate it go in the .sps file or in the the main script file for the map?


(kamikazee) #9

I believe there’s a setting to set the speaker to “playing by default”.

EDIT:

Set it to “on” to let it loop and play by default.


(iwound) #10

Do I leave the .sps file in the sounds/maps folder
Yes

Do I need to activate it in scripts or will it start playing when the map loads.

Yes , no and maybe. I suggest in your main map script you first deactivate the sound then activate when needed then deactivate when finished with. In my map i left a looping sound in the sps file, in tests it was ok , on a server it would loop annoyingly. so unless you want to loop it all the time i suggest loop off then activate when needed.

Does the code to activate it go in the .sps file or in the the main script file for the map?
main script in maps folder.

Thread revival time.
yes it is! :bump:


(kamikazee) #11

So basicly: if you want it toggled, set it to “off” and turn it on through scripting at map start.
If it’s an ambient loop, set it to “on”.


(iwound) #12

yes, set to off at the start of script just to make sure it is off.
then

enablespeaker yoursoundname

to turn on

and …

disablespeaker   yoursoundname

to turn off

i used it for the klaxon and church bell.

loops used for ambient sound like wind


(=PoW= Kernel 2.6.5) #13

Thanks all.

It wasn’t working on my Windows computer at work.
Once I got home and did the same thing on my Linux PC, it worked. Go figure.

Once again, I appreciate the help.