Hello everybody! :D One question, how can I stop playLocalSound?
Printable View
Hello everybody! :D One question, how can I stop playLocalSound?
One more question: how can i stop ambientPlay? :D AmbientStop() doesnt work in multiplayer.
Ok, works. Special thanks to IzNoGoD for help.
explanation:
1. Download the attachment and put "stop.wav" and "stop_sound.csv" to your mod.
2. Open stop_sound.csv and change the channel in which the sound has stopped work. (position 12)
Attachment 115
3. Open your "yoursound.csv" sound and change your channel name on the same like in "stop_sound.csv".
exemplary ".csv" with my sound, which I need to stop:
Attachment 116
4. Where you want to stop the sound give it:
self PlayLocalSound("stop");
exemplary:
self PlayLocalSound("music"); wait 5; self PlayLocalSound("stop");
remember that your. "csv" and "stop_sound.csv" must have the same name channels to stop the music.
Attachment 118
//Edit: easier without download new .wav
add new line to ur .csv:
stop,,2,null.wav,0.8,0.8,,,,,,announcer,,,,,,,,,,, ,,
and only change name channel. :)
result in my mod :) http://beta.xfire.com/video/5daecc
So if a local sound stops other local sound, what about playing them in the same time without stopping?
Use the auto-channel for one of them. Seemed to work with the cod4mod.
Tried auto, and the sound did not play at all
hi, you can stop the music by this way: PlaySound("null"); you can find the null.wav file in iw_04/sound folder. i think this works for cod2, and MusicStop( <time> ); in cod4(i dont know, maybe works for cod2 too)
Can I ask a question? What's the difference between PlaySound and PlayLocalSound?
PlaySound is global, and PlayLocalSound is only for players you defined (e.g, self or attacker) I think
But you could also do (if I am right) this:
Code:soundfunc()
{
trig = getent("trig_sound","targetname");
while(1)
{
trig waittill("trigger",player);
player playsound("sound");
}
}
So the sound is only played to the player... Don't know the difference between them, but thanks for the answer anyways :)
PlaySound = Play sound at position/origin (everyone near it can hear).
PlayLocalSound = Play sound only for player
AmbientPlay = Play on the whole map (It bugs for new joining players, so would be better to use playLocalSound via for() loop)
Ahhh Understood already :]
I thought that the sound was played to the player but now I understand the difference^^
Thank you all!
Ambient? then use AmbientStop(fadeout time); to stop it
That doesnt work. I dont get any error, but the ambient just keeps playing.
Code:musicoff()
{
while(1)
{
if(getCvar("scr_music") == "1")
{
AmbientStop(0);
AmbientStop("zom_scary");
}
wait 1;
}
}
I stepped over a problem today: Stopping a sound works with playLocalSound, but not with playSound. This is annoying, as sounds might overlap in some scenarios. The soundalias was:
Removing the entity, which played the sound, did not help, neither did moving the entity away (the sound stays at the location where it has been played).Code:name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage
test_local,,startsound.mp3,1,1,,,,1000000,,local,streamed,1
test_stop_local,,stopsound.mp3,1,1,,,,1000000,,local,streamed,1
Any known solutions? Playing the desired sound by a playLocalSound loop over all players it not nice, as the distance<->volume curve gets lost.
Maybe I just forgot something ^^
Found a solution now: playLoopSound and stopLoopSound
Code:name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage
test,,sound.mp3,1,1,,,,1000,2000,auto,streamed,,looping
Please note:Code:ent = spawn("script_model", origin);
ent playLoopSound("test"); //ent emits the sound, the distance values from the soundalias are applied :)
wait 1;
ent playLoopSound("test");
- I used auto as channel, I did not test playLoopSound with other channels
- You can play only one loopSound per entity at a time, calling playLoopSound again will stop the previously played sound -> spawn another "script_model" at the same origin to play two interruptable sounds at the same position