Jump to content

  • Log in with Facebook Log in with Twitter Log In with Steam Log In with Google Sign In
  • Create Account

Tutorial info Visit support topic

  • Added on: Oct 16 2010 08:50 AM
  • Date Updated: Mar 17 2011 06:34 AM
  • Views: 2590

Creating a vsay .pk3

How to create your own .pk3 from scratch

Posted by Saizou on Oct 16 2010 08:50 AM
Before we start, I'd like to point out that this is my first tutorial and it has been put together in matter of hours, so please point out anything that I have missed or anything you would like to have covered in more details. Also English is not my primary language so point out any weird sentence constructions or anything ambiguous that you may find. I have removed some outdated and conflicting stuff regarding audio processing so it should be good now.
This tutorial doesn't cover how to put it on a server or ensure that players playing on your server have it, as I don't know how it's done.
Most of these stuff I have figured out by opening the F|A soundpack that is used on servers. It provides great insight how the whole thing is organized and done. I recommend exploring it after you have finished reading the tutorial, so you see how the actual working scripts look like.

First off, you will need 3 small programs to use:
-most important one - Pakscape, which will enable you to create and open already existing .pk3 files (which are similar to .zip files), you can get it here.
-an audio editing software: Baska showed me a program that has everything you need for editing .wavs: Wavosaur, it's simple to use and you should have no problems using it. You can get it here.
-and a text editor where you will be able to edit scripts, I used Notepad++ (also great for editing your configs), you can get it here.
Of course the last 2 are just one of many that can be used, but those 2 are free and should do the job.
A little update done by Kai which simplifies the process even more, you can do the third step with a tool you feel comfortable with:

Instead of using Pakscape, you could also just zip the folders using your favorite ZIP-Tool and rename the outcoming .zip file to .pk3 afterwards.

First step in creating vsays is to get the material you want, basically you need to get your hands on sounds you want to be able to play in .wav format.
Wavosaur here comes in handy as you can convert any part of your favourite .mp3 song (or anything you wish to convert) in .wav format just by selecting which part of the song you want (click and drag, your pointer should look somewhat like capital I)and then go File->Save selection as...
1. pic: Selecting the desired part.

2. pic: Saving the file.

When you save it give it a name that you'll use to identify that .wav in scripts. Easy as that. I have named the test clip I made ffxtest.wav, you will see that name later show up in scripts. Also note that size matters here so long clips will result in large .pk3 file which is a pain to download and distribute if you want to use it on server. I'm not sure if there's a limit how large can one .wav file be, but due to before mentioned reason you most likely won't have to find out. Mostly the .wav files that you'll be able to get your hands on will be 441000Hz sampling rate, and they will be rather large but after conversion to 16000Hz they should be smaller.
VERY, VERY IMPORTANT NOTE: For the vsays to work all files must be at 16000Hz sampling rate (Process->Resample), 8 bit depth (Process->Bit depth converter) and they must be mono (Process->Convert to mono->Mix all channels). If you have a stereo .wav just merge the tracks to get a mono one, as described in the previous sentence.

3.pic: Process menu and the tools you'll need, note the sampling rate, bit depth and mono/stereo info about the clip just under the window with the sound graph

It might be a good idea to organize those .wav files into subfolders so you can avoid the mess. I put this newly created .wav into music folder which is in sound folder. You will see how this impacts the scripts later. Now create a folder named sound and put all the .wav files into it (or folders if you have organized them).

Second step is to create scripts separately for Allied and Axis side as they don't use the same basic vsays. The script you will add however is the same for both sides so once you finish creating that part you just have to copy it to the script for the other side. You will also have to create the menu layout so you will see all the vsays categories when you press "v" ingame so you can actually play those sounds. I have attached the both Allies and Axis stock vsays so you don't have to go through your pak0.pk3 to find them (IMPORTANT: never mess with .pk3 that come with stock ET as most likely PB will recognize it as a hack, make a copy them somewhere else and then explore them with Pakscape, be sure not to accidentally switch them). And don't rename those files I attached, just change their content but not their name or else the whole .pk3 won't work.

Attached File  scripts.zip   6.32KB   187 downloads

So here goes:
Open one of those scripts (wm_allies_chat.voice or wm_axis_chat.voice, let's open the Allied one, though it doesn't matter) and you'll recognize the name of the vsays organized into groups (wm_quickstatements, wm_quickrequests, etc). The lines that start with // are comments and do not effect the script itself, they are more like a guide and help you see more easily where each vsay will go later in the menu. Let's take the first one for example, Path Cleared:
	sound/chat/allies/11a.wav	"Path cleared."
	sound/chat/allies/11b.wav	"Path cleared."
