Warhammer 40,000: Dawn of War delivers a level of visual detail never before seen in an RTS. Hundreds of units clash on the battlefields of the dark future, unleashing massive destruction through a stunning battery of long-range weaponry before closing in for the finish. Incredible kill animations bring science fiction combat to life like never before, and the gritty future-gothic Warhammer 40,000 setting provides a striking tableau for the chaos and carnage of this grim, dark future, where there is only war!

Post tutorial Report RSS Basic initiation Mod Tutorial for DOW

I presently am almost a zero modding the DoW game. So to start with the basics, i searched, read, browsed, cursed, menaced, hem... well, and what i learned i decided to structure into a small mod tutorial, for people who are also starting.

Posted by on - Basic Client Side Coding

[page=Introduction to the SUPA SERVITOR mod]
(UPDATE: the mod .zip file is available for download here )
(UPDATE: there was a little, but important, detail forgotten about squad files, on day 3. Please read that day again)

I presently am almost a zero modding the DoW game. So to start with the basics, i searched, read, browsed, cursed, menaced, hem... well, moving along, i found lots of stuff, but most of it assumed that the reader had some previous knowledge of bits and pieces that i had no idea whatsoever. So, i decided to start a very simple mod to learn about the basic stuff. And, oh boy, there's a LOT of "basic" stuff just to grasp even before i could start. I decided then after i found out how to turn the first cogs and wheels to make some notes, so i wouldn't forget what i had previoulsly learned, and then i tought it was a good idea to turn them into a REALLY BASICS DoW mod tutorial, for the pople who like me are just landing on this mod scene.

First, this is not a tutorial about it all. No one can do that, each one has their speciality, design, programming, sounds, mapping, etc, so there will be absolutelly NO mentions to modeling, animations, graphics properties, sounds, interface, and all those things. There are other tutorials out there covering those topics, move your butt and find them... :)

Here is the focus of this tutorial: it's about programming, lua scripts, messing with the engine, changing attributes, and those things.Particulary, this tutorial will focus on creating a new unit. it will focus on a lot more stuff i found out, but at the end, you will end up with a new basic unit you can build right from the Marine Headquarter: THE SUPA SERVITOR!!!!! (muhahahahah!!!!)

