Space Engineers

Space Engineers

32 个评价
How to make a cargo ship mod
由 LHammonds 制作
This guide will show you how to create and publish your own Cargo Ship mod from start to finish.
   
奖励
收藏
已收藏
取消收藏
Test platform
This document was created using Space Engineers v1.079 on Windows 7 (64-bit)

Last updated and verified to work with Space Engineers v1.080

If you follow this guide and it works for you on a version of Space Engineers newer than what I have tested on, please leave a comment and let me and others know which version of Space Engineers worked for you. If this guide breaks with a new version, I will be sure to update it accordingly.
Prepare your ship
Build some ships you want to use as NPC cargo ships. You can make one mod that has multiple ships or you can make multiple mods with one ship each. It is up to you how you do it and each method has advantages and disadvantages. Here is a guide on the basics of ship construction.

  1. Load your world in offline mode (or the F11 debug menu will not work nor will your local mod). Make sure it is Creative mode with Copy/Paste enabled.
  2. Create a ship you want to use.
    • Make sure it is powered by a partially or fully charged battery and/or reactor with Uranium ingots in it (Use SHIFT+F10 to spawn items if needed).
    • Make sure any items you want are included such as cargo contents and ammo.
    • Make sure a beacon exists and is enabled. Set broadcast radius to 10000. The name is not important because it will be set elsewhere.
    • In the Info tab, give your ship a name. The filename will reflect this name as well. Example: Apophis Carrier
  3. In the Control Panel of the ship, select all components (Left-Click top and then SHIFT+Left-Click bottom) and set the Owner as Nobody
  4. Exit the ship and look/aim at the ship and press CTRL+C to copy it. Press ESC to cancel the duplicate as it is not needed.
  5. Press F11 to bring up the debug menu and click the link called Export clipboard to file
  6. While we are here, take a picture of your ship.
    • Press 0 to clear what you are holding in your hand.
    • Press TAB to remove the GUI interface.
    • Arrange the best position to view your ship in the light and have it take up the entire screen.
    • Press F12 to take a Steam Screenshot and go through the steps to save the image to your PC somewhere. Might even take several screenshots such as the inventory, other sides, cockpit view, etc.
Create your mod folder structure
The mod folder structure is where all your mod files will reside.

  1. Click Start -> Run and type %appdata% and press ENTER
  2. Find and double-click the SpaceEngineers folder.
  3. Find and double-click the Mods folder.
  4. Right-click on an empty area and create a new folder with the name of your mod.
    Example: HL NPC Cargo Ships
  5. Double-click the newly created folder.
  6. Right-click on an empty area and create a new folder called Data
  7. Double-click the Data folder.
  8. Right-click on an empty area and create a new folder called Prefabs
Add ship files to mod folder
Now that your cargo ships have been export to .sbc files, you need to move them into your mod folder.

  1. Move your exported ship to the Prefabs folder of your mod location.
    Example Source: %appdata%\SpaceEngineers\Export\Apophis Carrier.sbc
    Example Target: %appdata%\SpaceEngineers\Mods\HL NPC Cargo Ships\Data\Prefabs\Apophis Carrier.sbc
  2. To make sure there are no problems with spaces in the filename, rename the file to remove all spaces.
    Example: ApophisCarrier.sbc
    NOTE: The actual name of the file is not referenced anywhere. The key reference is the SubtypeId inside the file.
  3. Edit the file using a text editor like Notepad or Notepad++ and search for <SubtypeId> and remove any spaces in the name and add a by line to ensure it is unique among all mods. This value must match the <Prefab> key in SpawnGroups.sbc which is covered later.
    Example: <SubtypeId>ApophisCarrier-by-LHammonds</SubtypeId>
Add thumbnail preview image
Add a preview image to your mod so it has a thumbnail image associated with the mod...which shows up when people are browsing the Steam workshop. Keep this image small because you don't want it bloating your entire mod file size...thus making everyone download a lot more than necessary.
  1. Use one of the screenshots you made earlier or a collage image and place it in the root of your mod folder and rename the file to thumb
    Example: thumb.jpg
  2. Edit the image and resize it to be no larger than 300 wide or 300 high and save in .jpg format with at least 75% compression ratio. This will keep the overall size of the mod very small. The goal is to have a "preview" image...not a high-resolution image...we will add those later and keep it separate from the mod download.
