Overview
Do you have a favorite mod but want to add another unit from somewhere else? This guide will give a general idea of how to do so by walking you through the process of adding an infantry unit from Battlefront Commander into z3r0x 3.5.
Disclaimer
This guide is meant to give a general idea of unit modding and will not apply to every situation. Most mods use their own file and code layouts, and some will be MUCH MORE COMPLICATED than others. To keep it simple here, we are using code from two mods that keep individual unit data in their own .xml files.
This is mostly meant for personal or private mods. This shouldn’t have to be said, but DO NOT just add a unit or two to someone elses mod and upload it as your own. People work hard on this stuff and we are only copy/pasting bits of their art and code. I take no credit for any of the work done in these mods. If anyone from the Battlefront Commander or z3r0x mods don’t want me to use their work for whatever reason, let me know and things can be changed.
Feel free to ask questions or point out errors.
Required Tools
FIRST you’ll need these two tools from the petrolution mod site. You cannot use custom icons or text strings without them.
-MtdEditor to add the unit icons
[link]
– .DAT editor for the game’s unit text strings
[link]
This guide assumes you’re adding the unit to another mod which has all the required files. If you need to extract something else from the base game’s files, you will also need the .MEG extractor tool found here.
[link]
For editing the game’s .xml code files, any basic text editor will work. It may open with internet explorer by default, but I would suggest using notepad or wordpad.
And if you’re wanting to replicate this guide exactly, here are the mods used.
z3r0x 3.5
[link]
Star Wars Battlefront Commander
[link]
Finding the Rebel Light Elite Soldier model and textures
The unit we are moving over is the “Rebel Light Elite Squad” from Battlefront Commander. We will find the unit’s code file first to get the model name. Sometimes the model and unit will have different names so it’s good to double check.
-Hop to Battlefront Commander’s dataXml folder and find units_land_Rebel_Elite_trooper.XML.
-Open it up with any standard text editor like notepad.
-Find the unit’s Model_Name, in this case it’s Ri_Light_Elite.ALO.
-Go to Battlefront Commander’s dataartModels folder and ctrl+f search for Ri_Light_Elite, since it’s an infantry unit there will be 28 results which cover the unit models (.alo files) and unit animations (.ala files) along with any variants. Copy/Paste the files into your z3r0x dataartModels folder.
—Note some units like vehicles will only have 2 or 3 files and some ships can have half a dozen or more. Just nab any files with the name of your unit to be safe.
-Now go to Battlefront Commander’s dataarttextures and ctrl+f Ri_Light_Elite again. If nothing shows up, try searching for similar variants. In this case, it will bring up 2 .dds files: Ri_elite_norm.dds and Ri_elite_diffuse.dds, copy/paste them both into z3r0x’s dataarttextures folder.
-Since these troopers use a version of the Republic DC15 rifle not already in z3r0x, we will need those textures too. Get Battlefront Commander’s rep_dc15c.dds, rep_dc15c_n.dds, Rep_Dc15Rifle.dds, and Rep_Dc15Rifle_n.dds textures and throw them in z3r0x’s texture folders.
Now that all the proper mesh and texture files have been moved over to z3r0x’s mod, we will get the unit icon.
Unit icons and the MTDEditor
-Open Battlefront Commander’s dataXml folder and find units_land_Rebel_Elite_trooper.XML again.
-Ctrl+f search <Icon_Name> for the unit’s icon name, in this case it’s I_BUTTON_ELITE_LIGHT.TGA
-Now that we know that, boot up MTDEditor.exe
-Click file > open > navigate to Battlefront Commander’s dataarttextures folder. There should only be one Mt_commandbar.mtd, open it.
-Another box pops up, scroll down and select Mt_commandbar.tga
-Once it’s loaded, scroll all the way down to I_BUTTON_ELITE_LIGHT.TGA, right click on it and extract the file to somewhere like your desktop.
-Click file > open > navigate to z3rox’s dataarttextures folder. There should only be one Mt_commandbar.mtd again, open that and z3rox’s Mt_commandbar.tga
-Click Edit > Insert file and navigate to your desktop or wherever you extracted the icon
-Select the I_BUTTON_ELITE_LIGHT.TGA you extracted earlier and click open
-Click File > save
Now that z3r0x’s MTD file has the icon, we’re gonna get the text strings.
Text Strings and the .DAT Editor
-Open Battlefront Commander’s dataXml folder and find units_land_Rebel_Elite_trooper.XML AGAIN.
-We need the <Text_ID> string names for the individual soldier (TEXT_UNIT_ELITE_LIGHT)
-And the unit’s <Encyclopedia_Text> which in this case is (TEXT_TOOLTIP_LIGHT_ELITE_SQUAD)
-And we need the <Text_ID> string names for the company/squad (TEXT_REBEL_ELITE_LIGHT_SQUAD)
-Boot up the DAT editor
-Click File > Open
-Navigate to Battlefront Commander’s dataText folder and open up MasterTextFile_ENGLISH.DAT
-Boot up the DAT editor again so you have 2 instances running
-Click File > Open again and navigate to z3r0x’s dataText folder and open up MasterTextFile_ENGLISH.DAT
—Be sure you remember which window is which mod.
—I’ll be calling Battlefront Commander’s “Window 1” and z3r0x’s “Window 2“
-We have to manually scroll to each entry. There’s no search function.
-Find TEXT_UNIT_ELITE_LIGHT in Window 1
-Double click its line to see the edit string box.
—In window 2 go to Edit > Insert String, the edit string box will pop up.
—Copy/paste the info from Window 1 to Window 2 and click OK.
—–Repeat the past 4 steps for TEXT_TOOLTIP_LIGHT_ELITE_SQUAD and TEXT_REBEL_ELITE_LIGHT_SQUAD
-Close Window 1 (Battlefront Commander’s)
-Click File > save on Window 2 (z3r0x’s)
Now we have the model, texture, icon, and text. Time to finish addding the unit code.
.XML files
-Copy units_land_Rebel_Elite_trooper.XML from Battlefront Commander’s dataXml folder.
-Paste it into z3rox’s dataXml folder.
-Open Gameobjectfiles.xml in z3rox’s dataXml folder.
-Add an entry for units_land_Rebel_Elite_trooper.XML somewhere BELOW the first <Game_Object_Files> line but above the last </Game_Object_Files> line.
—Should look like <File>units_land_Rebel_Elite_trooper.XML</File>
-Save and close Gameobjectfiles.xml
That lets the game/mod read units_land_Rebel_Elite_trooper.XML Now to add the unit to skirmish.
-Open up Specialstructures.xml in z3rox’s dataXml folder.
-Scroll down to <SpecialStructure Name=”R_Ground_Barracks”>
-Scroll further to the <Tactical_Buildable_Objects_Multiplayer> line.
-Add the unit’s company name from units_land_Rebel_Elite_trooper.XML to the multiplayer buildables list below the line that says “Rebel,” and be sure your new line ends with a comma
—In this case it’s Rebel_Elite_Light_Squad
—The proper entry for recruitment is generally going to be a company. When in doubt, look for unit segments that include MULTIPLAYER SKIRMISH VALUES data.
-Save and exit.
Since the troops use non-default projectiles, we have to copy over that info or else the game will crash.
-Open up Battlefront Commander’s PROJECTILES_2.XML
-Ctrl+F search for Proj_Hand_Blaster_Blue
-Select and copy the entire entry for that projectile
-Paste the block into z3r0x’s Projectiles.xml somewhere below the 3rd line of code (past the <?xml version=”1.0″?> and <Projectiles> lines)
-Save and exit.
Wrapping up and troubleshooting
Now you should be able to boot up z3r0x’s mod and recruit the Light Elite squads from the Rebel Barracks.
The unit stats and settings can be tweaked in units_land_Rebel_Elite_trooper.XML. At some point I may do a short guide about unit stat editing, but it’s pretty straightforward. For example:
<Damage> = damage
<Tactical_Build_Cost_Multiplayer> = skirmish price
<Death_Persistence_Duration> = how long corpses stay
Just play around with the settings and do what you like.
Common Issues:
Units T-Pose
– Your infantry are either missing custom animation files (.ala) or reading the wrong ones. Make sure you carried over all the .alo and .ala files that unit uses.
White Textures / petroglyph logos on units
-The unit’s proper texture is missing, make sure ALL the proper files are in the textures folders.
Text says [MISSING]
-It’s not reading the text string in the .dat file, make sure the string name in the .dat file matches the string name in the .xml files.
Game crashes when mouse hovers over unit
-It could be a number of issues, generally it’s either a missing projectile, missing sound file, or GUI issue. It’s harder to troubleshoot and you kind of just have to retrace your steps to see if anything doesn’t match up.
Random crashes or crashing on startup.
-Code problems. Again, hard to track down and there are dozens of possible issues. Recheck your code and look for any errors.
If there are any questions, drop a comment and I may be able to help. If it has something to do with multiplayer or Republic at War though, too many other things are involved and I probably can’t help much.