Also i will describe all the steps i made to find out how to make the supa servitor. This tutorial is going to be sort of a description of my "adventures" in discovering how to make the mod, and in between has all the info (i hope i don't forget many details) you'll need to make the same mod. Ok, ready, set, start your engines....

NOTE: here you can download the finished supa servitor mod files

[page=stardate 25.367.... no, not that, what was it? oh yes: DAY 1]
i wanted to mod something. i din't care what, who, how.... so, as a programmer, i started to look around on how to learn to fiddle with the DOW engine. I found out that all the units, buildings, weapons, even scripts for the A.I. and all were writen in something called LUA scripts. As i already know a bunch of languages and concepts (from SQL to C++ to flashscript to XML to LISP to ....) i decided, i don't need to learn no stinkin' lua, bring it on baby!!
So, i started to look around for these lua scripts in the DOW folder, nowhere to be found. i found out though that in the original DOW engine,

EVERYTHING IS INSIDE .SGA files. (lesson 1) (really basic, eh? ;)

yep. If you need to find something, that's where it is. These files are just like zips, you have to find some program to extract what's inside. i found out that relic has a DOW RDN tools package, so i got it. This is a set of tools that allows you to do lots of stuff, but a lot of it is messing with design, animations, maps, that kind of stuff. I ended up not using anything in it, and instead i found out Corsix mod tools. Got them, instaled them, and i was ready to go. there are other tools out there, you can just try and see wich ones you like best.

Now i was ready to start modding. Using the SGA reader, i browsed to my folder "c:\dawn of war\w40k\" and found several .sga files. The one that caught my eye was the w40kData.sga. Oepning it with the SGA reader (go on, open yours, i'll wait), i found several folders inside. Some are obvious from the name, others are more tricky to find what they're about. Just as examples, the folder "ai" must have stuff about the computer's AI (the obvious part) but the folder "scar" does what, gives you pain? (probably yes, at least to the braincells.... )
Well, there was a folder that caught my eye, the "attrib" one. Oh, this must must be the attributes for the stuff ingame, so let's peek. Hmm, more folders. And more. And in these subfolders there are lots of files. Not good. Ok, so i decided to open one just to see what does a LUA script look like. I chose the file "space_marine_race.lua" in the folder attrib/racebps. Click it, text preview (in my .sga reader) and i saw some lines that got my attention:

_______________________________
GameData = Inherit("race")

....

GameData["race_squad_cap_table"]["base_squad_cap"] = 10.000
GameData["race_squad_cap_table"]["max_squad_cap"] = 20.000
GameData["race_squad_cap_table"]["max_support_cap"] = 20.000
_______________________________

Ok, this rings several bells. First, these squad_cap values are the ones i see in the game. So, if i change them, i should see those changes in a game. Just my luck that i was using an .sga READER, not an editor, or else i'd just go and change them to see what happens. And this is a bad idea, because it can lead to disaster, and fast. So, i was stuck at watching the files, but no idea how to modify them. Now, here goes lesson number 2:

NEVER, BUT EVER CHANGE THE ORIGINAL FILES OF DOW (not quite what you expected, eh?)

The best that can happen is that the game crashes, and you have to reinstall the game, or recover the file. The worst, would be introducing by mistake some bug that could go unnoticed and give you all sorts of odd behaviors, make you loose countless hours of sleep and end up jumping from the 13th floor cursing your bad luck.

I didn't change the files, so i took a long good look instead. Now, here the thing goes technical. You if you don't have coding experience, better get some, or at least read some "programming for dummies" book to grasp the concepts of variables, tables, object oriented programing.... Now, this little file told me two important things: one, that the things in the game (buildings, units, races, strategies, etc) are all objects, as seen by the keyword "inherit". So, important thing to keep in mind, an unit's attributes, for example, ARE NOT ALL in the same file, you'll have to hunt down all the stuff in the object tree. And two, the attributes are stored in multidimensional tables, so one attribute MAY BE (or not) defined not by a single value, but by a bunch of them all connected.

Ok, so the "space marine race" inherits from "race" wich i figured was a base object with common attributes. So, off i went to look at the "race.lua" to confirm my theory, but, gasp, there is no "race.lua", there is a "race.nil" (check it out, i'll wait again 8). WTF?!?! well, i opened it, and saw that it's the same as a .lua file, so drawing on my inmenselly diminute OOP knowledge, i figured it out. .LUA files are actual stuff in the game, while .NIL files are just base blueprints. For the programmers out there, i'm talking about classes and virtual classes. Wich means that in you mod, your stuff should not be created as .nil, always as .lua. What does this help you to create your own supa servitor? nothing, but don't panic when you see .nil files, and take a peek because it can be helpfull. But remember, a .nil is usually used for several objects, so if you modify a .nil file, those mods will show up on ALL the objects that depend on it.
Also, objects can be anything. Just look at the abilities folder. There are lots of .lua files. What does this mean? Means that a commander posesses several objects, and it doesn't matter to the game if it is a power sword or a battlecry. Each one is treated as an "object" that can be described (in .lua files) and used in the game, and the fact that one is a sword that you see on his hand, while the other is a spell makes no difference, it's just names.

So remember, AL THINGS IN THE GAME ARE OBJECTS. ALWAYS LOOK AT THE PARENT OBJECTS TO SEE THE WHOLE PICTURE. (if you're not a programmer, this one will need to sink slow on you)

By this time my trigger finger was itching, so i decided to call it a day and take advantage of the ork hunting season. So, a little summary to clear things:
1. Files are in .sga files. You need an sga reader to see them.
2. Don't mess with the original files, copy-paste the text or extract to another location to play with them.
3. The things in game are all objects, and follow the rules of object-oriented structures (don't know what it is? read "OOP for dummies" or something ;)
4. Each .sga file corresponds to an object used in the game, and the values inside are the attributes. So, the file name itself defines the name of the object.
5. There are .nil files, wich are virtual classes and not to be touched (not at this time anyway), and .lua files that have attributes for "real" things in the game.
6. Usually a .lua file always inherits from another. To really understand the "whole" unit, you have to look at the parent objects also.

and that's it for first day. more stuff to think about than actually to mess with, but all in due time....

[page=DAY TWO - start your engines....]
ok, as the best way to learn is by example, instead of trying to figure out everything by myself, i decided to get some mods and see how it was made. there is a good page here to start the hunt for mods. I got a few to see how they ticked, and decided to take an example from a small one that's easy to understand. To look at other mods, choose small ones that only do a change or two, or you'll get lost in all the files and end up learning not much. I got some mods that installed all by themselves (like the cadian inquisition), and some that were just the files without even instructions for the setup.
Note: I chose the "sergeant terminator" mod, made by Rudy86 (with textures by Xen, wich are not going to be debated in this tutorial) (nice work guys!! 8). In this mod, that you can get here the terminators get a sergeant, and new skins to go with.

From all that stuff i got the structure that a mod should follow. First, how to install a mod. The structure goes like this: first, a .module file, that describes the contents of your mod, and needs to be placed in the base DOW folder. It has the names of the folders and files that are going to be used, and also a header with info about the mod itself.
Here you have the first part of the "supa_serv.module" file (you can open a notepad and paste it there):
;; //////////////////////////////////////////////////////////////////
[global]
UIName = supa servitor
DllName = W40kMod
Description = supa servitor trial by deimosafair || biult on 02/2005
ModFolder = supa_servitor_mod
ModVersion = 0.2
;; //////////////////////////////////////////////////////////////////
There are two important lines here, "ModFolder" and "ModVersion". The engine uses modfolder to search for the files of your mod, so you need to make a folder with that name, "supa_servitor_mod", in your dawn of war base folder. Anything wrong and the engine will not read your files, so it defaults to it's own files, and something goes boom. The other one is the modversion, because the game will ONLY ACCEPT mods of the same version when playing LANs or online. So if you make several versions of your mod, make sure you distribute the right one.

so, MAKE SURE YOU HAVE THE NAMES RIGHT (double check this one). The first time i tried my mod it simply did nothing, and i wandered why. Turned out that i had a file named supa_serv.module and a folder named supa_servitor_mod. But, i was thinking about a blonde beer or something, so i declared the line "ModFolder = supa_servitor" (see the difference?). So i started the mod and the game crashed with the info "cannot find folder". smart, eh? 8)

With the .module file saved in the base DOW folder and my own mod folder created, i went on to look at what i needed next. I opened the file termi.module to see what i could use.

;; //////////////////////////////////////////////////////////////////
;; List of folders to map for this MOD
;; order is important - the first Archives registered will be scanned for files first
DataFolder.1 = Data
DataFolder.2 = Data_Shared_Textures\%TEXTURE-LEVEL%
DataFolder.3 = Data_Sound\%SOUND-LEVEL%
DataFolder.4 = Data_Whm\%MODEL-LEVEL%

;; //////////////////////////////////////////////////////////////////
;; List of archives to load for this MOD
;; order is important - the first Archives registered will be scanned for files first
ArchiveFile.1 = W40kData
ArchiveFile.2 = W40kData-SharedTextures-%TEXTURE-LEVEL%
ArchiveFile.3 = W40kData-Sound-%SOUND-LEVEL%
ArchiveFile.4 = W40kData-Whm-%MODEL-LEVEL%

;; //////////////////////////////////////////////////////////////////
;; List of archives containing localized content to load for this MOD
;; order is important - the first Archives registered will be scanned for files first
LocaleFile.1 = W40kDataLoc
LocaleFile.2 = W40kData-Sound-Speech

;; //////////////////////////////////////////////////////////////////

Then just to compare i opened the w40k.module. And they look the same. The termi.module file is just a copy with a different reference folder. And at the end, the termi file has a line active that goes like this:

RequiredMod.1 = W40k

Well, the termi mod after loading will grab all the rest of the files from w40k itself. Good. Great. Excellent!! And you know why? because a mod does not need to rebuild the whole game from scratch. The good thing about this engine is that relic's guys really built it to last. The original w40k game works for the engine the same way that your own mod does. In fact, i could say that the game is just relic's own mod. And the same as one object inherits from others, so a mod can "call" upon another (or anothers) mod to fill out the things that are left blank. In this particular case, means that the terminator mod only touches the few files it needs to modify, and the rest is grabbed from the original game itself. This saves you the time of needing to rewrite the stuff, or even needing to make a copy of data that's 99.9xxx % the same as the original. For a laugh, try to launch the terminator mod WITHOUT the line above (waiting....). Ok, after the fabulous result you saw, you can understand what the game engine does when it doesn't find critical files. Remember this result, because if you're going into serious modding, this behaviour can give you good clues on what went wrong. And always check the "warnings.log" file to understand exactly what's wrong.

Well, if you really looked at the module file above, you noticed a warning:
ORDER IS IMPORTANT!!!!
This means that if two files define the same object, the first one will take precedence, so if you're going to mod a unit already in the game, make sure that your files load first. I figured out (i hope i'm right) that the file names define the object name in the engine, because in the file code there is no explicit declaration of the name of the class, or object, or entity, or object, or blueprint, or whatever you want to call it. So, the engine just browses through the mod's folders and grabs all the files there. And it does by the order you tell it in the .module file. And then it goes on to the required(s) mod(s) you include.

;; //////////////////////////////////////////////////////////////////
;; Supa servitor module file, stripped to it's bare bones.
[global]
UIName = supa servitor
Description = supa servitor trial by deimosafair || Main texturing by xen
DllName = W40kMod
ModFolder = supa_servitor_mod
ModVersion = 0.2

;; //////////////////////////////////////////////////////////////////
;; List of folders to map for this MOD
;; order is important - the first Archives registered will be scanned for files first
DataFolder.1 = Data

;; //////////////////////////////////////////////////////////////////
;; List of MODs that this MOD requires to work
;; You want to uncomment the below line and put 'W40k' if you want to require the core data for your mod
RequiredMod.1 = W40k
;; //////////////////////////////////////////////////////////////////

This is my complete supa_servitor.module file. After all the endless blabbing i done previously, you can understand why it's so small compared to the files i got my inspiration from. As the supa servitor only needs change of attributes, my mod_folder will only contain the "data" folder (and it's subfolders), so this is the only one that i actually declared. I suppose that a mod that includes extra sounds, models and movies will have also more folders wich would be declared like this:

DataFolder.2 = XXX
DataFolder.3 = XXX
.....

The same goes for all the other stuff i deleted. As i put the W40k as the required mod, the engine will proceed to read the w40k.module file, and actually if i left the stuff in my .module file it would only take extra time of double loading files declared in both .module files.

Uuuf!! so, enough for this day. To finish i only needed to fire up my module. This was the easiest part. Just write a line like this:

c:\whatever\your dow folder\W40k.exe -modname

The module file here is "supa_serv", and you don't have to write the .module extension, the engine already knows that. Then just save it as "supa_servitor.bat" wherever you want. Can be in your DOW folder, in your desktop, or just where you you like, just write the correct path. This line starts DOW using the mod you indicate.
Note that the engine by default searches for a mod called "w40k", so, if you just start "w40k.exe" with no parameters, it's the same as writing "w40k.exe -modname w40k". And, hey, there's a w40k.module file, and lucky me, also a w40k folder. See what i meant when i said that the game itself is just "a relic's mod" ? ;)