You see the name PathCleared is followed by the {} brackets, the contents inside these brackets determine file paths to sounds to be played and text to be displayed. You will that when you play this vsay one of 2 sound files will be chosen randomly and played with accompanying text. For better illustration find the Cheer vsay in the script and you'll see how it differs. Now that we know this we can add our own vsays. Add something like:
//my vsays//
so you or anyone else that will later look at it know where your vsays start. Then using that .wav I created before we would add lines like this (very important: note the path to the .wav file, if you have used subfolders in the sound folders to keep yourself organized, you MUST put the full path to the file when you are defining a vsay):
	sound/music/ffxtest.wav		"Music playing."
So when I would select my vsay it would play the clip and text would display "Music playing".
Note that we have only one line so it will always play that one sound clip when we choose that vsay. Again if there are more lines, only one sound clip will be played which was chosen randomly by the game. Define all the other vsays like we did this one and when you are finished copy the whole added part to the other script (in this case we would copy to the Axis script as we opened the Allied one, remember?). You can also add and remove lines from already existing vsays, so you can add more lines to Cheer menu for example for more sounds to be chosen from. Now that you have edited both scripts put them in a folder called scripts and put that folder somewhere near the sounds folder that created before (it doesn't have to be near but this is to keep yourself organized). We have the .wav files, we have the scripts and now we have to create a menu (or modify the stock one). I have attached it to the tutorial so you don't have to dig it up (that 3rd file in the attached .zip called wm_quickmessagealt.menu). Now open the attached file, ignore the first 83 lines (they actually define what the other part of the file does) and you should recognize the vsay menu that pops up when you press "v":
QM_MENU_START( "wm_quickmessageAlt" )

	QM_MENU_ITEM_TEAM( 	"1. Statements", 	close wm_quickmessageAlt; 	open wm_quickstatements_alt, 	"1", 0 )
	QM_MENU_ITEM_TEAM( 	"2. Requests", 		close wm_quickmessageAlt; 	open wm_quickrequests_alt, 	"2", 1 )
	QM_MENU_ITEM_TEAM( 	"3. Commands", 		close wm_quickmessageAlt; 	open wm_quickcommand_alt, 	"3", 2 )
	QM_MENU_ITEM_TEAM( 	"4. Talk",		close wm_quickmessageAlt; 	open wm_quickmisc_alt, 		"4", 3 )
	QM_MENU_ITEM( 		"5. Global",	 	close wm_quickmessageAlt; 	open wm_quickglobal_alt, 	"5", 4 )
	QM_MENU_ITEM_TEAM( 	"6. Function", 		exec "wm_sayPlayerClass"; 	close wm_quickmessageAlt,	"6", 5 )
	QM_MENU_ITEM_TEAM( 	"7. Objectives", 	close wm_quickmessageAlt; 	open wm_quickobjectives_alt, 	"7", 6 )

So now you recognize all those menu names as you have seen them before in the scripts, in scripts they were a guide which vsay will be selected via which menu so if you compare the menus and organization in the scripts you'll see they are the same. Ok, now to analyze what this bunch of lines mean.
QM_MENU_START( "wm_quickmessageAlt") is the first line when you are defining a new menu, the wm_quickmessageAlt is the name of the menu we are defining, and which is used to identify which menu to open and close). This being the stock menu we see that the menu when we press "v" is named wm_quickmessageAlt. Now note the last line, QM_MENU_END is the last line in defining a menu and don't forget to put it when you are creating your own menu. Those lines in between determine the contents on the menu. You see they are defined with those QM_MENU_ITEM_TEAM and QM_MENU_ITEM lines with parameters in between. So what does each parameter mean?
Let's take the first line
QM_MENU_ITEM_TEAM( 	"1. Statements", 	close wm_quickmessageAlt; 	open wm_quickstatements_alt, 	"1", 0 )
"1.Statements" is the text which will be displayed in the menu, close wm_quickmessageAlt and open wm_quickstatements_alt are actions which will be performed when that menu option is triggered, you can see it will close the main vsay menu and open the statements menu. "1" is the key with which that option will be selected, and 0 is the position on which that menu option will be located (note that the first line has a menu position of 0 and not 1). I don't know the difference between QM_MENU_ITEM_TEAM and QM_MENU_ITEM as they do the same thing but they are probably named differently to help keep stuff organized. Note that all menu options use the QM_MENU_ITEM_TEAM except for fifth line "5. Global" which is played in global chat as we know from experience.

