View Single Post
Old 11-27-12, 04:40 PM   #6
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default AI guns modding quick tutorial

Here we are

for a start, you will need for one or more test missions, to test your changes in game.
At first, you can use one of the historical missions coming with the game, or one of the test missions included in many mods available for SH5. At some point you will probably need for a mission especially designed. You can ask me to create it for you, or you can do it by yourself using Mission Editor. Following the tutorial posted in this thread you will learn all you need to know in order to create a simple mission in 5 minutes.

The second step is locating the ships featured in the test mission you have picked, and identifying their guns.
Surface units are located in the data/Sea folder. Each subsfolder in that path is a single unit. Their names are often quite unequivocal on the unit that they are standing for: there is a prefix, describing the unit type (see below), followed by the name of the unit/class.

Code:
NAGC = Amphibious ship
NAMC / NTR = Merchant raider / Auxiliary cruiser
NAO = Supply vessel
NBB = Battleship
NBC = Battlecruiser
NCA = Heavy cruiser
NCL = Light cruiser
NCO = Corvette
NCV = Aircraft carrier
NCVE = Escort carrier
NDD = Destroyer
NDE = Escort destroyer / Frigate
NFF = Sloop
NK* / NLL / NVV = Cargo ship
NLS = Landing craft
NO* = Oiler / Tanker
NPC = Patrol boat / Torpedo boat
NPH / NPL / NPP = Ocean liner / Troop transport
Nrtw = Naval trawler
NSC = Submarine chaser
Should you need for further evidence on the identity of any ship, open its cfg file (within its respective folder), copy her ClassName (in the first row), and search for it in Names.cfg (located id data/Roster): the name after the '=' sign is the one shown in game, when you identify the unit

In order to know which guns each unit is equipped with, you should open its .eqp file with notepad, and take note of LinkNames under NodeNames that are starting with a 'M' (main guns), with a 'A' (secondary guns), or with a 'L' (light guns and, more often, searchlights). Each NodeName stands for a single bone in the 3dmodel, i.e. a set of coordinates designing a single gun platform aboard the unit. StartDate and EndDate (in yyyymmdd format) will tell you the time span that each platform is equipped with that given gun (outside this timespan the platform will be either empty or occupied by another gun).

It is now time to open Goblin Editor.
Before doing it, create a new mod, containing the following files: guns_radars_01.GR2 and guns_radars_01.sim (path: data/Library/ShipPart). Remember to reproduce the same path in your mod, if you want to enable it using JSGME. After doing it, follow the below steps:
  • run GoblinEditorApp.exe (found in SH5main folder);
  • if it is the first time you are using Goblin Editor, you should set it according to the instructions in this tutorial;
  • menu file => open => select guns_radars_01.GR2;
  • menu file => merge => select guns_radars_01.sim (pointing to the file you had previously put into your test mod);
  • at this point, the project tree (Tool => Show Project Tree, if it is not visible from the beginning) should display the guns coming with stock game. Double click on any of them for editing its properties;
  • in the next window (existing behaviors), select the wpn_Cannon controller, for displaying its properties in Edit behavior window (on the right);
  • the restr_dist parameter is found under obj_turret => Debug (click on the + symbols for expanding the tree). On top of it there's another parameter called show_restr. By default it is set to No. Try setting it to yes. Once in game it should show graphically the effect of restr_dist;
  • the trav and elev_tolerance parameters are found under Fire;
  • once fininished with your changes close the edit behaviors window. You will notice that guns_radars_01.sim entries have become red, meaning that there are unsaved changes on this file;
  • repeat the same steps for each gun you want to edit;
  • for saving the changes, right click on any red entry in Project Tree, under guns_radars_01.sim, and selcet 'Save'. That's all

In game:
you might want to test your changes under different conditions. New UIs lets you to set many mission related parameters (date, hour, rain, fog, etc.). Rememeber to backup the mission, if you want to retrieve it to its previous settings (especially important for stock historical missions).

NOTE:

if Goblin Editor's selection boxes are flickering, close the program, right click on GoblinEditorApp.exe => Compatibility window => Disable visual themes.

The above instructions are relative to stock ships/guns. Things are slightly different for imported units, but for the moment I suggest you to stick to GR2 units/guns only.

Last edited by gap; 11-27-12 at 05:36 PM.
gap is offline   Reply With Quote