Ok, time to breath and go whack some cute little eldar butt. So, for today you already know how to:
1. Build a folder that will contain your mod
2. Build a .module file to correctly call your mod
3. Make the proper declarations in the .module
4. Start your mod from a .bat file

start your engines and vrooom....

[page=DAY 3 - Da REAL stuff!]
Now we get into really interesting territory. First, i looked at the terminator mod to see how it ticked. There are only a couple of files that interested me in there, located in subfolders of data/attrib. Just for the record, there is an art folder in there, but that deals with graphics and sounds, and as i said in the introduction, i won't touch that stuff. As the names show clearly, in "Data\Attrib\ebps\races\space_marines\troops" you have 2 .lua scripts "terminator.lua" and "sergeant_terminator.lua", that will change the attributes of the units. So i went with the sga reader and looked at the folder "troops" of the original w40k. There are a lot of files there, for all the units of the space marines, and as expected, there is no "sergeant_terminator.lua", since this is what the mod is all about. I opened the two mod .lua files, and the original "terminator.lua" to compare. First, both "terminator.lua" files are the same, so no mod there. Then i looked to the sergeant one, and since there is no original w40k file, i tried to compare with the closest thing i could find, wich is the "sergeant.lua". I snooped around, and they're pretty much the same, exept that the terminator sargeant doesn't have the rally ability, and increases morale at a faster pace (hmm, i learned these things from actually playing the mod, duh).

