Go Back   Steam Users' Forums > Steam Tool Discussions > Source Art & Sound Design

Reply
 
Thread Tools Display Modes
Old 10-30-2007, 05:31 AM   #1
Grem
 
Guest
Posts: n/a
Problem with custom ingame sound.

I hope someone could help me, I have searched for a solution everywhere but I cant find one. I have started a mod and have encountered a problem , using the Faceposer software I have created a scene and have put it into my map. The model I am using for the scene is the barney model and it is started with a 'trigger_once' entity. Now when I load my map within my mod I have a problem, when I trigger the scene the gestures play correctly however the sound doesn't play and there is no lip-syncing. If I open the console once I have triggered the scene I see this:

SV_StartSound: airlock.wav not precached (0)

Now the name of the sound that I have made that doesn't seem to play or lip-sync is called 'airlock.wav' and is in the sound folder of my mod, so I was hoping you could tell me why it isn't 'precached' and how to make it work correctly.

Thanks,
 
Reply With Quote
Old 10-30-2007, 06:48 AM   #2
Superpiccolo
 
Join Date: Feb 2004
Reputation: 2
Posts: 273
You must have all your sound files that you are using within Face Poser placed in the appropriate script files for the game to load them up. They work in Faceposer, but for the game, you must add them to the following script files (within the "SourceMods\YOURMOD\scripts" folder):

npc_sounds_"NPC_NAME_HERE".txt

Copy an existing script file for an existing NPC and change/add/remove the appropriate settings. Everything after the commented out part you can edit:

"npcname.soundname"
{
"channel" "CHAN_VOICE"
"volume" "1"
"pitch" "PITCH_NORM"

"soundlevel" "SNDLVL_NORM"

"wave" "soundfile.wav"
}

List ^ that script in the script file:

"game_sounds_manifest.txt" (also within the "\SourceMods\YOURMOD\scripts" folder)

i.e. under the "// NPC Sounds" heading add:

npc_sounds_"NPC_NAME_HERE".txt

Also if you wish to have closed captions (text appear as the character/s speak) edit the file:

"closecaption_english.txt"

Under the dir "\SourceMods\YOURMOD\resource"

add lines in the same way as the pre existing ones are:

"npcname.soundname" "Blabh Blah Blah, this is where you should type out exactly what the sound file says. You can also add [Cough] and other onomatopoeia if you wish"

For ^ the captions to work properly you must make sure that each new caption entry name (npcname.soundname) is the EXACT same as the name in your NPC file.

For example.



"bobtalks.yelling_loud01"
{
"channel" "CHAN_VOICE"
"volume" "1"
"pitch" "PITCH_NORM"

"soundlevel" "SNDLVL_NORM"

"wave" "yelling.wav"
}

That is what is in the file "npc_sounds_bob.txt"

And this should be in the caption .txt file:

"bobtalks.yelling_loud01" "MY NAME IS BOB! I AM YELLING! [Very Loud Scream]"

Last edited by Superpiccolo: 10-30-2007 at 06:51 AM.
Superpiccolo is offline   Reply With Quote
Old 10-30-2007, 10:30 AM   #3
Grem
 
Guest
Posts: n/a
Thanks alot, ill try it and let you know if it works.

Last edited by Grem: 10-30-2007 at 11:03 AM.
  Reply With Quote
Old 10-30-2007, 01:36 PM   #4
Grem
 
Guest
Posts: n/a
It does work, but only if i run the steamappid as 220, if i run it as 215 (which is the default) then it doesnt work,( still comes up with 'not precashed') can anyone tell me why?

Because when i run it at 220 the sound works, but when i 'use' the npc a certain scene that should play doesnt work. However when i run it at 215 i still get the same precash problems and the sounds dont work but when i 'use' the npc the scene works (just the gestures though, no sounds).

This is so annoying.

Last edited by Grem: 10-30-2007 at 03:21 PM.
  Reply With Quote
Old 10-30-2007, 03:45 PM   #5
Penumbra
 
Guest
Posts: n/a
Inside the NPC's code (especially the Precache function) you can PrecacheScriptSound( <enter name from your sound script> );

Please make sure that inside your Spawn function, the Precache function is called. So what you get is the following code:
Code:
void CBob::Spawn( void )
{
	BaseClass::Spawn();
	
	Precache();
......
}

void CBob::Precache( void )
{
	// Precache the sound used for this class
	PrecacheScriptSound( "bobtalks.yelling_loud01" );
}
Hope this helps!!
  Reply With Quote
