AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   "Speak from Location" (https://forums.alliedmods.net/showthread.php?t=229280)

HLM 11-04-2013 15:12

"Speak from Location"
 
I am trying to simulate the !HEV_DEAD[0|1] from sentences.txt

PHP Code:

// medical
HEV_DEAD0 fvox/beep beepbeep beepbeepbeepflatline
HEV_DEAD1 fvox
/beep beepbeep beepbeepflatline 

In HLDM, when a user dies, this sound is emitted at the users location to all users around them, I am trying to simulate this in other games (using Ham_Killed) I have no idea on how to get this to work though, as emit_sound only supports 1 sample, and spk/speak/play only plays for one user.

Here is the code I have tried so far:
PHP Code:

public Hook_Death(id)
{
    
//
    
g_longjump[id] = false;
    new 
flatline[64]
    
format(flatlinecharsmax(flatline), "^"fvox/beep beepbeep beepbeep, %s^""random_num(01) ? "beep, flatline" "flatline");
    
emit_sound(idCHAN_AUTO flatline0.5ATTN_NORM0PITCH_NORM);
    
//client_cmd(id, flatline);
    //client_print(0, print_chat, flatline);


It is very obvious that this wont work as the sample is not a proper wav file and is actually several, my question is, how would I go about achieving this goal?

The closest thing I can think of is using a spk command on any players within X units of the target when they die, however this is not the same as emit_sound, is there any way to do what I am trying to do? (also, spk !HEV_DEAD0 gives an error that it doesnt exist in console, perhaps sentences.txt is not loaded in tfc?)

ConnorMcLeod 11-05-2013 00:33

Re: "Speak from Location"
 
You could try to emit each sound one by one.

Blizzard_87 11-05-2013 04:50

Re: "Speak from Location"
 
You could create a wav file with those sounds to make it a single file.

ConnorMcLeod 11-05-2013 12:13

Re: "Speak from Location"
 
Also, you can use spk, speak commands, emit_sound, SendAudio message with any sound that exists in %MODDIR/sound/sentences.txt, you just have to put a ! in front of sound key

examples :

PHP Code:

client_cmd(id"spk !HEV_DEAD"); 

PHP Code:

emit_sound(idCHAN_VOICE"!HEV_DEAD"VOL_NORMATTN_NORM0PITCH_NORM); 



All times are GMT -4. The time now is 16:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.