Cool! so, to make my supa servitor, i only needed to copy the servitor file, rename it to supa_servitor and i would have a new twin of the servitor unit ready to suffer my frankensteinian experiences. I created the folder structure i needed inside my "supa_servitor" folder, which is a data, an attrib, an ebps, a races, a space_marines and a troops subfolders, and put there my "supa_servitor.lua" file. I already had my supa_servitor.module file, so off i went to play with my new unit. Started my mod, began a game and ooops, nothing there. I was expecting to find a new unit called "supa_servitor". Clearly, it's not THAT easy.

Ok, so back to ground zero. The terminator mod i figured, didn't exactly create a new unit in the way i wanted. I didn't get a new unit that i could build alone, but an "expansion" to the squad, that was one more of the same with extra abilites. Not quite what i wanted. So from the terminator mod i saw one thing: there is a declaration for a squad with the sergeant, and an assault squad too. They are located in "sbps/races/space_marines". Then i went to check out the original files for squads, and saw something really interesting. There are squad files for all the units.

EVERY UNIT IS A SQUAD. ALL OF THEM.

Yep, even heros and servitors are "one man squads". So, you can't just make the unit, you have to make a squad to "wrap" it in. Ok, so we make a squad file too, no problem. I just opened the original "space_marine_squad_servitor.lua" and made a copy of the code into my "supa_servitor/sbps/races/space_marines/" folder. And good that i remembered this, but i wanted this squad to "use" supa servitors, not normal ones, so i looked around in the file for servitor references to change to supa_servitor. I found this line:

