General file structure for adding ships and its weapons subsystems - HWRM/KarosGraveyard GitHub Wiki

All files involved for adding a ship and its subsystems/weapons

File Structure

when adding a ship to your mod, there are two basic files that are necessary:

  • ship_name.hod
  • ship_name.ship

Additional to editing the def_build.lua file that is contained in scripts/races/race_name/scripts/ in order to enable a race to build your ship.

These must be placed within a ship_name directory inside ship, they must be all named the same.

When you want to create a new weapon or subsystem for the ship, there are additional files and scripts that can be added, all depending on the resources that the ship uses (i.e. weapon scripts, sound and visusal effects, missiles, etc.)

Here is the recommended directory structure to follow for all typical resources that are used:

ship/
    ship_name/ ESSENTIAL
        ship_name.ship ESSENTIAL (script defining the ship object)
        ship_name.HOD ESSENTIAL (compressed file containing the full ship model, animations, certain effects and joints)
        ship_name.events (for ship events definition and related animations)
        ship_name.mad (animation file, created by blender or 3D modelling software when exporting as .obj file)
        ship_name.madstate (script defining animation to play on ship on a certain status)
    icons/ (Needed if you want a UI icon for your ship/weapons/subsystems)
        shipicons.lua (modify to add your ship icon file)
        ship_name.tga

subsystem/ (needed if adding subsystems to the ship)
    subsystem_name/
          subsystem_name.subs
          subsystem_name.hod (has the 3D model of the subsystem, the one that gets highlighter in game when hovering the mouse over it)
          subsystem_name.events

weapon/ (if adding a weapon to the ship)
    weapon_name/
        weapon_name.wepn (inside you mention the overall damage of the weapon, type and firing characteristics, here you link your weaponfire script for adding sound and visual efffects)

missile/
    missile_name/
        missile_name.miss ("ship" like script that describes the missile object, must assign the weaponName to the weapon that fires this missile)
        missile_name.hod (model of the missile)
        missile_name.events (assign animations, events)

scripts/
    races/
        race_name/
             scripts/
                   def_build.lua ESSENTIAL (Edit this file to add your ship to the race that can build it)
    weaponfire/
        weapon_name.wf (script that indicates the audio and visual effects of a weapon/missile/projectile. Note that the variables that are placed here depend on the type of fire effect, such as projectile, missile, blast, etc.)
    familylist.lua (if your ship belongs to a special family or race, you might want to add its family here, like a build family so that this ship can only be made by a certain race)

art/
    fx/ (if adding visual effects to ship/weapons, like explotions or muzzle flashes)
        fx_name.lua (for weapons, missile explotions, etc)
        fx_name/ (content called by fx.lua script)
            fx_name.tga (effect textures)
            fx_name.anim (effect animation script)

effect/
    trails/ (here you can add your custom trails, referenced by ship and missile scripts with the function setEngineTrail)
        trail_name.tga

sound/
    sfx/ (If adding custom sound effects to ship)
        ship/
            ship_engine_sounds.wav
            ship_engine_sounds.lua (script that specifies sound volumes and distance to camera modifiers)
        etg/ (with category subdirectories)
            damage/
            explosion/
            misc/
            ... other custom directories can be added here ...
        speech/ (if adding custom chatter)

soundscripts/ (These can be modified if you want custom chatter for your ships)
    speechlogic/
        chatter.lua
        commands.lua
        status.lua

Quick reference to scripts:

.ship

variables

functions

.subs

variables

functions

.wepn

variables (not used)

functions

.miss

variables

functions

.wf

variables

functions (not used)

sound_effect.lua

variables

functions (not used)