Old 10-30-2007, 03:57 PM   #6
Grem
 
Guest
Posts: n/a
Not really no, i dont understand any of what you just posted. Sorry.
Im new to the modding thing.
  Reply With Quote
Old 10-30-2007, 05:34 PM   #7
Penumbra
 
Guest
Posts: n/a
You haven't coded anything yet?
Euhm... Then I think you should stick to the other SteamAppID.

The problem lies that Barney is the one that needs to precache (load in) the sound file. This can (according to me) only be done via code, or via the mentioned SteamAppID (which automatically loads every sound script).

If you really want to use the 215, then I could lead you through it (I think ). Let me know what you want to do.
  Reply With Quote
Old 10-31-2007, 12:27 AM   #8
Grem
 
Guest
Posts: n/a
Smile

Other than the soundscripts (which didnt seem to work) I have no coding experience, no.
But I really need to use the 215 steamappid, could you tell me what i need to do. Thanks.

Also are you saying that it only the npc_barney that requires this coding? would it be easier to replace one of the npc_citizen models with the barney one, or would this be more complicated?

Overall
1. i need to be able to run it on steamappid 215
2. I need to be able to have a barney model that can perform .vcd's WITH SOUND.

Last edited by Grem: 10-31-2007 at 02:07 AM.
  Reply With Quote
Old 10-31-2007, 03:16 AM   #9
Superpiccolo
 
Join Date: Feb 2004
Reputation: 2
Posts: 273
^ Test that out and try using different NPC's. I'm pretty sure Barney is the only one with that odd behavior, but I'm not sure.
Superpiccolo is offline   Reply With Quote
Old 10-31-2007, 05:16 AM   #10
Grem
 
Guest
Posts: n/a
Question

Ok i'll try it with a couple of different npcs, i should be able to replace the model of a npc_citizen with a barney model right?

Damn im unlucky, i try using .vcd's for the first time and i pick the one npc that require coding.

Last edited by Grem: 10-31-2007 at 05:26 AM.
  Reply With Quote
Old 10-31-2007, 06:24 AM   #11
Penumbra
 
Guest
Posts: n/a
I think that every NPC needs coding. The .vcd file calls the model to say the line. Therefore the model needs to precache this wave. (I think) But it's not that hard:

First of all, get the free Microsoft Visual C++ 2005 Express from this website. Download and install.
Then follow instructions on this website. These are all the additional programs you need to download and install & link to Visual C++ 2005.
In the requirements part, download and install the files required, then locate your mod directory and go to the src dir: Open the Game_HL2-2005.sln!
Microsoft Visual C++ 2005 will start and you can do the second part of the requirements described in the previous website.

OK!!!! Now you can code!!! The hard part is over!!!

On the left, you'll see the solution explorer with client_hl2 & server_hl2.
Double-click server_hl2->Source Files->HL2 DLL->npc_Barney.cpp.
On line 52 you'll see this code:
Code:
virtual void Precache()
{
	// Prevents a warning
	SelectModel( );
	BaseClass::Precache();

	PrecacheScriptSound( "NPC_Barney.FootstepLeft" );
	PrecacheScriptSound( "NPC_Barney.FootstepRight" );
	PrecacheScriptSound( "NPC_Barney.Die" );

	PrecacheInstancedScene( "scenes/Expressions/BarneyIdle.vcd" );
	PrecacheInstancedScene( "scenes/Expressions/BarneyAlert.vcd" );
	PrecacheInstancedScene( "scenes/Expressions/BarneyCombat.vcd" );
}
Now add the sound script & maybe even the vcd scene.
To build the new code. Press F7 and wait a while for the output to reach:
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Start your mod, and I hope the problem is over!!
If there are any problems, please post them!!!
  Reply With Quote
Old 10-31-2007, 07:37 AM   #12
Grem
 
Guest
Posts: n/a
Thanks anyway, but if thats the amount of stuff i have to do just to add one .wav file then im not going to bother.

Sorry for wasting your time.
  Reply With Quote
Old 10-31-2007, 08:12 AM   #13
Penumbra
 
Guest
Posts: n/a
Well, maybe there is another way to precache your sound files, but I have no idea how.. Maybe someone else (or the internet) can help you.

Good luck!!
  Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Art & Sound Design


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -7. The time now is 04:47 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2014, All Rights Reserved.