GameData["squad_loadout_ext"]["trooper_base"]["type"] = "servitor"

that i just changed to:

GameData["squad_loadout_ext"]["trooper_base"]["type"] = "supa_servitor"

Wow, some easy stuff for a change....

Back to start the mod,now it's going to be the one, start a game, here goes, put up a skirmish, and nothing. No supa servitor. Again.

Here i decided to start it easy. Instead of doing a new unit, i would modify the servitor to supa servitor. From the termi mod i saw that it was really easy. Just put in my mod folders the "servitor.lua" and "space_marine_squad_servitor.lua" in their places and that was it. By the way, the place for single unit files is inside ebps - "Entity BluePrintS" and the squad files all go inside the sbps folder - "Squad BluePrintS". Then start modding the "servitor.lua" to see what happens. The first few lines gave me a good start. They set the cost of the servitor in requisiton and time.

GameData["cost_ext"]["time_cost"]["cost"]["requisition"] = 75.000
GameData["cost_ext"]["time_cost"]["time_seconds"] = 10.000

Easy. I just modified these values and launched my mod to see if they worked. And yep, i got a regular servitor that cost ONE requisition point to build, and took 3 seconds. Nice.... :D

these are my modded lines:

GameData["cost_ext"]["time_cost"]["cost"]["requisition"] = 1.000
GameData["cost_ext"]["time_cost"]["time_seconds"] = 3.000

Well, as an old fashioned programmer, the first thing i usualy setup is the "hello world" program. So, to keep with the tradition, i went to the the file, and started modding like mad. Found a few lines that looked pretty harmless, and looked like they had strings. You know when you have a variable s = "something", it's usually some text in there..... so , my lines went this way:

GameData["ui_ext"]["ui_info"]["help_text_list"]["text_01"] = "I am the SUPA SERVITOR"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_02"] = "Hello World!!!"
GameData["ui_ext"]["ui_info"]["screen_name_id"] = "Supa Servitor >8]"

And yeah, in the game just try to pass over the servitor to see the text shown by the game. I made a "hello world" mod. From here on is all easy street...... :D

Ok, i wanted a servitor that could kick a commander's ass, cost less than a raindrop, move like a milionaire running from tax collection, and pack enough firepower to put an orbital bombardment to shame. The requirements i already covered. I put these values:

GameData["cost_ext"]["time_cost"]["cost"]["requisition"] = 233.000
GameData["cost_ext"]["time_cost"]["cost"]["power"] = 99.000
GameData["cost_ext"]["time_cost"]["time_seconds"] = 3.000

Note that i added power requirement, just for kicks. Also i put this odd values, to be more easy to spot the mods.

GameData["health_ext"]["hitpoints"] = 7569.000
GameData["health_ext"]["regeneration_rate"] = 12.000
GameData["moving_ext"]["speed_max"] = 55.000
GameData["sight_ext"]["sight_radius"] = 49.000

These are other values that i modded and wich are pretty self explanatory. Put them in, and see what happens.

In my case what happened was that i took my new war machine to the enemy, with 7569 hitpoints, but as soon as i got a few hits the damn thing got morale broken, and was always close to zero on morale. Hmm... right, i didn't touch any morale values, and it looks like it's the same system as the hitpoints. But i screened the servitor file and didn't find any values. Maybe they were on the parent object, the space_marine_troop. Ok, so i went after the .lua file, but then the alarms sounded. The space_marine_troop is not a .lua, it's a .nil file. If you don't know what that means, read the day one again. If i just want to mod the servitor, no way i should be touching a .nil file. And second, there is no reference whatsoever to morale in the space_marine_troop file either. So i had to look elsewhere. I went back to the terminator mod and looked at the files that were altered, and the .lua file for the terminator squad was in the list. Ok, so off i went and opened the squad file for servitor, and bingo, here are the morale attributes. If only remebering why i drank so much last night was this easy.....
I modded then the morale attributes in the Attrib\sbps\races\space_marines\space_marine_squad_servitor.lua to look like this:

GameData["squad_morale_ext"]["default"] = 1111.000
GameData["squad_morale_ext"]["max"] = 1111.000
GameData["squad_morale_ext"]["morale_armour"] = 1.500
GameData["squad_morale_ext"]["rate_per_second"] = 8.000