Add your ship to the list of cargo ships
  1. Copy the SpawnGroups.sbc file from <Space Engineers game location>\Content\Data\SpawnGroups.sbc to <Your Mod Folder>\Data\SpawnGroups.sbc
  2. Using a text editor, edit SpawnGroups.sbc in your mod folder
    NOTE #1: This file contains NPC Cargo Ships, derelict ships and derelict stations. The derelicts are unpowered, not moving and has "IsEncounter" variable set to true.
    NOTE #2: We are going to remove all SpawnGroups referenced in this file except for one and use it as a template for our own. The NPC Cargo Ships are located at the bottom. We will keep the one called "Commercial Freighter"
  3. There are several ship definitions which are surrounded by <SpawnGroup> and </SpawnGroup> tags. Delete all but one ship definition.
  4. With only one ship left defined, change <SubtypeId> to be unique to your ship. It can be called anything but needs to not match the same as any other SubtypeId in this file (including any other mods that add NPC cargo ships). However, it can match the exact same key as defined in your ship file.
    Example: <SubtypeId>ApophisCarrier-by-LHammonds</SubtypeId>
  5. The main variables are as follows:
    • TypeId = SpawnGroupDefinition (Leave this as is)
    • SubtypeId = Identifier for your ship. Must be unique and not match any vanilla NPC ships nor other mods.
    • Icon = Textures\GUI\Icons\Fake.dds (Leave this as is)
    • Frequency = 1.0 (The rate this ship will show up in relation to other NPC cargo ships. 1.0 = rare, 2.0 = medium, 4.0 = frequent, etc.)
    • Prefab SubtypeId = ApophisCarrier-by-LHammonds (Set this to match the SubtypeId field in your ship file. Example: ApophisCarrier-by-LHammonds)
    • Position X, Y, Z = 0.0 (Leave these as is)
    • Speed = 10.0 (Set however you like but keep in mind that anything above 5.0 can be difficult for players due to desync issues on multiplayer servers at the moment)
    • BeaconText = Your Ship Name (Set how you want the ship to appear on radar)
  6. Save and close the file.

Example of final SpawnGroups.sbc

NOTE: Do NOT copy/paste this to your file. This is an example only. The original format/ships might change over time so always use what the game's current version provides.

<?xml version="1.0"?> <Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SpawnGroups> <SpawnGroup> <Id> <TypeId>SpawnGroupDefinition</TypeId> <SubtypeId>ApophisCarrier-by-LHammonds</SubtypeId> </Id> <Icon>Textures\GUI\Icons\Fake.dds</Icon> <Frequency>1.0</Frequency> <Prefabs> <Prefab SubtypeId="ApophisCarrier-by-LHammonds"> <Position> <X>0.0</X> <Y>0.0</Y> <Z>0.0</Z> </Position> <Speed>5.0</Speed> <BeaconText>Apophis Carrier</BeaconText> </Prefab> </Prefabs> </SpawnGroup> </SpawnGroups> </Definitions>
Verify that your mod actually works
  1. Create a new custom world, set Online Mode to offline, make sure Cargo Ships is enabled, click on Mods and your mod should be listed with a white folder-like icon to the left of it. Add your mod and click OK. The folder icon means it is a local mod. Once published, you will see another entry with a Steam logo next to it meaning it is a WorkShop mod.
  2. Click OK to load the world.
  3. Wait for NPC cargo ships to show up. Once you see one of yours spawn, you are good-ta-go! If in a hurry, you could edit the frequency and temporarily bump it up to something like 50 to make them have a higher chance of spawning above the default ships but make sure to set the values back before publishing.
  4. Try out the ship for a while and make sure things like Ownership are set to you, cargo contents are correct, fuel levels are right, etc.
Create a good description
Give a good, clean and concise description of the purpose of your mod and save this in a text file. You can expand the details later but try to get the basics in a single sentence 1st.

Also list which mods are required if you used modded parts. It is polite and helps efficiency to create links to the other mod pages.

To create a link, use URL bbcode to make some text get an clickable web address.

