Our objective here is to replace a standard Deck Gun with one of our choosing. A lot of the skills needed to perform this are obtained by following part 1 of the tutorial above, but part 2 should still be pretty simple. Again for this example I will be using the Ohio sub.
Now the next thing we have to figure out is what type of gun do we want to replace this with? For this tutorial I will use the US 14in Triple gun turret. Once you've made your selection we need to find out where all the AI unit guns are stored. Go to Data\Library\ShipParts, in here you find three sets of files named "guns_radars". The gun I'm using can be found in "guns_radars_03.dat". Once you have identified what file set your new gun is in, make a copy of that file set. I will be copying the guns_radars_03.dat and sim files. Now paste that in your USSubParts folder. Now that we've made a copy lets rename it. For simplicities sake we will name the files like the game has the other deck gun files named. So my "guns_radar_03" becomes "Deck_Gun_14." Now that we have that renamed open it up. Delete all the other guns in here except for the one you are using. Now save it. Open up the .sim file along with our dat file. We want to search for our gun in this sim file and delete all the other entries. Use the ID number of our gun to find its entry in the sim file. Now the next thing to do takes us back to the dat file. We need to rename our gun in here. Keep in mind that the base and the barrels both need to be renamed. I'm going to change mine to "14in_base_US" and "14in_barrels_US". Save again. Now over to the sim file. In here we want to select the wpn_Cannon sub-entry. Then in the right side expand obj_turret. You will see an entry named Barrel. The name there and the name for our barrels in the dat file must match so make that change here.Once we have only our gun entries in both files, save both files. Here's what our dat file looks like:
And here's the sim file:
Now in order not to confuse the game we have a couple more steps in our files. The first step is going to be remaping ID numbers. Go up to "Tools", select "Remap IDs". This brings up a window with a few options. First you want to press the Random button, then press Ok. Now save the dat file. Now do the same thing in the sim file
except for pressing the Random button. If you press the Random button while Remapping IDs in the sim file, the IDs won't match and our gun won't work.
Our next stop is the Weapons.upc file found in Data\UPCData\UPCUnitsData. If you don't have a copy of this file already make one. In this file we are going to add our new gun. Let's copy the entry for the 4in 50cal deck gun and paste it at the bottom, this will be our template with which to work.
The first change we want to make to this is the [Weapon 6] line to [Weapon XX], where XX=the next number in the series for entries, mine happens to be 12. On the next line we will change ID= 4in50calUS to ID= 14in50calUS. Next line, 4"/50 Caliber Cannon becomes 14" /50 Caliber Cannon. Now we go down to the AmmoTypesAccepted line. For this we need to open up the Shells.dat file which is in the Library folder. This file lists all the shells in the game, from 20mm all the way up to 16in. So to find out what shell my gun fires I'm going to go to the Deck_Gun_14.sim file to find out. Look for the ammo_storage entry and expand it and it's sub entries. Only one of these entries here has a shell and amount, the rest are all zeroes.
Quick side note, there are four types of shells:
AP= Armor Piercing
HE= High Explosive
AA= Anti Aircraft
SS= Starshell
So we want to copy the shell type number and use that to "find" our shell in shells.dat. And we come up with...huh? A 14in gun is firing a 16in shell? Lucky for us all the shells are labeled in a manor that we can understand. So I'm going to take the extra step of changing my gun to firing 14in shells instead of 16in shells. Any gun can fire any shell you tell it to in the game, it's as simple as selecting the shells ID number and pasting it into the appropriate place in the guns sim file.
Now lets go back to our Weapons.upc file and the AmmoTypesAccepted line. I'll make the change from 4inAPUS to 14inAPUS. One more line to change in this entry and that's the ExternalLinkName3D line. We want that to be the same as our guns name in the dat file, so I'll change mine to 14in_base_US. Save the Weapons file and open the UpgradePacks.upc file. Here's the end result of our entry into the Weapons.upc file:
Quote:
[Weapon 12]
ID= 14in50calUS
NameDisplayable= 14"/50 Caliber Cannon
FunctionalType= WpCannon
WeaponInterval= NULL, NULL
WeaponSlotType= NULL
AmmoTypesAccepted= 14inAPUS
AmmoTypeLoaded= NULL
AmmoMagazineRemaining= 0 ;Not used
AmmoMagazineSize= 1
LeadersSlots=0
WeaponCrewMembersSlots= 2
ExternalLinkName3D= 14in_base_US
Hitpoints= 100
DamageDescription1= NULL, 0, 0.2, 0, 1, 1, Jam, 0, 0, NULL, 1, 0.3, 0.2
DamageDescription2= NULL, 0, 1, 0, 0.5, 1, Chamber Explosion, 50, 5, NULL, 1, 2, 10 ;skill over 1 for unserviceable/destroyed gun
|
Just like in the Weapons.upc file we will copy the entry for the 4" 50cal deck gun, [UpgradePack 13], and paste it at the bottom. First thing to change is the [UpgradePack 13] to the next in the series, mine will be [UpgradePack 32]. Next to change is the ID line. I'll change mine to Upack14in50calDG. NameDisplayable is our next line to change, mine will be 14" 50 cal Deck Gun. One last line to change here, IDLinkUpgradePackElements. What you enter on this line must match the ID line for our gun in the Weapons.upc file. And the end result here:
Quote:
[UpgradePack 32]
ID= Upack14in50calDG
NameDisplayable= 14" 50 cal Deck Gun
FunctionalType= UpFTypeWeaponCannon
UpgradePackSlotType= USDeckGun
Type=NULL
UnitUpgradePackIntervalOptionCurrent= NULL, NULL, 0
UnitUpgradePackIntervalOptions1= NULL, NULL, 400
IDLinkUpgradePackElements= 14in50calUS
|
Now to the NSS_OhioSSBN.upc. We want to go down to the UpgradePackSlot section of the file, now find the entry for our deck gun. Remove "IDLinkUpgradePackSlotsIntervalDefault2= 1943-08-02, NULL, Upack3in50calDG". Now change the date of 1943-08-01 to the word NULL. This ensures that you will have this gun throughout the war. Now we need to change Upack4in50calDG to match the ID of our new gun in the UpgradePacks.upc file. So this now becomes Upack14in50calDG. Try it out in game. At this point the gun should be there but you cannot man the gun yourself. So now we have to included that. To do this we have to give our new gun a .cam file. The end result:
Quote:
[UserPlayerUnit 1.UpgradePackSlot 3]
ID= UpgBowDeckGun
NameDisplayable= Deck Gun Mount
Type=NULL
AcceptedTypes=USDeckGun
UserCustomizable=Yes
IDLinkUpgradePackSlots= BowDeckGun
IDLinkUpgradePackSlotsIntervalDefault1= NULL, NULL, Upack14in50calDG
|
The easiest way to do this is to copy the .cam file of one of the three deck guns in the USSubParts folder. I've copied Deck_Gun_4_50.cam and renamed it Deck_Gun_14 to match the other files for my gun. One important thing to do to this file after renaming it is to Remap IDs like before, no need to press the Random button, just Remap IDs. Now let's go to our guns dat file. Open up the first node. Right click on the node and select Append New Child Chunk\Nodes\Node. Then select this new node, right click and select Appen New Child Chunk\Label. I'm going to enter Dmy_cam_14 for the name of this label. This is going to our camera view for our gun. At this point you may want to position the node someplace where you can have a good view unobstructded. Here's what our dat file looks like now.
Once you have that positioned we need to link that to our cam file. So copy the ID number for our new node and go over to the cam file. Change the Parent IDs on both of the CamUserData main entries to that of our node from the dat file. Save all your work and make sure it works in the game.