Great! now i had a super beast that wasn't a wimp at least. I fired up my mod again and went to see the results. And even with 1111 morale points, my servitor got a couple of shots and was broken. and still kept at zero morale. Hmmm, problem here. I don't want a supa servitor that's afraid of any little pop gun. I opened an original terminator squad .lua file, and looked at the morale values. And the terminators have all the values higher except for the morale_armour, that one is way lower that the servitor value. This value the lower the better, it seems, so i modded it to this:

GameData["squad_morale_ext"]["morale_armour"] = 0.200

Aaahh, now it worked as it should. good, i was on my way for my mean lean killin machine. To end the day, i just poked around on these values and got them like this:
GameData["squad_cap_ext"]["squad_cap_usage"] = 2.000
GameData["squad_loadout_ext"]["unit_max"] = 2.000
GameData["squad_loadout_ext"]["unit_min"] = 1.000

You go and find out the results, i'm in a hurry to put my supa servitor to use against some bad boyz... ;)

Ok, so let's make a summary of this productive day, kommerads.
1. Put files in the mod to modify them
2. Learn the difference between an entity file and a squad file
3. Search and mod values inside a .lua file
4. Hunt down the values wanted in the file structure
5. Experiment with the values to fine tune the mod
6. Change already existent units

[page=DAY 4 - Real stuff. For real, this time.]
Ok, we did some damage before, but i wanted to make a new unit, not mess around with the usual servitor. So i renamed the files in my mod to "supa_servitor.lua" and "space_marine_squad_supa_servitor.lua", now i had to go on and actually find a way to build the damn thing.

Thinking that servitors come out of HQs, i decided to take a look at those files. First, in the "ebps/races/space_marines" folder thare are two things: a folder called troops, and another called structures. This looked like a good candidate to start. In there i saw the "space_marines_hq.lua", just what i wanted.
I fund inside these two lines:

GameData["spawner_ext"]["squad_table"]["squad_01"] = "space_marine_squad_servitor"
GameData["spawner_ext"]["squad_table"]["squad_02"] = "space_marine_squad_scout"

And these look suspiciously like the two units that can be built from the hq right from the beginning. And hey, these are exactly the names of the .lua files in the "sbps/races/space_marines" folder. Well, what happens if i add a little line of my own here? So i made a copy of the HQ .lua file into my mod "sbps/races/space_marines" folder, and added this little line:

GameData["spawner_ext"]["squad_table"]["squad_03"] = "space_marine_squad_supa_servitor"

As i scouted the whole file and found no other interesting references to the things that can be made from the HQ, i hoped this was enough. Fired up my mod again, started the game, and this time, voila, there was a third icon, and thy name is SUPA SERVITOR!!! Yeah!! A new monster was born!!!

Now that i already had a new unit, that i already knew how to modify existent specs too, all i needed was to learn how to add new features to my charming four arms beast. You noticed that the servitor unit inherits from the space_marine_troop blueprint. This meant to me that arm the damn thing shouldn't be that hard. Just find the definition of some weapon and splatter it on the .lua script. And what better than a power sword from the FC to start with? ain't gonna take no shit, this supa servitor of mine.... So, i looked in the original .luas and found the blueprint for the FC. From that and comparing with the .luas in the terminator mod, it looks like an unit has hardpoints, whatever they are, and each one supports the definitions for a weapon. Ok, so to make it simple i just copied the lines from the FC related to hardpoint_02, changed it to hardpoint_01 and got this code into supa_servitor.lua:

GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["attack_motion_variable_name"] = ""
GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["hardpoint_weapon_variant_motion_name"] = "Weapon_Melee_Upgrade_Main"
GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["horizontal_aim_motion_variable_name"] = ""
GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["shoot_motion_variable_name"] = ""
GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["vertical_aim_motion_variable_name"] = ""
GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["weapon_table"]["weapon_01"]["name_for_this_weapon_choice"] = "space_marines_power_sword"
GameData["combat_ext"]["hardpoints"]["hardpoint_01"]["weapon_table"]["weapon_01"]["weapon"] = "space_marine_power_sword_force_commander"