Example Code:
[url=http://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=406528876]HL Respawn Minimal Reactor[/url]
Example Output: HL Respawn Minimal Reactor

Other bbcodes that can work are as follows:

Bold:
[b]Bold[/b]
Italic:
[i]Italic[/i]
Underline:
[u]Underline[/u]
Images:
[img]insert URL here[/img]
Code:
[code]cout << "Hello World!";[/code]
Quote:
[quote]He said, she said[/quote]
NoParsing:
[noparse]This [b]BBCode[/b] is not processed[/noparse]
Bullet Lists:
[list]
[*]item 1
[*]item 2
[*]item 3[/list]
Upload the mod to Steam workshop
  1. Start Space Engineers and click New World, Custom World
  2. None of the settings matter. Just click the Mods button and select your local mod in the list (should have a white folder next to it)
  3. Click the Publish button and then click Yes stating that you agree to giving over your 1st born child.
  4. Place a checkmark in the Other category and click OK
  5. Mod Published - Click OK to see it pulled up in the in-game workshop
  6. You can now edit the description, add those high-resolution images and videos.

NOTE: I tend to prefer making changes direclty in the Steam client rather than the in-game pop-up due to some wonkiness of the system...clicking "Browse" when picking images for example is very clunky in-game but perfectly normal direclty in the Steam client.
Modify exported .sbc ships
The best way to update your ships is to keep them all in a creative world so you can easily load that world, make your changes and then re-export to file so you can just copy/replace.

If you don't have that world or you are wanting to import .sbc ships you did not create (e.g. vanilla cargo ships), you can use SEToolbox.

  1. Create a new creative mode world using the "Empty World" scenario as a base configuration. Give it a name, load it up, save the world, exit Space Engineers.
  2. Start SEToolbox and open/load the world you just created.
  3. From the menu, click Import -> Sandbox Content files (.sbc) and then find/load the ship file you want to import.
  4. Do this for each ship you want to import, then save and close SEToolbox.
  5. When you load the world in-game, they will all be fairly close to you and spread out a little.
References / Clarification
Vanilla Ship
Spawn Frequency
Speed
Military Escort
4.0
25.0
Military Minelayer
2.0
17.0
Military Transporter
1.0
10.0
Mining Carriage
4.0
25.0
Mining Transport
2.0
17.0
Mining Hauler
1.0
10.0
Private Sail
4.0
25.0
Business Shipment
2.0
17.0
Commercial Frighter
1.0
10.0

%appdata% is a variable that points to the roaming folder of the currently logged in user.
Windows XP Example:
C:\Documents and Settings\<user name>\Application Data
Windows Vista/7/8 Example:
C:\Users\<user name>\AppData\Roaming\

Space Engineers client save games
%appdata%\SpaceEngineers\Saves\YourSteamID\<save game name>

Export location
%appdata%\SpaceEngineers\Export\

Local mods are accessible to you only and only work in games set to offline mode.
%appdata%\SpaceEngineers\Mods\<Your Mod Name>\

Steam workshop mods are accessible in every online mode to everyone.
%appdata%\SpaceEngineers\Mods\<SteamWorkshopID>.sbm

Steam folder can be automatically set to one of two places depending on your OS architecture (but you have the option to move it anywhere):
Windows 32-bit Default
C:\Program Files\Steam\
Windows 64-bit Default
C:\Program Files (x86)\Steam\

Steam game locations default to the Steam folder but again, you have the option to pick a different location. Default location:
<Steam folder>\steamapps\common\<game name>
18 条留言
FlashStrike 2021 年 1 月 1 日 下午 8:57 
what does IsPirate and iscargoship true and false do?
Reika 2019 年 4 月 13 日 下午 9:18 
Two questions:
A) Is this guide (including updates in the comments) still generally correct?
B) Do "block settings" get preserved? That is, things like light colors, thruster overrides, sensor settings, and programmable block scripts - are they copied to the spawned cargo ships?
fabricator77 2019 年 4 月 12 日 上午 9:20 
Changes made in a recent update require the following changes to Cargoship mods.

SpawnGroups.sbc renamed to CargoShips.sbc

need to add this to each SpawnGroup:
<IsPirate>true</IsPirate>
<IsCargoShip>true</IsCargoShip>

eg:
<Icon>Textures\GUI\Icons\Fake.dds</Icon>
<IsPirate>true</IsPirate>
<IsCargoShip>true</IsCargoShip>
<Frequency>4.0</Frequency>
LHammonds  [作者] 2018 年 8 月 14 日 下午 7:53 
Hehehe.
jackik 2018 年 8 月 14 日 上午 11:58 
"then click Yes stating that you agree to giving over your 1st born child." Sure, easy as hell, no problem!
Admiral_Peck 2017 年 8 月 20 日 下午 10:43 
im assuming if i wanted to make a derelict encounter i'd simply use a derelict fle as a template instead of a cargo ship? also is there a limit to how large you can make these? and can you have it spawn pre-damaged?
like as if the thing is a wreck from a past conflict and is now just waiting for salvagers?
Toot 2016 年 11 月 3 日 下午 10:31 
I also dont seem to havy an Subtypeld value in my file and no idea what to do
EnderUnknown 2016 年 8 月 16 日 下午 10:16 
and if u need it, here is the spawngroup file

<?xml version="1.0"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SpawnGroups>
<SpawnGroup>
<Id>
<TypeId>SpawnGroupDefinition</TypeId>
<SubtypeId>Jellfish_Millitary_Drone_By_sdkjell</SubtypeId>
</Id>
<Icon>Textures\GUI\Icons\Fake.dds</Icon>
<IsEncounter>false</IsEncounter>
<IsPirate>true</IsPirate>
<ReactorsOn>true</ReactorsOn>
<Frequency>1.0</Frequency>
<Prefabs>
<Prefab SubtypeId="Jellyfish_Millitary_Drone">
<Position>
<X>0.0</X>
<Y>0.0</Y>
<Z>0.0</Z>
</Position>
<BeaconText>Jellyfish Millitary Drone</BeaconText>
<Speed>10.0</Speed>
</Prefab>
</Prefabs>
</SpawnGroup>

</SpawnGroups>
</Definitions>
EnderUnknown 2016 年 8 月 16 日 下午 10:14 
Love the tutorial but having issues with the SubtypeId, when my sbc is generated it dosent have a Subtypeid in the code, the top looks like this, i looked into the argentavis code and saw the subtypeid, but in my ship, it never generated, help would much be appreaciated, Thanks!

<?xml version="1.0"?>
<Definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Prefabs>
<Prefab xsi:type="MyObjectBuilder_PrefabDefinition">
<Id Type="MyObjectBuilder_PrefabDefinition" Subtype="Jellyfish Millitary Drone" />
Concrete Slurper 2016 年 5 月 8 日 下午 2:12 
Thank you