furrycat's (incomplete) advanced chat HOWTO
Nine custom chats not enough for you? Do you feel limited by the choice of dialogues available in certain game situations? Don't panic! I have the solution. In this guide I will explain how to map arbitrary custom chat sounds (together with arbitrary accompanying text) to your in-game menus!
Disclaimer
Before reading on please be advised of a few things. Firstly I'm going to assume that you've already read my custom chat guide or that you have already taught yourself the concepts presented in it. Secondly please note that I'm just going to present a step-by-step guide to getting a new chat menu system. It is my hope and expectation that when you follow the instructions something in your brain will click and you'll say "aha! I see what's going on!" at which point you won't need my advice any longer. I'm sorry if I don't explain what I'm doing. Just read on and you should figure it out for yourself. That said, feel free to mail me if you have any queries...
One very important thing: in a few places I'll refer to SWAT3 version 1.7 (notably when I say to open the 17.res file). If a newer release of SWAT3 is available when you read this and if I've forgotten to update this page, remember to change the filename to suit!
Step 1: extract the necessary files
We're going to need to override game files, which means grabbing them from the .res archives. Load up Winzip and open swatdata1.res in your SWAT3 directory.
Find the following files in the archive:
swatdata1\data\global\UIDeathmatch.dat swatdata1\data\global\UIOfficerBlue.dat swatdata1\data\global\UIOfficerLead.dat swatdata1\data\global\UIOfficerRed.dat swatdata1\data\global\dialog.dat
Extract these files into your SWAT3 directory (make sure use folder names is unchecked in the Winzip extract dialogue). Now open updates\17.res and extract strings.dat. You'll need these files later. Just remember, make sure they're saved into your SWAT3 directory!
Step 2: a first look at UIOfficerLead.dat
Open up UIOfficerLead.dat in your favourite text editor. Scroll down several lines until you come to a section labelled "Command Menu Table". This describes the menus you see on screen during a game. Skip past the lines starting with // - these are comments.
Eventually you'll come across the following lines:
1 1 2 ui_element Default TEAM_NAME Mode All All 2 3 0 3 4 1 2 2 ui_red Default TEAM_NAME Mode Red Red 0 3 0 3 5 1 3 2 ui_blue Default TEAM_NAME Mode Blue Blue 1 3 0 3 6 1 4 4 ui_report REPORT ALL Mode Report Report 3 3 0 3 2
Look familiar? Maybe not at first. Let's examine what these numbers and names mean.
First up we have three numbers which describe the menu. As you know, when you start the game you have your menu at the top of the screen with options to press 1 to give orders to your element, 2 to give orders to red team and 3 to give orders to blue team, followed of course by the other menu choices. Look again at the fields above. The first number is 1, telling us that this is menu number 1. The following two numbers tell the game which key needs to be pressed to activate the menu and which menu to skip to once the key has been pressed. In each case the third number is 2, so we will jump to menu 2 when either 1, 2 or 3 is pressed.
Let's get hacking straightaway shall we? Swap round the red and blue rows so your file now looks like this:
1 1 2 ui_element Default TEAM_NAME Mode All All 2 3 0 3 4
1 2 2 ui_blue Default TEAM_NAME Mode Blue Blue 1 3 0 3 6
1 3 2 ui_red Default TEAM_NAME Mode Red Red 0 3 0 3 5
1 4 4 ui_report REPORT ALL Mode Report Report 3 3 0 3 2
Load SWAT and start a LAN game. Add some AI officers. You'll see that the red and blue menus have been swapped round. You now need to press 3 to give orders to red or 2 to give orders to blue.
Some of you reading are probably thinking that there's potential for fun here! Yes there is. Read on. You might like to swap your red and blue rows back to the way they were though...
Step 3: replace the custom chat menu entry
You actually already know where the custom chat menu is. From the default menu (number 1) you get to it with key 9. That means that it's this line in the UIOfficerLead.dat file:
1 9 20 ui_customDialog Player NONE NONE Report Report 3 3 0 3 0 1
Remember that the third number is the menu to skip to when you press the corresponding key? Well here it's 20, which is the builtin default for element leader custom chat. Let's change that.
Make an exact copy of the line (copy the whole line to the clipboard) and paste it right at the end of the file but above the closing brace. On your first copy (the original), change 20 to 30 (or any other number). On your second copy (at the end of the file), keep 20 as it is but change the first 1 to 30. Your file should now look like this:
{ ... 1 8 0 ui_copy Player COPY Mode Report Report 3 3 0 3 2 1 1 9 30 ui_customDialog Player NONE NONE Report Report 3 3 0 3 0 1 ... 16 2 0 ui_multiSuspects Player MIRROR_SUS_+1 STEALTH OptiWand Report 3 3 0 3 0 30 1 20 ui_customDialog Player NONE NONE Report Report 3 3 0 3 0 1 }
Now start the game again and follow the custom chat menu. It looks like this:
Step 4: change the menu names
Hmm. This is all well and good but having a "Custom Chat" menu that leads off into another "Custom Chat" menu isn't that original. Let's change it.
Open up your strings.dat file and find ui_customDialog.
ui_csSupplyGone CS Gas Supply Gone ui_customDialog Custom Chat ui_deploy Deploy
Let's add two new lines underneath it.
ui_csSupplyGone CS Gas Supply Gone
ui_customDialog Custom Chat
ui_customDialogDefault Default Custom Chat
ui_customDialogMy My Custom Chat
ui_deploy Deploy
Next go back to UIOfficerLead.dat and change your menu 30.
30 1 20 ui_customDialogDefault Player NONE NONE Report Report 3 3 0 3 0 1 30 2 31 ui_customDialogMy Player NONE NONE Report Report 3 3 0 3 0 1
What did I change? I altered ui_customDialogDefault on the first line, then added a second with key 2 and menu 31 (which, you're right, doesn't exist yet). Its heading is ui_customDialogMy. Restart the game and play a LAN mission to see your new menu.
Please note that when you edit strings.dat you will need to restart SWAT3 to see your changes. If you only edit UIOfficerLead.dat you need only start a new mission...
Feedback
Send any comments to swat3@furrycat.net.