I was hoping to see now my servitor with some huge thing dangling around to.... eeh, i just started the mod to see what it looked like. But to my surprise my supa servitor, with a cute terminator voice, yeah i changed it and didn't tell you, shame on me, anyway the servitor had no big power sword in his hand. Ok, you can stop the jokes now. But funny thing, it says on the unit info at the bottom of the screen that it has a lot of melee damage, so something was going on. Compare it the normal servitor just to check. I got my supa thingie to the enemy's base and tested it for a while to kick butt, but, no dice. It just stood around doing nothing. Dang. Then i noticed the "ranged fire stance", but oops, i couldn't change it. Maybe that was why the thing didn't do anything, it didn't have a ranged weapon. So, if all the troops have those buttons and the servitor is the only one with that button "frozen", i went to the servitor files in search of the lines that froze the button. Lucky there are just two files to search, and i found the lines quickly on the servitor squad file, which are these:

GameData["squad_combat_stance_ext"]["default_stance_name"] = "stance_standground"
GameData["squad_combat_stance_ext"]["ignore_building_stance"] = true
GameData["squad_combat_stance_ext"]["ranged_attackrange"] = 0.000

I went and checked other squad files just to be sure, and these lines didn't show anywhere, so i figured they weren't that needed. Off went those lines, and then back to firing up the mod. This time it still didn't have a big sword, but when i attacked at least the bad guys suffered. So, not only i had a big power sword, it was invisible!!! yeah!!

Not really. i learned this part reading a lot on forums and such, that the graphics objects in the game have an hierarchy, sort of, and for a weapon to show up on a model, it has to be placed in that model's description. And i suppose that the power sword is not included in the servitor graphic model. Why, god, why? Anyway, this means that i had the sword, it just wasn't showing up. So i decided to put another weapon, one that would show up. And ranged stuff was a good candidate. Missiles, lasers and stuff "fly away" from the model, so there was a good chance that i would see something. I went to the marine script and decided to rip off the heavy bolter and missile upgrades, and i got these lines:

GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["attack_motion_variable_name"] = "Weapon_Range_Tracking_Main"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["hardpoint_weapon_variant_motion_name"] = "Weapon_Range_Upgrade_Main"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["horizontal_aim_motion_variable_name"] = "Aim_Horizontal_Main"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["shoot_motion_variable_name"] = "Weapon_Range_Firing_Main"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["vertical_aim_motion_variable_name"] = "Aim_Vertical_Main"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_01"]["name_for_this_weapon_choice"] = "space_marines_heavy_bolter"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_01"]["weapon"] = "space_marine_heavy_bolter_tactical"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["muzzle"]["x"] = 0.400
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["muzzle"]["y"] = 2.100
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["muzzle"]["z"] = 0.940
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["name_for_this_weapon_choice"] = "space_marines_missile_launcher"
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["origin"]["x"] = 0.400
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["origin"]["y"] = 2.100
GameData["combat_ext"]["hardpoints"]["hardpoint_02"]["weapon_table"]["weapon_02"]["weapon"] = "space_marine_missile_launcher_tactical"

this was adding two weapons on the hardpoint_2, so i expected to see something this time. And i did. Oh yes i did! Just from the start, the supa had a recharge bar just like marines with missiles, and when i got to the enemy's base, i actually saw the missiles going out. Cool. This means that ranged weapons (some at least) act as "independent" graphic objects, so you can see them on the screen.

And here was my magnificent supa servitor kicking ass all around, and even better, working in teams of two. Ok, after i went back and toyed a bit more with the .lua file, but these are minor details and by now you're such an expert that with just a single look you'll be able to spot them from looking at the file.

Wow! So in this last day i managed to:

1. Make a new unit
2. Modify a building to produce that unit
3. Modify the unit's and the squad's stats
4. Add new properties to the unit, in this case a gun, but could be a spell
5. Put it all together in one packege and make it work

