[page=Introduction]
Almost always the basic goal of most modders, to add a whole new race to Homeworld 2, but how? Well, for all you newcomers to Homeworld 2 modding, I am about to show you the basics.
[page=The Race.lua File]
The File
Ahh yes, the Race.lua file. Where it all begins. Before you add your new ships, weapons, etc. you need to define the name, prefix, and hyperspace effect/time. Now, I assume you know how to extract the necessary files. The Race.lua file can be found in the scripts folder. Now open it up. It should look similar to this:
NotPlayable = 0
Playable = 1
races =
{
{"Invalid", "Invalid", "", "", 0, NotPlayable,"" },
{"Hiigaran", "$1100", "hyperspace_gate", "etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN", 9.5, Playable,"HGN_"},
{"Vaygr", "$1101", "hyperspace_gate_vgr", "etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN", 9.5, Playable,"VGR_"},
{"Keeper", "$1102", "hyperspace_gate_kpr", "etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN", 12.5, NotPlayable,"KPR_"},
{"Bentusi", "$1103", "hyperspace_gate_bentusi", "etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN", 18.5, NotPlayable,"BEN_"},
{ "Random", "$3226", "", "", 0, Playable, "", }
}
Before you add anything, please keep in mind not to delete any of the existing races, unless you plan on replacing them. Their is also a limit on how many races you can add on. I am not certain, but it is about 2-3 extra races.
The Breakdown
Now, if you just want to make one of the existing races playable, it's a fairly easy change. Just change "NotPlayable" to "Playable" for that race. Now, to add an extra race. Just add:
{"US Navy", "US Navy", "hyperspace_gate", "etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN", 9.5, NotPlayable,"USN_"},
Now, to break that down. This is a basic breakdown for the code we added:
{"<RACE_NAME>", "<DISPLAY_NAME>", "<HYPERSPACE_GATE_EFFECT>", "etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN", <HYPERSPACE_TIME>, <PLAYABILITY>,"<PREFIX>"},
[code]: The prefix used for your race. (etg. Kpr_, Hgn_, etc.) Should reflect your races name.
[page=The Ships Folder]
Okay, so you have you new race defined, but it still needs ships. So you have the models or ship files ready, time to put them into the Ships folder. In here is where all the ships in the game will be stored. To add a new ship to your new race, make a new folder and name it USN_Destroyer. You can change it to what ever you like, but it has to be
That about wraps up the ships.
[page=The StartingFleets Folder]
Okay, so your race is defined, you have ships...but when you start a game, what do you start out with? The StartingFleets folder is where all the information is kept. If you notice that the existing files are named in a specific way.
[code]PersistantData = {
StrikeGroups = {
},
Squadrons = {
{
type = "Vgr_MotherShip",
subsystems = {
},
shiphold = {
},
name = "",
size = 1,
},
{
type = "Vgr_ResourceCollector", -- ship name
subsystems = {
},
shiphold = {
},
name = "",
size = 1, -- only 1 in each squadron
number = 6, -- start with 6 of these
},
{
type = "Vgr_Carrier",
subsystems = {
},
shiphold = {
},
name = "",
size = 1,
number = 1,
},
},
Research = {
},
}
[/code]
As you can see, the comments explain the code. You can just change the code to the appropriate ship name, number, and squadron size.
[page=The Building and Research Folder]
The Folders and Files
So, you have your race, your ships, and the starting fleets, but you still need some build and research options, as the game would be boring without those. Everything is located in the Building and Research folder. Inside, you will see more folders. These are for each race. When adding a new race, just copy and paste one folder, and re-name it to your races name. Inside this folder will be two files, build.lua and research.lua. I think you know which one is for which.
The Build.lua File
If you open it up, it will be pretty long. I won't post he whole this, just a small snippet.
[code]{
Type = Ship,
ThingToBuild = "Vgr_CommandCorvette", -- the name of the ship
RequiredResearch = "CorvetteCommand", --which research(s) are required. (use "|" for "or" and "&" for "and")
RequiredShipSubSystems = "CorvetteProduction", -- required subsystem(s) to build. (use "|" for "or" and "&" for "and")
DisplayPriority = 110, -- order displayed in the UI menu. smaller numbers being on top.
DisplayedName = "$7144", -- name to be displayed on the build menu
Description = "$7145" -- description of the ship in the build menu
},
[/code]
The comments in the code should explain the function of each line.
The Researc.lua File
Now, the other file.
[code]{
Name = "CorvetteTech", -- the name of the research item
RequiredResearch = "", -- list of prerequisite research items
RequiredSubSystems = "Research", -- list of prerequisite sub systems
Cost = 500, -- cost of the research item
Time = 40, --time (in seconds) to fully finish research
DisplayedName = "$7176", -- name displayed on the UI menu
DisplayPriority = 20, -- order displayed in the UI menu. smaller numbers being on top.
Description = "$7177", -- description in the research menu
TargetType = Family, -- only used if upgrades all ships within this family
TargetName = "Corvette", -- name of the family or ship
Icon = Icon_Tech, -- icon to use (listed at the top of the Research.lua file)
ShortDisplayedName = "$7180", --short name used in the games UI
},
[/code]
I hope the comments in the file have explained it well enough.
[page=Hints and Tips]
That's all their is to setting up a new race. Here are some hints, tips and links to help you out.
Look for existing patterns
When adding in a new ship, try to add it in a way similar to that of what is already there. It will help ensure that it works.
Check for typos
This is the most important thing to remember, a single extra or missing letter, comma, or bracket can make the whole file useless. It has caused me so much trouble at times. It can save you allot of trouble to do it right the first time, even if it takes a little extra time or work.
If you?re stuck, ask for help
It's as simple as that, their are plenty of forums out their who can help. A great place to ask is at Relicnews Forums, a great community of Relic games and their mods.
Other Homeworld tutorials by me
Make sure to check out my Enable AI to Build New Ships tutorial. Their are more to come. :)
Ok. So im brand net to this whole modding business. i was reading the tutorial "setting up a new race" for homeworld 2 and i cant seem to find the race.lua file.
any help will be greatly appreciated.
thanks,
Phil
How to create lua file?
Please disregard the previous post as I have found the necessary files and folders to mod my game. For those who dont know where to get them, click on the link below.
Enjoy.
Forums.relicnews.com
Phil.
Its in the homeworld2.big file (in your data folder). but you wil need a big extractor. all tools cn be find here Wiki.hw2.info . try it
C-ie-K
The race.lua file should be in data:scripts/race.lua where data is the data folder from homeworld2.big (if you extract the big or dl a pre-decompiled big).
EhraniNavy
how would u set up the resaourcing for the keepers, would you have to change the hardpoints?
why does it shw my name when you type in HOMEWORLD 2 RINGLESDER it brings you to theis site
hey I followed your thing and my game crashes whenever I try to play as them.
I took a race made in another mod and added them to the warlords mod any Idea how to make the new race work?
what do i use to open the race file?
never mind... how do I get the hod files? I downloaded the files from the internet but they don't include the .hod files.
So I added a new race in the race.lua file just like you did but whenever I try to play as this race my game crashes at "Universe" on the loading screen. Any light to this issue?