How to add "Rising Son" to your mod
Posted: Tue Apr 21, 2009 10:37 pm
Disclaimer: Just a heads-up, before you read anything - this tutorial is not for beginners. I am going to clearly write out anything you need to do this and you should be able to walk this through with only a brain and fingers to your name, but there is a good chance that you will get confused if you do not have a good foundational grasp of setting up SWBF2 .lua files.
First know how to add additional modes manually (editing addme.lua, mission.req, adding mission-specific .req files). If you don't know this, you should learn now.
This tutorial will focus on adding the "conquest" gamemode to your map. Hero support is much simpler, as it doesn't use any of the random/AI features this does, and wave is a custom mode made for each map.
Addme.lua editing
Right after the function AddNewGameModes is defined, add the line:
It will look like this:
You will now need to edit what you're adding, find the part that lists your map/s and add in:
You will also need to add in a change parameter (a function of the 1.3 Patch, r117). This follows after your modes have been defined:
All in all, an example of this could look like this:
Make sure the rest of your addme.lua is set up correctly.
Setting up the additional .lua files:
In addition to setting up your ABC1_con.req file (mission-specific .req) and adding ABC1_xxx to your mission.req, you will also need to call for additional scripts in your mission .req to fully use "The Dark Times" sides.
First, download this: http://www.mediafire.com/?jdyp2m9tj5qpam3
http://www.filefront.com/17159566/DT2add.zip (broken - take first link)
[This is updated for Dark Times II: Rising Son. If you've downloaded the previous version, you will need to now download this version as the TFUrandom.lua script has been updated.]
Take the two .lua files (remember, the AIHeroSupport script was made by archer01, and if you use it you need to credit him too) and move them into your "data_ABC\Common\scripts" folder. Open up your mission.req and add "AIHeroSupport" and "TFURandom" to the list of scripts called at the beginning:
Now you're ready to edit your mission .lua.
Mission .lua editing
Open up your ABC1_con.lua. Make your top look like this (note that ALL and IMP need to be globally and not locally defined):
Just below that, add in this:
This reads the localizations from "The Dark Times."
Proceed down towards the end of the ScriptPostLoad section (before "end"). This is essentially just how you set up hero support (and as such is covered in more detail in archer's tutorial), but note that you will need to add the hero support like this:
This is part of what makes sure AI heroes don't show up (and mess up) multiplayer. Note also that you're redefining your CPs here as well as their spawnpaths.
Move down to just inside ScriptInit. You will first need to add this section:
(This can be just about the first thing in ScriptInit)
This has several new features for Dark Times II: Rising Son. The first variable is "gcwera," which is used to give the probability of the time period being either before ANH or after ANH.
DecideUnits is a function that sets the probability of certain units showing up in the pre-ANH time period. The order of the numbers as they relate to each unit is as follows:
You can use this to tweak each map so that if - for example - you don't want Yoda showing up very often on a certain planet, you can set everyone else to a higher value (higher the number the more likely they show). The two versions of Starkiller (light and dark) are not set to show up on the same planet. Neither will Shaak Ti and Maris Brood. If one of these pairings does occur, one of the heroes will be changed to someone else.
DecideUnitsANH is another function similar to DecideUnits, except it is used to set the probability of the certain units showing up in the post-ANH time period. The order of the numbers as they relate to each unit is as follows:
Like in the function DecideUnits, the two versions of Starkiller will not show up at the same time.
Below those, you will see several lines that set basic infantry units for the specific time periods. These should be left alone. Likewise, there is a special line that sets the Bothan Spy to an online or offline version, this should be likewise left alone.
Lower in that same part, where you see "herostrAll..." etc. set is where you will define the heroes and hero support for multiplayer games (where they cannot be random). Each hero has a specific partner that you should (although do not have to) assign to them:
(Light side) Marek and Kota have the elite, Bail has the guard, Old Ben has the clone, Shaak Ti and Maris Brood have the Felucian, Yoda has the Wookiee, (Dark side) Marek and Vader have the commander, the shadow guard has the shadow trooper, and Palpatine has the royal guard.
The heroes for the post-ANH time period have similar requirements. Luke Skywalker should have the Rogue repulsor trooper, Han Solo and Col Serra should have the Renegade Squadron trooper, Galen Marek should have the elite, Vace Thermill the spec ops trooper, Leia the medic, Chewbacca the Rebel tech, Sith Stalker and Darth Vader (post-ANH) should have the ANH stormtrooper commander, Fett the incinerator trooper, Mara Jade and Dengar the storm commando, Bossk the radtrooper, and IG-88 the Imperial tech.
The next thing you should add should be the combo memorypools - this is imperative as there will always be at least two melee unit types (heroes or infantry) on the field at all times:
Right after that, you'll see where your .lua loads the stock ingame.lvl. Before that line, add in the following:
This will make sure that the custom effects that go along with "The Dark Times" are loaded into your mod/map (if you are using these sides, you should be loading these).
Before you go on to adding units, look at where sound is added. You will want to add in these lines:
This will make sure that the CW-related sounds and some new sounds necessary for this mod are loaded in correctly. I spent a lot of time making sure that correct sounds showed up everywhere, so if you're wondering how to get a certain sound setup or if you have sounds not working quite right for something related to this, feel free to ask (there were some "addon" sound .lvls I had to make to make certain maps work correctly with certain vehicles, as well as making sure saber sounds appear for all the GCW sound .lvls).
Next you will want to load your units. The ReadDataFile section in ScriptInit should have this:
This makes sure you can load the files from "The Dark Times" without having to duplicate them in your own sides folder.
Your SetupTeams is next, it should look like this:
Note that in "The Dark Times," the Navy Commando (imp_inf_commando) and the Imperial Gunner (imp_inf_gunner) used the same slot; some maps had the commando and some had the gunner but they were never on the same map.
It is also always wise to set your SoldierAnimation memory pool up high at this time.
--------
That's all you need! It's more complicated than adding regular conquest, to be sure, but I'm sure you'll agree that it's probably worth it. If you have any questions, I'm happy to answer, but please, if you're not sure what you're doing it might be best if you save yourself (and myself!) the time and get some confidence putting together map .luas and/or adding new modes manually first.
You can also add extra scripting in your addme.lua that checks to see whether "The Dark Times" exists on the user's computer (preventing this era from showing up as an option to someone who doesn't have the mod installed), but that is covered in other topics. You would do well to look that up and learn, though.
Here is a full list from the "dark.lvl" (infantry) side's .req file:
Here is a full list of the "lead.lvl" (Jedi heroes) side's .req file:
Here is a full list of the vehicles side (tfuvehicles.lvl), although one should keep in mind that stock vehicles may have special requirements to load in (see some below posts), and all vehicles will need the appropriate sounds:
And finally here is a full list of the space vehicles (dtspace.lvl), which will also need to have their appropriate sounds if you use them:
There are several space vehicles appended with the _ai suffix; you can ignore these as those vehicles are designed to be used only as AI-autopiloted vehicles. There is a TIE Advanced vehicle loaded in there as well that is never used in the mod itself (only the AI autopiloted version was used in Space Anoat), but it should work fine.
First know how to add additional modes manually (editing addme.lua, mission.req, adding mission-specific .req files). If you don't know this, you should learn now.
This tutorial will focus on adding the "conquest" gamemode to your map. Hero support is much simpler, as it doesn't use any of the random/AI features this does, and wave is a custom mode made for each map.
Addme.lua editing
Right after the function AddNewGameModes is defined, add the line:
Code: Select all
ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\dtshell.lvl")
Hidden/Spoiler:
Code: Select all
era_1 = 1
Code: Select all
change = {
era_1 = { name="Dark Times", icon2="darktimes_icon" },
},
Hidden/Spoiler:
Setting up the additional .lua files:
In addition to setting up your ABC1_con.req file (mission-specific .req) and adding ABC1_xxx to your mission.req, you will also need to call for additional scripts in your mission .req to fully use "The Dark Times" sides.
First, download this: http://www.mediafire.com/?jdyp2m9tj5qpam3
http://www.filefront.com/17159566/DT2add.zip (broken - take first link)
[This is updated for Dark Times II: Rising Son. If you've downloaded the previous version, you will need to now download this version as the TFUrandom.lua script has been updated.]
Take the two .lua files (remember, the AIHeroSupport script was made by archer01, and if you use it you need to credit him too) and move them into your "data_ABC\Common\scripts" folder. Open up your mission.req and add "AIHeroSupport" and "TFURandom" to the list of scripts called at the beginning:
Hidden/Spoiler:
Mission .lua editing
Open up your ABC1_con.lua. Make your top look like this (note that ALL and IMP need to be globally and not locally defined):
Hidden/Spoiler:
Code: Select all
ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\core.lvl")
Proceed down towards the end of the ScriptPostLoad section (before "end"). This is essentially just how you set up hero support (and as such is covered in more detail in archer's tutorial), but note that you will need to add the hero support like this:
Hidden/Spoiler:
Move down to just inside ScriptInit. You will first need to add this section:
(This can be just about the first thing in ScriptInit)
Hidden/Spoiler:
DecideUnits is a function that sets the probability of certain units showing up in the pre-ANH time period. The order of the numbers as they relate to each unit is as follows:
Code: Select all
bail, kota, oldben, marekimp, marekall, shaakti, shadow, yoda, sidious, vader, maris
DecideUnitsANH is another function similar to DecideUnits, except it is used to set the probability of the certain units showing up in the post-ANH time period. The order of the numbers as they relate to each unit is as follows:
Code: Select all
vader, sidious, shadow, stalker, fett, dengar, jade, kota, skywalker, solo, colserra, marek, yoda, vace
Below those, you will see several lines that set basic infantry units for the specific time periods. These should be left alone. Likewise, there is a special line that sets the Bothan Spy to an online or offline version, this should be likewise left alone.
Lower in that same part, where you see "herostrAll..." etc. set is where you will define the heroes and hero support for multiplayer games (where they cannot be random). Each hero has a specific partner that you should (although do not have to) assign to them:
(Light side) Marek and Kota have the elite, Bail has the guard, Old Ben has the clone, Shaak Ti and Maris Brood have the Felucian, Yoda has the Wookiee, (Dark side) Marek and Vader have the commander, the shadow guard has the shadow trooper, and Palpatine has the royal guard.
The heroes for the post-ANH time period have similar requirements. Luke Skywalker should have the Rogue repulsor trooper, Han Solo and Col Serra should have the Renegade Squadron trooper, Galen Marek should have the elite, Vace Thermill the spec ops trooper, Leia the medic, Chewbacca the Rebel tech, Sith Stalker and Darth Vader (post-ANH) should have the ANH stormtrooper commander, Fett the incinerator trooper, Mara Jade and Dengar the storm commando, Bossk the radtrooper, and IG-88 the Imperial tech.
The next thing you should add should be the combo memorypools - this is imperative as there will always be at least two melee unit types (heroes or infantry) on the field at all times:
Hidden/Spoiler:
Code: Select all
ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\ingame.lvl")
Before you go on to adding units, look at where sound is added. You will want to add in these lines:
Code: Select all
ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\sound\\tes.lvl;tescw")
ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\sound\\bgl.lvl;bglgcw")
Next you will want to load your units. The ReadDataFile section in ScriptInit should have this:
Hidden/Spoiler:
Your SetupTeams is next, it should look like this:
Hidden/Spoiler:
It is also always wise to set your SoldierAnimation memory pool up high at this time.
--------
That's all you need! It's more complicated than adding regular conquest, to be sure, but I'm sure you'll agree that it's probably worth it. If you have any questions, I'm happy to answer, but please, if you're not sure what you're doing it might be best if you save yourself (and myself!) the time and get some confidence putting together map .luas and/or adding new modes manually first.
You can also add extra scripting in your addme.lua that checks to see whether "The Dark Times" exists on the user's computer (preventing this era from showing up as an option to someone who doesn't have the mod installed), but that is covered in other topics. You would do well to look that up and learn, though.
Here is a full list from the "dark.lvl" (infantry) side's .req file:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler: