Natural Selection Wiki
Advertisement
Natural Selection Wiki

This page gives an example on how to make a simple Mod to change some balance in the game. Any Server running this Mod will not be whitelisted so no XP, or Hive Skill will be gained while playing on it.

There are more comprehensive Guides on the Internet like Ghoul's Guide[1], or the more recent Steam Guide by Brute and Las[2]. All Files used in this guide are included in the example file[3] available for download. All paths will be used as they are in that example mod.

Tools

All you need is a decent editor, like Notepad++, and the tools that come with Natural Selection 2. You can download an example I made here, it also shows how to modify the Biomass requirements in the Readme.pdf that is included.

Setting up the Mod

  1. Either download and open the example provided or make a new mod from scratch in Launchpad. If you use the example provided, skip to step 7.
  2. In your mod's source folder "CustomBalance\source\lua", create two new folders named "entry" and "CustomBalance".
  3. Inside the "entry" folder, create a new file called "CustomBalance.entry", and open it with the editor.
  4. Copy the contents from the entry example below to your file.
  5. Inside the "CustomBalance" folder, create a two new files called "FileHooks.lua" and "Balance.lua", and open them with the editor.
  6. Copy the contents from the File Hooks example below to your "FileHooks.lua" file, and the contents from the Balance example below to your "Balance.lua" file.
  7. Open the Builder from Launchpad and Rebuild the mod.
  8. (Optional) Add preview, description and tags to your mod.
  9. Publish the mod.

This is what your file structure should look like before, and after building and publishing the mod, if you followed this example.

Before After
CustomBalance CustomBalance built

File Examples

Entry File

CustomBalance.entry

modEntry = {
    FileHooks = "lua/CustomBalance/FileHooks.lua",
    Priority = 10
}

If you named the subfolder in your "CustomBalance\source\lua" folder anything but "CustomBalance" you obviously use that as file path for your "FileHooks.lua".

File Hooks

FileHooks.lua

ModLoader.SetupFileHook("lua/Balance.lua", "lua/CustomBalance/Balance.lua", "post")

The first one is the original file, the second one the modded file that overwrites it. If you named the subfolder in your "CustomBalance\source\lua" folder anything but "CustomBalance" you obviously use that as file path for your "FileHooks.lua". The entry "post" just specifies that it is loaded after the original.

Balance

Balance.lua

--	Changes
--	Alien
kMetabolizeEnergyResearchCost = 5 			-- Metabolize cost from 20
kMetabolizeHealthResearchTime = 25		    -- Advanced Metabolize time from 45

--	Marine
kMineResearchCost  = 5					    -- Mines cost from 10
kAdvancedArmoryResearchTime = 30		    -- Advanced Armory time from 90

This example sets the research cost for Metabolize down to 5 TRes, the research time for Advanced Metabolize down to 25 s, Mines research cost down to 5 TRes and the Advanced Armory Upgrade time down to 30 s

More Variables

Here is a list of more variables you can change. There are more to be found in the game files' Balance.lua, but beware, there are a number of variables that serve no purpose anymore, since they were patched out of the game. Using these would require to rebuild the systems that used them, and that is way beyond the scope of this guide.

Balance Variables
Alien Tech
Variable Tech
kBileBombResearchCost = 15 Bilebomb
kBileBombResearchTime = 40
kLeapResearchCost = 15 Leap
kLeapResearchTime = 40
kMetabolizeEnergyResearchCost = 20 Metabolize
kMetabolizeEnergyResearchTime = 40
kMetabolizeHealthResearchCost = 20 Advanced Metabolize
kMetabolizeHealthResearchTime = 45
kUmbraResearchCost = 30 Umbra
kUmbraResearchTime = 75
kSporesResearchCost = 20 Spores
kSporesResearchTime = 60
kBoneShieldResearchCost = 25 Bone Shield
kBoneShieldResearchTime = 40
kStabResearchCost = 25 Stab
kStabResearchTime = 60
kStompResearchCost = 35 Stomp
kStompResearchTime = 90
kXenocideResearchCost = 25 Xenocide
kXenocideResearchTime = 60
kResearchBioMassOneCost = 15 Biomass 1
kBioMassOneTime = 25
kResearchBioMassTwoCost = 20 Biomass 2
kBioMassTwoTime = 40
kResearchBioMassThreeCost = 40 Biomass 3
kBioMassThreeTime = 60
Marine Tech
Variable Tech
kAdvancedMarineSupportResearchCost = 20 Advanced Support
kAdvancedMarineSupportResearchTime = 60
kMineResearchCost = 10 Mines
kMineResearchTime = 20
kGrenadeTechResearchCost = 10 Grenades
kGrenadeTechResearchTime = 45
kShotgunTechResearchCost = 20 Shotguns
kShotgunTechResearchTime = 30
kJetpackTechResearchCost = 25 Jetpacks
kJetpackTechResearchTime = 90
kExosuitTechResearchCost = 20 Exosuits
kExosuitTechResearchTime = 90
kWeapons1ResearchCost = 20 Weapons 1
kWeapons1ResearchTime = 75
kWeapons2ResearchCost = 30 Weapons 2
kWeapons2ResearchTime = 90
kWeapons3ResearchCost = 40 Weapons 3
kWeapons3ResearchTime = 120
kArmor1ResearchCost = 20 Armor 1
kArmor1ResearchTime = 75
kArmor2ResearchCost = 30 Armor 2
kArmor2ResearchTime = 90
kArmor3ResearchCost = 40 Armor 3
kArmor3ResearchTime = 120
kPhaseTechResearchCost = 10 Phase Tech
kPhaseTechResearchTime = 45
kAdvancedArmoryUpgradeCost = 25 Advanced Armory
kAdvancedArmoryResearchTime = 90
kUpgradeRoboticsFactoryCost = 10 ARC Factory
kUpgradeRoboticsFactoryTime = 20

Notes

Advertisement