[page=That's all folks!]
And that's it for now. Hope you liked it, and more important, that this tutorial is usefull to you. At least it served to get my ideas into place, and to find out how to make some basic stuff. I got a little zip around here with the complete mod so you can see it in action.

When you start it, you'll notice that this is a very sketched work, there was a lot more to be done to actually make it presentable, but for the purpose defined i think it serves it's purpose. Hope you like to use it as much i liked making it. Now if you'll excuse me i'll get my next tutorial ready, that teaches how to make an whole army of star wars imperial troops, starring good ol' Vader as FC, teaches to model walkers, ion canons, tie fighters, introduces the original voices of han solo and princess leia as seargeants, and.... yeah, dream on.... :)

Good modding to you all!

[page=update to day 3. please read this]
On day 3 i had forgotten to explain about the change of units used in a squad, so that the supa_servitor_squad references supa_servitprs instead of the normal ones.

The change on the squad file is in this original line:

GameData["squad_loadout_ext"]["trooper_base"]["type"] = "servitor"

that i just changed to:

GameData["squad_loadout_ext"]["trooper_base"]["type"] = "supa_servitor"

sorry for who followed my tutorial and couldn't get it to work.

Post comment Comments
Nutterman
Nutterman - - 1 comments

one damm good tutorial

Reply Good karma Bad karma+1 vote
redeemer_28
redeemer_28 - - 1 comments

cant get the ranged weapons working, the game keeps crashing as soon as I select the HQ building. Also i cant build servitor number 2 in the squad, no button to click. And to built it, the name it gives in the HQ building still is servitor no supa_servitor.

please can anybody help me

Reply Good karma Bad karma+1 vote
Jorzaan_the_3rd
Jorzaan_the_3rd - - 1 comments

i wanna know how to make my own army from scratch but other than that this is a really good tutorial

Reply Good karma Bad karma+1 vote
Kiith-Somtaaw
Kiith-Somtaaw - - 1,067 comments

This is a great tutorial. Now i just need to know how the program a building. How do buildings work? Halo

236!

Reply Good karma Bad karma+1 vote
Raging_Demon
Raging_Demon - - 4 comments

WOW! we really feel like noobs :( after all of our other "activities" modding a game is a foreign language to us. The SGA reader refuses to open the space_marine_race.rgd, the reader gives us an error. The new tools are nothing like what you were using. That's alright, our intelect will soon overcome this mere joke of an obstacle. GREAT TUT!! human, keep up the good work.
{LoTi}

Reply Good karma Bad karma+1 vote
BrotherStern
BrotherStern - - 1 comments

my DoW files in W40KData.sga rnt in .lua format, ther in .rdg - im confused... if any1 nos how 2 run thm as .lua, so as 2 not get the error mssg mentioned by raging_deamon, pls e-mail me @ adam666k@hotmail.co.uk 2 xplain how.

Reply Good karma Bad karma+1 vote
modman0
modman0 - - 1 comments

When I used the sga reader to open attrib/racebps, the races all turned up in rgd format! What do I do?

Reply Good karma Bad karma+1 vote
lordofall
lordofall - - 1 comments

Well the reason sgareader doesnt open space_marine_race.rgd is because it isnt .lua and that all I know. The files in W40KData.sga were updated in patchs making them .rgd. First is that before you try what I am about to tell you I am using patch 1.5 so before you try this make sure you are to. And this tutorial is not very helpful now as it was made over a year ago.

But once again if you are only doing simple mods like increasing the squad size, I suggest you download
RGD Editor

But if you want to add a new unit/new race I would advise you to download RDN DOW latest tools 1.41
RDN DOW latest tools 1.41

And use the Attribute Editor provided.
You will need a tutorial to help,so I suggest RDNWiki Attribute Editor tutorial
First you will have to register but it is worth it and it is free.

When using the Attribute Editor firstly remember to read the readme file it tells you how to set up your mod.
But you are already supplied with a My_Mod anyway.

Reply Good karma Bad karma+1 vote
Kiith-Somtaaw
Kiith-Somtaaw - - 1,067 comments

Excellent work lordofall, I wish more people could be as thorough and helpful as that.
Hmmm... What an odd comment I made way back when....

Reply Good karma Bad karma+1 vote
Saber153
Saber153 - - 61 comments

I don't get it but the Rdn thing on relic won't work for me I don't get. I gust got the tools last night and i'm not very good at it.

Reply Good karma Bad karma+1 vote
corleone174
corleone174 - - 71 comments

guys download FinalBIG it will open all BIG files in games you ahve such as the Command & Conquer Generals Games

Reply Good karma Bad karma+1 vote
WesBelden
WesBelden - - 1 comments

Great tutorial; one of the most user friendly and easy to read introductions to an engine I've seen! Many thanks :).

Reply Good karma Bad karma+1 vote
FrancisxXx3164
FrancisxXx3164 - - 38 comments

a want to mod it so in the dark crusade the bodies stay after a melee fight like dow 1 and winter assault can anyone help thanks

Reply Good karma Bad karma+1 vote
Tyranidgod
Tyranidgod - - 6 comments

this is going to be hard to make my mod that is great the exterminators the killing army that exterminats all live its self but allies are Blood ravens a strong eam of externination

Reply Good karma Bad karma0 votes
Tyranidgod
Tyranidgod - - 6 comments

eam is team

Reply Good karma Bad karma+1 vote
DoWKing1995
DoWKing1995 - - 2 comments

Wow. You have a lot of time on your hands to find out how to do this and then write a (almost) fool-proof tutorial!

Reply Good karma Bad karma+1 vote
Guest
Guest - - 687,512 comments

This comment is currently awaiting admin approval, join now to view.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: