View Single Post
Old 09-19-12, 09:50 AM   #18
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by Cybermat47 View Post
eh? How!? if you can change camoflage and equpment, i might be able to make a seperate unit for the Tirpitz!
Okay, looking into your mod I've noticed only now that you just added some new roster entries, without cloning any unit. I am sorry for any misunderstanding that I might have generated

Anyway, since vanilla SH5 got "cloned" units too, it will be easy for you understanding what I meant. Try opening one of them, NAMC_Patroclus for instance. Its folder got several files. the main one is NAMC_Patroclus.cfg. Open it in notepad and you will see the following entries (commented by me here):

Quote:
ClassName=AMCPatroclus <= this is the name used in roster and in names.cfg for denoting the unit
3DModelFileName=data/Sea/NAMC_Rawalpindi/NAMC_Rawalpindi <= this is the path to the main model: SH5 Patroclus is a clone of the Rawalpindi
UnitType=13 <= this is the unit type; open names.cfg (found in roster) for understanding what it means
MaxSpeed=15 <= ship's speeds are set in their sim files; I am not sure if you can limit it by editing this entry
Length=165.89 <= same as NAMC_Rawalpindi; Don't fiddle with this entry unless you know what you are doing
Width=21.39 <= as above
Mast=39.69 <= as above
Draft=9.00 <= as above
Displacement=11198 <= base displacement used for sunk tonnage calculation
DisplacementVariation=10 <= this is the max figure that is randomly added/subtracted to/from the base displacement
RenownAwarded=220 <= self-explanatory
CrewComplement=40 <= used for lifeboats spawning
SurvivalRate=70 <= as above
SurvivalPercentage=40 <= as above; not sure what's the difference with the previous entry
RecManualCategory=TroopTransport <= used in recognition manual
BowShape=Plumb <= as above
Funnels=2 <= as above
ShowInRecognitionManual=No;it is a clone. the player will identify it as another single ship <= In stock cloned units it is always set to 'No'; not sure if weird things may happen if set to 'Yes'
The remaining files are NAMC_Patroclus.eqp and NAMC_Patroclus.sns. The first one contains gun equipment settings, whereas the latter deals with sensors. They both can be opened with notepad and they share the same format, with many groups of settings. A typical group taken from NAMC_Patroclus.eqp looks like this:

Quote:
[Equipment 1] <= this is an header, denoting the ID of each group; ID's shouldn't be duplicated within the same file, and should be sorted in ascending order
NodeName=M01 <= this is the ID of the bone/node that the gun/sensor gets linked to
LinkName=5.9in_turret_GER <= this is the name of the gun/sensor that gets linked to the bone/node set with the previous entry
StartDate=19380101 <= date in yyyymmdd format that the bone/node will start being equipped with the set gun/sensor
EndDate=19451231 <= date in yyyymmdd format that the bone/node will end being equipped with the set gun/sensor
bones/nodes are sets of x, y, z coordinates within a 3D model that you can link stuff to. In SHIII/IV/V the ones used for equipments are denoted with unique names composed of a letter and a sequential number (i.e. A01, O02, etc.). Letters follow the following code:

M = cannons (main armaments)
A = AA guns
W = depth charge projectors
T = torpedo tubes
L = searchlights

O = visual sensors
H = hydrophones
N = sonar
R = radar

not all the above mentiones bone/node types are featured in every ship. In order to check wich ones are available for the ship you are cloning, and for locating their position on the 3D model, you should open its GR2 file in goblin editor (NAMC_Rawalpindi.GR2 in our example), and look at the list on the left, for bones whose name start with "cfg#" followed by an equipment ID (i.e. "N01", "A03", etc.) and the name of the 3D model itself ("_NAMC_Rawalpindi" in our case). By selecting those entries with a mouseclick, their position will be shown on the unit preview, on the right. For dat inported units the proceidure is about the same, but you can open them with s3d.

Should you need to add a new bone/node to a 3D model, the tools are TDW's GR2 Editor/Viewer/Extractor/Importer for GR2 units and the above mentioned Silent 3Ditor by Skwas for dat units.

Notice that eqp and sns files can get several entries of the same bone/node, as long as you set different date ranges for each of the relevant groups. In this way you can set different armament/sensor outfits for different periods of the war.

For having a list of armaments and sensors available in game, whose names can by directly typed as LinkName settings, you should open respectively guns_radars_01.GR2 (path: data\Library\ShipParts) and AI_Sensors.GR2 (path: data\Library). Again, the required tool is goblin editor (made available by devs in main SH5 folder of the stock game), and you will see those names listed on the left of the screen.

The last step will be adding the cloned unit to the roster, similarly to what you already did with other units. Remember that roster cfg files should be named after the ClassName setting in unit's cfg.file. Talking abou them, these are the settings of AMCPatroclus.cfg, found in data/Roster/British/Sea:

Quote:
[UnitClass]
ClassName=AMCPatroclus <= unit's name; should match the name set in the ClassName entry of unit's main cfg file
UnitType=13 <= unit's type; should match the type set in the UnitType entry of unit's main cfg file
AppearanceDate=19390912 <= when the given nation started operating the unit
DisappearanceDate=19411001 <= when the given nation ended operating the unit
DisplayName=BR AMC Patroclus (proxy) <= I am not sure where this name is actually displayed; I guess you are free to set whatever name here

[Texture 1]
TextureName= <= path to the diffuse map (main texture) you want to use for the unit/class; if not set, the standard texture of the main model is used
LightmapTextureName=data/Sea/NAMC_Penguin/Penguin_AO.tga <= path to the ambient occlusion map (reflection map) you want to use for the unit/class; if not set, the standard texture of the main model is used
NormalmapTextureName= <= path to the normal map (bump map) you want to use for the unit/class; if not set, the standard texture of the main model is used
StartDate=19390101 <= see my note below
EndDate=19461231 <= see my note below
Frequency=1 <= see my note below

[Unit 1]
Name=HMS Patroclus
DOC=19390912
DOD=19401104

[Unit 2]
Name=HMS Hector
DOC=19391220
DOD=19420405

[Unit 3]
Name=HMS Antenor
DOC=19400101
DOD=19411001
There's just one [UnitClass] group for each file. [Texture] and [Unit] groups can be repeated, as long as you give thei headers a sequential number, and they are sorted in ascending order. Date ranges can be overlapping.

In stock game different camoufflages are painted on the ambient occlusion map. Theoretically they could be painted on the diffuse map as well, making things a lot easier (it is not that easy to locate different ship parts in an occlusio map), but I am not really sure that alternative diffuse maps are actually used in SH5.

If different texture definitions with overlapping date ranges are set, the frequency setting is used. An example: let's say that for a given date we have two texture definitions: [Texture 1] and [Texture 2], and that their rescpective frequencies are 1 and 3. The chance for each texture to be sisplayed in game will be respectively: 1/(1+4)=25% and 4/(1+4)=75%

finally, [Unit] entries, as suggested by Trevally, are used for single units names. When spawning a new unit, the game should assign a name to her, picking it randomly from the list of [Unit] entries whose date ranges match the current date. Call me dumb,I've still to understand where these names are displayed in game.
gap is offline   Reply With Quote