Now let's take a look at global menu:
QM_MENU_START( "wm_quickglobal_alt" )

	QM_MENU_ITEM( "1. Yes",				exec "VoiceChat Affirmative"; 	        close wm_quickglobal_alt, 	"1", 0 )
	QM_MENU_ITEM( "2. No",				exec "VoiceChat Negative"; 	        close wm_quickglobal_alt, 	"2", 1 )
	QM_MENU_ITEM( "3. Enemy Weak",		        exec "VoiceChat EnemyWeak";		close wm_quickglobal_alt, 	"3", 2 )
	QM_MENU_ITEM( "4. Hi",				exec "VoiceChat Hi"; 			close wm_quickglobal_alt, 	"4", 3 )
	QM_MENU_ITEM( "5. Bye",				exec "VoiceChat Bye"; 			close wm_quickglobal_alt, 	"5", 4 )
	QM_MENU_ITEM( "6. Great Shot",		        exec "VoiceChat GreatShot"; 	        close wm_quickglobal_alt, 	"6", 5 )
	QM_MENU_ITEM( "7. Cheer",			exec "VoiceChat Cheer"; 		close wm_quickglobal_alt, 	"7", 6 )
	QM_MENU_ITEM( "8. More Globals",	        close wm_quickglobal_alt;		open wm_quickglobal2_alt, 	"8", 7 )

Now you can see that save for different choices and names that the only difference is in actions that it performs. Global menu actions consisted of closing itself and opening a new menu, while a menu like Global actually plays the very vsay and closes itself. Also note the name of the menu in the first line and compare it to the previous menu, you'll see that it is called by selecting the fith line in the first menu. Let's take the frist line again:
QM_MENU_ITEM( "1. Yes",				exec "VoiceChat Affirmative"; 	close wm_quickglobal_alt, 	"1", 0 )
"1. Yes" is the text that will be displayed, exec "VoiceChat Affirmative"; close wm_quickglobal_alt are the actions that will be performed. exec "VoiceChat Affirmative" is the thing that plays the very vsay. Affirmative is the name of the vsay which you can find in one of the scripts. Also note that exec "VoiceChat Affirmative" would play in global chat while exec "VoiceTeamChat Affirmative" would play in team chat. Again "1" is the key which selects the menu option and 0 is the position of the line in our menu. Now it's time to modifiy the vsay menu that opens first and add our own. The first menu should look something like this:
QM_MENU_START( "wm_quickmessageAlt" )

	QM_MENU_ITEM_TEAM( 	"1. Statements", 	close wm_quickmessageAlt; 	open wm_quickstatements_alt, 	"1", 0 )
	QM_MENU_ITEM_TEAM( 	"2. Requests", 		close wm_quickmessageAlt; 	open wm_quickrequests_alt, 	"2", 1 )
	QM_MENU_ITEM_TEAM( 	"3. Commands", 		close wm_quickmessageAlt; 	open wm_quickcommand_alt, 	"3", 2 )
	QM_MENU_ITEM_TEAM( 	"4. Talk",		close wm_quickmessageAlt; 	open wm_quickmisc_alt, 		"4", 3 )
	QM_MENU_ITEM( 		"5. Global",	 	close wm_quickmessageAlt; 	open wm_quickglobal_alt, 	"5", 4 )
	QM_MENU_ITEM_TEAM( 	"6. Function", 		exec "wm_sayPlayerClass"; 	close wm_quickmessageAlt,	"6", 5 )
	QM_MENU_ITEM_TEAM( 	"7. Objectives", 	close wm_quickmessageAlt; 	open wm_quickobjectives_alt, 	"7", 6 )
	QM_MENU_ITEM( 		"8. My vsays",	 	close wm_quickmessageAlt; 	open wm_myvsays, 		"8", 7 )

Then our new menu would look like:
QM_MENU_START( "wm_myvsays" )

	QM_MENU_ITEM( "1. A song in global",				exec "VoiceChat song1"; 	close wm_myvsays, 	"1", 0 )
	QM_MENU_ITEM( "2. A song in team",				exec "VoiceTeamChat song1"; 	close wm_myvsays, 	"2", 1 )
There are 2 vsays which play the same thing but one plays it in global and on in team chat just for demonstration.
And that's it. Save the file and put it in the ui folder which you can put next to the sound and scripts folders.

Third step and the last step is fairly easy, you only have to pack it togheter using Pakscape into single .pk3 that you can distribute around.
So just open Pakscape, go File->New and just drag and drop the 3 folders you made: scripts, sound and ui folder. You can also add a short readme.txt file where you can put comments, remarks, notes or thoughts that you wish to pass on to the users of the .pk3. Then just go File->Save as and you have your own .pk3 file. You can see how it should look like in the end if you did it right.

4. pic: How it looks in the end.

So after you armed with knowledge to make them, have fun creating your soundpacks.
Thanks for reading :)