For those of you who wish to start on STF modding, here is a guide to help you understand the SQL that you’ll need to start on your very own mod!
New component SQL
Let’s write SQL to add a new line of components!!
This is an example set of SQL for creating a new line of components available in the shipyard. Hopefully this is illuminating for anyone wishing to do something similar. Please post if you have information on anything to add to the script.
The Null Space Chamber
Using somewhat well understood dimensional technology, there is now a way to store cargo in a pocket of negative space, freeing room at the same time as giving a boost to available cargo space. WARNING long-term exposure risks to crew are currently unknown, please minimize time inside the null space zone pending further studies WARNING.
Due to the power requirements and equipment needed to generate this field, these components are always large and difficult to maintain. Here is the new line of large size mass reducing technology that also carries cargo!
INSERT INTO ShipComponent ( unlockId, /*The ID of any unlock that is the gatekeeper for this component*/ minStar, /*the minimum starport rating needed to install*/ minMil, /*the minimum military rating needed to install*/ minEcon, /*the minimum economy rating needed to install*/ gameState, factionId, /*the ID of a particular faction that sells this exclusively, 0=all*/ sortPriority, signature, subType, installTime, /*the number of turns to install this component*/ installValue, /*The credits needed to install*/ installCost, /*unknown...*/ driveMass, /*if this is an engine, the mass rating, 0 otherwise*/ shipEngineId, /*if this is an engine, its ID from the ShipEngine table*/ mass, /*the amount of mass consumed (negative for mass reducers)*/ deflectionBonus, /*the amount of shield points added*/ shipEffectId, /*combat effects from the ShipEffects table*/ medicalRating, /*medical rating of this component*/ holdsCraft, /*number of craft contained*/ holdsPrisoner, /*number of prisoners contained*/ holdsGuest, /*number of guests contained*/ fuelBonus, /*amount of fuel storage*/ armorBonus, /*armor points added*/ jumpCost, /*fuel cost added to hyperwarp jumps by this component*/ holdsOfficer, /*number of officer cabins added*/ holdsCrew, /*number of crew bunks added*/ holdsCargo, /*amount of cargo held*/ skExplorer, /*number of explorer dice added to your pool*/ skNavigation, /*number of navigation dice added to your pool*/ skElectronics, /*number of Electronics dice added to your pool*/ skGunnery, /*number of Gunnery dice added to your pool*/ skShipOps, /*number of Ship Ops dice added to your pool*/ skPilot, /*number of Pilot dice added to your pool*/ shipWeaponId, /*if this is a weapon, the ID from ShipWeapon, 0 otherwise*/ componentLevel, /*numerical level, 1 being most basic, up to.... */ componentPng, /*the art asset to use*/ componentDesc, /*the shipyard automatically generates a description, leave null*/ componentName, /*Display name of your component*/ componentType, /*Look for similar component types for an appropriate ID; used for grouping*/ componentSize, /*1=small, 2=medium, 3=large*/ _id /*unique id for your component, do not reuse existing ids!*/ ) VALUES ( 0, /*unlockId*/ 7, /*minStar*/ 0, /*minMil*/ 6, /*minEcon*/ 0, /*gameState*/ 0, /*factionId*/ 10, /*sortPriority*/ 0, /*signature*/ 34, /*subType*/ 10, /*installTime*/ 8640, /*installValue*/ 200000, /*installCost*/ 0, /*driveMass*/ 0, /*shipEngineId*/ -100, /*mass*/ 0, /*deflectionBonus*/ 0, /*shipEffectId*/ 0, /*medicalRating*/ 0, /*holdsCraft*/ 0, /*holdsPrisoner*/ 0, /*holdsGuest*/ 0, /*fuelBonus*/ 0, /*armorBonus*/ 4, /*jumpCost*/ 0, /*holdsOfficer*/ 0, /*holdsCrew*/ 20, /*holdsCargo*/ 0, /*skExplorer*/ 0, /*skNavigation*/ 6, /*skElectronics*/ 0, /*skGunnery*/ 3, /*skShipOps*/ 0, /*skPilot*/ 0, /*shipWeaponId*/ 1, /*componentLevel*/ 'ship_comp_msasredux.png', /*componentPng*/ '', /*componentDesc*/ 'Null Space Chamber 1', /*componentName*/ 27, /*componentType*/ 3, /*componentSize*/ 6601 /*_id*/ );
Update armor and add a ship!
Let’s start with a basic UPDATE. Let’s say you want to change some of the values for the Spec Ops Mesh armor and then share that with other mod developers.
First, SqlLiteStudio makes it pretty easy to see the contents of any table, so let’s start with Armor. You can open the table and find your Armor entry manually or you can write a query to find it.
select * from Armor where ArmorName = ‘Spec Ops Mesh’;
If you put this in a SQL editor window and press the play button, you’ll get just the row you want. This can be helpful later as you’ll see.
_id armorType protection absorption hardness dodge initScore effectId cost groupId gearLevel factionId pngPath armorName 6 4 36 38 100 -7 0 0 0 3 3 0 equip_armor_stealth.png Spec Ops Mesh
The ‘_id’ column is very important. It must be unique so that you can identify any row specifically. Don’t mess with IDs on existing data. You have been warned.
Let’s say you want to change the Protection and Absorption of that armor to 40 and 42.
You can just click on the entries in the table and edit the numbers, then click ‘commit’, but nobody else will be able to automatically make those changes if you’re collaborating.
Instead, you can update the values programatically:
UPDATE Armor SET protection = 40, absorption = 42 where _id = 6;
SqlLiteStudio will automatically commit that transaction, so be careful. If you now run your SELECT statement from above, you’ll get the same data, updated with the new protection and absorption numbers.
Now you can send your update statement to another developer and they can easily apply that change to another database.
That’s nice, but I want to add a whole new ship! This will require some INSERT statements since you’re adding new data rather than updating something that is already there.
There are several tables to which we’ll need to add data and several more that we will need to reference. Ready?
The ships themselves live in ShipType and the components, weapons, etc. that make up that ship are in ShipDataCompartment. ShipTypeAIRoller is for AI captains.
You can’t have a bunch of components flying around without a ship, so you’ll have to add the ShipType entry first.
Please note that the values enclosed in /* */ are comments and not required in any query, they’re just here for informational purposes.
INSERT INTO ShipType ( largeSlots, /*this is the number of large slots*/ mediumSlots, /*this is the number of medium slots*/ smallSlots, /*this is the number of small slots*/ unlockId, /*this is the unlock ID that unlocks this ship, 1 for unlocked*/ gameState, /*game State*/ factionId, /*this is the number for a specific faction ship, 0 for any*/ startingShip, /*Ships available to pick as a starting captain are 1, normal ships are 2*/ maxCraftDefense, maxCraft, /*max craft that this hull supports*/ maxLifeSupport, maxOfficer, baseFuel, baseMass, baseDeflection, baseArmor, hullPoints, skinGroup, skinName, atlasFile, skeletonDataFile, shipCost, startShipCost, shipTypeName, _id ) VALUES ( 4, /*this is the number of large slots*/ 6, /*this is the number of medium slots*/ 11, /*this is the number of small slots*/- 1, /*this is the unlock ID that unlocks this ship, 1 for unlocked*/ 0, 0, /*this is the number for a specific faction ship, 0 for any*/ 1, /*Ships available to pick as a starting captain are 1, normal ships are 2*/ 80, /*maxCraftDefense*/ 2, /*max craft that this hull supports*/ 36, /*maxLifeSupport is the maximum crew that hull supports*/ 7, /*maxOfficer*/ 80, /*baseFuel is the base amount of fuel for the hull before components such as fuel tanks*/ 5000, /*baseMass is the mass of the ship; stick to the existing classes for now*/ 7, /*baseDeflection is the base shields*/ 8, /*baseArmor*/ 1680, /*baseHullPoints*/ 'Nebula', /*map graphics in the ships folder*/ 'Nebula_Yellow', /*map graphics in the ships folder*/ 'sprites/ship_combat_alpha.txt', /*combat graphics in the sprites folder*/ 'sprites/ship_combat_alpha.json', /*combat graphics in the sprites folder*/ 480000, /*shipCost to buy or sell*/ 240000, /*startShipCost is the value for a new captain*/ 'Habanya Frigate', /*shipTypeName*/ 888 /*_id is the unique identifier for this ship. DO NOT DUPLICATE A VALUE ALREADY IN THE DATABASE*/ );
If you run this insert statement in a SQL editor window, you’ll have a shiny new entry in the ShipType table, ready to add components.
If you change something manually for your new shipType during testing and want to share it, you can highlight the entire row you want in the table, right click, go to:
generate query for selected cells and under that, select INSERT. That will give a shiny new insert statement with your current data, perfect for sharing!
Now that we have a ship, we need components to fill it. Make sure to select components that fit the correct size slot.
For the sake of brevity, I’m only inserting a single component, although you could insert any number with a single statement.
INSERT INTO ShipDataCompartment ( typeLocked, /*is this component locked and cannot be changed - leave as 0*/ defaultComponent, /*This must match the _id column from ShipComponent that you wish to add*/ componentType, /*This must match the componentType column from ShipComponent that you wish to add*/ size, /*1=small, 2=medium, 3=large*/ tmxId, /*this value must start with one and increment*/ shipId /*this is the _id from ShipType of your new ship, 88 in the example*/ ) VALUES ( 0, 48, /*M5000 Void Engine: Chaser*/ 3, /*engine*/ 3, /*large size*/ 1, 888 );
If you wish to see all of the components currently on your shiny new ship, enter the query:
select * from shipcomponent where _id in (select defaultcomponent from shipdatacompartment where shipid=888);
This will limit the select to only the values for your ship. If you want to look at all of the components on another ship, replace the 888.
SELECT * from ShipType where shipTypeName = ‘Arcanum Freighter’;
This is all for Star Traders: Frontiers How to Make Mod + Start a New SQL New Component Guide hope you enjoy the post. If you believe we forget or we should update the post please let us know via comment, we will try our best to fix how fast is possible! Have a great day!
- Check All Star Traders: Frontiers Posts List