This handy reference is intended to help Space Marine enthusiasts modify game attributes. Game attributes define the behavior and settings of characters, wargear, objects and abilities.
Here the focus is on understanding how the game works, how we can modify it and what we need to know to do that. If you're just interested in finished mods, ideas for mods or requests for mods, check out:
[MODS] Majic's Space Marine Mod Workshop
Click here for who this is for, what skills are required, disclaimer, and please don't ask for mods.The following instructions are intended for people who are familiar with computers, file handling, use of tools, editing of XML files that contain a lot of technical-looking data, and troubleshooting. People not familiar with these things should proceed at their own risk.
Everything described herein has been determined by trial and error, experimentation, theorizing, just plain guessing and dumb luck. Any or all of it can be wrong. This post and thread are intended to help people modify their game and are offered as-is with no warranty expressed or implied. In other words, if you screw something up, even if it's because of incorrect information in this guide, don't blame me.
Also, please don't use this thread to ask me to make mods or post mod ideas. We have the mod workshop for that sort of thing. Questions and suggestions regarding game attributes and how to modify the game, however, are very much on-topic here, may help correct or add to the information in this guide, and are greatly appreciated.
Together, I'm hopeful we can compile information that will prove useful to both those who create mods and players who simply like to tinker around under the hood (like me). As my research progresses and more information becomes available, I'll try to update this guide now and then to reflect the state of the art.
NOTE: Research is ongoing and so, for the near term anyway, the guide is very incomplete and subject to frequent revision. Please bear with me during these early days and know that any additional information anyone can provide about various attributes and what they do will be greatly appreciated. For now, I mainly want to get this out there, rough as it is, to help people who are just getting started to know where to look for things. Think of it as a set of notes I'm working with as I explore and experiment with the innards of the game, and you have the right idea.
SECTION ONE: THE BASICS
What you need to know about how to modify the game, working with mod tools and how to use this guide.
Tools You Will Need
Without these, you won't get very far.I can't embed working links yet, so find these threads in this forum and read how to use the following tools:
[TOOL] Space Marine Tools
[TOOL] BAF (attr_pc) <-> XML converter
I also suggest using a text editor that can gracefully handle XML files, like Notepad++. It makes working with the deeply-nested XML structures much, much easier than trying to deal with them in a no-frills text editor, such as the basic Notepad which comes with Windows.
By default, Notepad++ will detect and properly display XML files, and has useful features such as tag balance guidelines, collapsible structures and so on.
The instructions that follow will generally assume you know how to use these tools, so be sure to read the threads where they are found and the instructions that come with them.
Working With OPPC And ATTR_PC Files
What you need to know about extracting, modifying and installing them.Working Directories: Good Housekeeping Practices
First and foremost, it is strongly recommended that all modification work be done outside the game installation directory. Create working directories in the location of your choice, and you can safely make changes to them without mucking up your game's directories. Once you have made the changes you want, you can copy the modified files to a special directory called “preview” under your game's main directory, as explained below.
OPPC Files: Packages
OPPC archives are like ZIP files that are used to store large numbers of files in a single, easy-to-manage package. These packages are kept in the data\packages subdirectory under your game's main installation directory (typically C:\Program Files (x86)\Steam\steamapps\common\warhammer 40,000 space marine\).
Using Santos' Space Marine Tool (smoppc.exe), you can extract files from these packages. It is a command-line tool, but if all you need to do is extract files, you can simply drag the OPPC file you want to unpack and drop it on the smoppc.exe icon.
Once the files are extracted from the OPPC package, we can modify them. There are several different types of files stored in these packages, but the ones we are interested in here are ATTR_PC files. Dawn of War 2 modders may consider these files the Space Marine equivalent of RBF files, since they serve the same purpose.
ATTR_PC Files: Attributes For The PC Game Version
To modify the ATTR_PC files, we need to first convert them to XML format using Copernicus' BAF <-> XML converter. That tool provides a simple graphic interface which allows conversion of all files in a specified directory.
Once you have converted the ATTR_PC files you want into XML format, they can be modified. The XML files are text files that can be edited with a text editor such as Notepad, Notepad++ (highly recommended) and the like. Only text editors that don't use formatting data (i.e., not Microsoft Word or programs like it) should be used, otherwise they will insert the formatting data into the XML file, which will corrupt it and prevent it from working.
You will probably need to associate the .xml file extension with your text editor. To do that, right click on an XML file and choose “Open with...”. If your text editor appears on the list, select it. If not, select “Choose default program...” to browse for it in your program directory. Once that's done, you can just double-click on an XML file to open it for editing.
With the XML file open and editable, you can make changes to the various attributes specified. XML files use tags enclosed in angle brackets or “chevrons” to delimit key and value fields in a manner similar to HTML.
As with HTML, the main thing to remember is that the tags must be valid and must be balanced (that is, there is a closing tag for each opening tag, such as <tag></tag>). For our work, we don't want to change the tags themselves, just the data between them.
Value, Key, Type, Data
The XML files we're working with are organized into keyed values with specified data types. Inside the file, they take the following format:
The keyname can be thought of as a variable name and the data as the value of that variable (Key = Data). The datatype specifies the kind of data, such as a boolean value, integer, float, table and so on.Code:<Value> <Key>keyname</Key> <Type>datatype</Type> <Data>data</Data> </Value>
For our purposes, the only thing we'll be changing is data. Everything else should be left as is. Any careless change to the format of these files can cause them to break and potentially cause the game to crash on startup. If that happens, reverse the changes you made or disable the preview folder as described below.
Installing The Modified ATTR_PC File In The Preview Folder
Once you have made the changes you want to the XML file, convert it back to the ATTR_PC format using the BAF <-> XML converter. To get the game to load it, we will be installing it in a subdirectory of the preview folder.
The preview folder is a special folder used to load (or “preview”) files that aren't included in the OPPC packages. If the game finds a file in the proper subdirectory of preview, it will load it instead of the corresponding file in the OPPC package. Thus the modified files we put there will take precedence over the unmodified files.
To get the game to check the preview folder on startup, launch it with the -usepreview command line switch. For Steam users, that can be done by right-clicking on the game's entry in your library, selecting “Properties...” and putting the switch in the “Set Launch Options” field. If something goes terribly wrong with a modification and the game won't start, remove the -usepreview switch or the preview folder and the game should run normally.
If the preview folder doesn't already exist, create it in your game's installation directory. To install ATTR_PC files in the right place, you will need to create the proper subdirectories under preview.
Under the name of each ATTR_PC file listed in the guide is the pathname where it should be installed. If you put your modified file in the right subdirectory, it should work.
Except when it doesn't. Things are still very experimental, and Santos is still working on the OPPC tools. Some things work, others don't.
Experiment and enjoy the thrill of discovery.
How To Use This Guide
How the guide is organized and what to expect.There are a lot of attributes in the game, and I'm attempting to list as many of them here as I reasonably can. To make things easier to locate, I have divided the attributes into categories based on the files where they are found.
Note that there are many attributes that are not included here. Rather than try to tackle everything, I prefer to focus on the attributes in which most people are likely to be interested. I'm happy to add more if anyone wants. Just ask.
The attribute key names are listed as found in the XML files produced by Cope's BAF <-> XML converter. This makes it possible to search for these keys and find them in the appropriate file.
Along with each key may be a blurb describing the attribute and what it does, or at least what I know about it. In cases where the key's function is obvious or unknown, it will be listed as-is. If you see a key that doesn't have a description, know what it does and would like to add it to the guide, let me know.
Please note that some keys may be found in several places in the file, and may do different things depending on what table they are in. Some keys may be table names and not contain a single value, but a table structure.
The key names are usually not listed in alphabetical order in this guide. In most cases, it's clearer to group them together by function. Each key may also have a default value in parentheses, to make it easier to reset if you change it and decide to revert.
Unless otherwise specified, pathnames are relative to the Space Marine installation directory.
Along with these references, I have included a “cookbook” which explains how to make certain changes, such as god mode or infinite ammo, and various handy tips. It may duplicate info in the reference sections, but does so in the name of expediency. If you want to do something and don't want to hunt it down in the key listings, check there.
Now on to the good stuff.
SECTION TWO: GAME ATTRIBUTES
Descriptions of packages, attribute files, attributes and what they do.
EBPS (ebps.oppc) Entity Blueprints: Captain Titus, Actions And Objects
Entity blueprints describe various things found in the game environment such as the player avatar (Titus), NPCs (Non-Player Characters), their behaviors, objects found in the maps such as ammunition crates, and actions, such as doors opening and closing.
Vanguard (vanguard.attr_pc) Captain Titus
This file contains such attributes as player health, armor, fury, movement, default wargear and so on.
We can rebuild him. We have the technology.health_max (100) Your maximum health.
health_regen_delay (0) The amount of time out of combat before health regenerates.
invulnerable_health (0) Set to “1” for God Mode.
health_regen_rate (0) The rate at which health regenerates, per second.
armourshield_max (100) Your maximum armor.
armourshield_regen_delay (5) The amount of time out of combat before armor regenerates.
armourshield_regen_rate (33) The rate at which armor regenerates, per second.
auto_fury_change_per_sec (0) How much fury is automatically added per second without having to fight.
fury_use_per_sec (6.25) Set to “0” for infinite fury. Watch out, though. This means once you activate fury, it will never stop, and that golden glow can be hard on the eyes after a while.
allow_fury_gain_while_active (False) Can also theoretically be used to allow infinite fury under certain circumstances.
default_wargear (Table) A list of wargear that Titus has if not otherwise specified. Can be superseded during the game by upgrades and map-specific loadouts.
default_wargear_entry (String) Key name of a piece of wargear in the default_wargear table. Though it looks like a file pathname, the actual file in which the wargear is defined may be different.
biped_locomotion_ext (Table) Contains various parameters related to player movement. Note that not all of them seem to work as expected.
Ammo Crates (pickup_ammo.attr_pc, pickup_grenades.attr_pc) Ammo And Grenades
Get your bullets and bombs here.replenish_wargear_ammunition (Table) These tables specify how much of each type of ammo to replenish.
For a technique to make all in-game ammo boxes infinite, see the cookbook.
WARGEAR (wargear.oppc) Wargear: Weapons, Armor And Abilities
Wargear refers to things that modify or are carried by the character. Wargear can thought of as items or abilities that can be “worn” and, in some cases, removed or upgraded.
Notes, speculation and theories on wargear.Most of this subsection had to do with problems resulting from the early tools producing a flat directory output structure, in which files with the same names overwrote each other. All that is obsolete now.
Currently, we can modify every piece of wargear and achieve some pretty amazing results. My current efforts are focused on migrating various weapons not normally found in Titus' inventory into available slots by making them drop-in replacements for the pistol and bolter. So far, that has been working well.
There are some odd and unexplained problems with some weapon attributes, with animations and effects offering many mysteries. However, through trial and error, I am developing a clearer idea of how things work, and will try to keep the guide reasonably updated as we zero in on the functions and effects of the various wargear attributes.
Weapons (*.attr_pc) Common Attributes
These are attributes common to most weapons.NOTE: These may be found in more than one place and can be different for different weapon modes or firing conditions. Which one does which will tend to vary from weapon to weapon.
Key (Table) The top level key name identifies the wargear. It looks much like a file pathname but actually identifies the location of the wargear table within the overall game data structure, and the filename may be different.
shot_cooldown () The time between bursts or the time that must pass after a shot before pulling the trigger will allow another shot.
time_between_shots () The interval between shots in a burst. This sets the weapon's cyclic rate of fire.
burst_length () The number of shots fired per burst. “0” is infinity.
instant_fire (True) May indicate that the weapon fires as soon as the trigger is pulled rather than waiting for it to come into position. Or something.
wait_for_weapon_ready () If set to “True”, the next shot won't be fired until the weapon has finished its sound and firing animation. Set to “False” to allow higher rates of fire.
max_range () The maximum range of an ability the weapon has. This can be firing, reloading and so on. In general, the largest value is the maximum firing range of the weapon. Ranges for other abilities should probably not be changed without understanding the consequences. When aiming at targets beyond firing range, you won't see the aiming reticle light up.
damage_fall_off (Table) A table containing damage multipliers based on range. As the name implies, damage values tend to fall off with distance. However, it's worth noting that bolt weapons should actually increase in damage with range, since they accelerate as long as their propellant holds out. In general, though, I find it best to either leave things as they are or set all the multipliers to "1".
common_data (Table) This contains data that is the same regardless of weapon mode.
slot (equipment/melee/pistol/ranged) Determines which inventory slot the weapon occupies.
capacity_clip () The number of rounds per clip.
recharge_delay () The amount of time before a charge-based weapon will start recharging.
ammo_recharged_per_second () Used for charge-based weapons, but can also be used to automatically replenish ammo in other types of weapons.
ammo_used (Table) Amount of ammo used per activation of an ability, usually firing a shot.
low_ammunition_amount () The reload prompt will display when this value is reached.
capacity_reserve () The maximum amount of ammo you can carry for this weapon.
capacity_reserve_infinite () Set to “True” for infinite ammo.
damage_general () Damage per shot. There may be more than one of these depending on mode.
damage_material_multipliers (Table) Determines how much health damage is inflicted on different types of targets.
armourshield_damage_material_multipliers (Table) Determines how much armor damage is inflicted on different types of targets.
trigger (Table) Contains wargear\trigger_policy which can be used to set the firing mode to either semi_auto or full_auto. This is often set in more than one place depending on weapon or fury mode.
use_auto_aim () Set to “True” to enable auto aim, “False” to disable it.
zoom_levels (Table) Contains zoom settings for weapon sights.
fov_1/fov_2/fov_3 () Field-of-view values for each zoom level, in degrees. The lower the value, the higher the zoom.
num_zoom_levels () Total number of zoom levels.
visual_name () A package that determines the name and icon of the weapon as displayed in the weapon selection HUD.
visual_package () This sets the graphic and animation package for the weapon. By changing this, you can change the appearance of the weapon in-game.
SECTION THREE: APPENDICES
Various items of potential interest to game mod makers.
APPENDIX A: Majic's Attribute Cookbook
Tasty recipes and shortcuts for a more appetizing Space Marine.These are some of the techniques I have used for making mods and tinkering with things. As time permits, I'll try to keep things reasonably current in this subsection, but please be aware that some things may be out of date.
God Mode (Easy)
Now you too can be a god. Best of all, it's really easy. Just pop open ebps.oppc/vanguard.attr_pc and locate the invulnerable_health key. Set the value to “1” and you're good to go.
Infinite Ammo For A Single Weapon (Easy)
Locate the wargear.oppc/*.attr_pc file for the weapon of your choice and convert it to XML. Find the capacity_reserve_infinite key and change it to “True”. This makes the weapon behave like a heavy bolter or plasma pistol in that you'll see an infinity symbol in the weapon's ammo display. With this key set to “True”, not only will you never run out of ammo, but you'll never have to change clips, either.
Alternatively, you can set all the ammo_used values to zero, so that no ammo is used in the first place.
Give Titus The Storm Bolter (Easy)
Find the default_wargear table in ebps.oppc/vanguard.attr_pc and add the following entry to it right after the entry for the bolter:
The same technique can be used to give him other weapons as well, although pistols and bolters are special cases that can cause unexpected problems, and only two other weapons will be loaded (into slots 3 and 4).Code:<Value> <Key>default_wargear_entry</Key> <Type>String</Type> <Data>wargear\wargear\race_marine\weapons\2hand_ranged\rifle\storm_bolter</Data> </Value>
Infinite Ammo Crates (Intermediate)
In ebps.oppc, locate the files pickup_ammo.attr_pc and pickup_ammo_infinite.attr_pc. Replace the entire interactive_ext table in the normal crate with the interactive_ext table in the infinite crate. Now the crate will never disappear and you can refill from it all you want.
Note that you can include all ammo types in both types of crate, so you always get plenty of everything. However, be warned that modifying the grenade crates this way seems to disable the ability to get grenades when you encounter the first grenade crate in Pasrt1, Chapter 2, The Trenches.
Also, just copying everything over produces invisible crates that work, but can be hard to find. I presume they are invisible because the graphic entities for invisible crates aren't loaded on maps where they aren't normally found. I have only seen them in the pit Warboss Grimskull throws you into for his showdown.
Majic's Sniper Autocannon (Intermediate)
This is something I whipped together to make up for only having the autocannon during a ridiculously short period at the end of the bridge fight. It uses the multiplayer sniper rifle with its nice boomy report as the base weapon, then makes it fully automatic and gives it the autocannon's explosive impact effect. This version doesn't do AOE damage, but it's powerful enough anyway that you probably won't notice.
The base weapon is (sm_mp_ranged_sniper_rifle.attr_pc). The first thing to do is replace all instances of “semi_auto” with “full_auto”. Then set all instances of wait_for_weapon_ready to “False”. Then set all cases of shot_cooldown and time_between_shots to a small number. I like 0.333 for that: slow enough to sound big, but fast enough to wreak havoc.
The default sniper rifle damage is plenty, but if you prefer to adjust it, change all instances of damage_general to your damage of choice. If you set it to a really high number, anything you hit will be insta-gibbed. Great for making Ork puree.
I also modified the scope to give me three levels of zoom, including a very tight focus to allow me to choose which eye I want to shoot. These can be adjusted under zoom_levels. I used 22.5, 5 and 1.5 as my values, with num_zoom_levels set to 3.
If you hate running out of ammo like I do, set capacity_reserve_infinite to “True”. And Real Men Don't Use Auto-Aim, especially when sniping, so you may want to set use_auto_aim to “False”.
Then, optionally, you can copy the hit_fx table from an autocannon file for the full effect. I prefer to use servi_turret_autocannon.attr_pc for that, because the Chaos versions tend to have weird warp effects, and I like a good, clean autocannon, thank you very much. Just replace the hit_fx table in the sniper file with the autocannon version and you're set.
This gives you a weapon that can be fired from the hip as an autocannon, and used with the scope to snipe. The 3 RPS rate of fire is fast enough to cause major devastation, but slow enough to allow you to pop off single shots when sniping. I made the lowest zoom level rather weak to make it usable at closer ranges, so you can use the scope when auto-gunning down your enemies like the damn dirty dogs they are.
Now that you are armed with this nasty piece of holy weaponry, get on out there and show the enemies of man who the badassest space marine is.
Infinite Ammo For All Weapons (Advanced Skill Required)
This one's tricky, and is still in the experimental stage. It involves copying a modifier from pickup_tripod_heavy_bolter.attr_pc and inserting it into something else, such as a wargear file. So far, I've tested this on the iron halo and the sprint ability, and it works.
However, it only works when you start a game from a checkpoint. If you start it from “Continue”, it doesn't work. The reason for that isn't clear, but may be due to state information such as abilities and ammo being saved during checkpoints as the campaign progresses. These wouldn't be loaded when you start from a generic checkpoint. Or something like that.
The basic theory behind this modification is that some tripod-mounted weapons like the heavy bolter convert your ammo usage to infinite while you mount the gun. By copying this modifier over to something you always wear, like wargear, it bestows that characteristic on all your weapons.
I've included a copy of the relevant table here, but if you prefer to get it straight from the source, you can search for infinite_ammo in the heavy bolter file and it will take you to the right place.
This needs to be inserted into an appropriate table in the destination file. I find while_deployed_actions to be suitable (for now). You need to insert it in the commands section. Other tables like lifetime_actions can also work.Code:<Value> <Key>apply_modifiers</Key> <Type>Table</Type> <Data> <Value> <Key>$ref</Key> <Type>String</Type> <Data>action_commands\apply_modifiers</Data> </Value> <Value> <Key>modifiers</Key> <Type>Table</Type> <Data> <Value> <Key>modifier</Key> <Type>Table</Type> <Data> <Value> <Key>$ref</Key> <Type>String</Type> <Data>modifier</Data> </Value> <Value> <Key>exclusive</Key> <Type>Boolean</Type> <Data>True</Data> </Value> <Value> <Key>modifier_type</Key> <Type>String</Type> <Data>infinite_ammo</Data> </Value> <Value> <Key>operation_type</Key> <Type>String</Type> <Data>enable</Data> </Value> <Value> <Key>amount</Key> <Type>Float</Type> <Data>1</Data> </Value> </Data> </Value> </Data> </Value> <Value> <Key>lifetime</Key> <Type>Float</Type> <Data>-1</Data> </Value> <Value> <Key>stop_policy</Key> <Type>String</Type> <Data>immediately</Data> </Value> </Data> </Value>
There is probably a much easier way to do this, and testing is still ongoing, but for the adventurous, here's what I have so far.
APPENDIX B: Unanswered Questions And Areas Requiring Research
Mysteries, conundrums and queries for inquiring minds.
Where are Titus' pistol and bolter wargear files? (FOUND!)
I have searched the wargear archive thoroughly and am simply not able to find the definitions for these weapons. Other weapons used by him also seem to be missing. The workaround is to use multiplayer weapons, and most work reasonably well. But animations for some projectile weapons may be missing, probably due to the projectile ebps not being loaded.
UPDATE: The extraction process previously produced a flat directory structure for output. Since many files have the same name, many were being overwritten by other files with the same name. Now that Santos' tool outputs files into the original directory structure, the files can not only be found, but kept in their proper directory location for loading into the game.
How Can We Give Titus Heavy Weapons Like The Heavy Bolter And Autocannon?
As with Titus's other weapons, the heavy bolter and autocannon he tears off of tripods and uses (all too briefly) in the campaign don't seem to appear in the wargear package. Clues might be found in the ebps for the tripod-mounted weapons, but so far no luck there. Giving Titus a multiplayer heavy bolter or autocannon only results in him standing empty-handed and unable to move. Needless to say, it would be nice to figure out how to equip him with these weapons as normal inventory items like other weapons. In the meantime, the storm bolter makes a nice substitute, and without the movement restrictions.
UPDATE: I have developed a heavy bolter based on the default bolter which serves as a drop-in replacement for it. It's not a perfect solution, as it is held like a bolter and not lower down like an exotic weapon, but it does work and does allow exotic weapons to be used as swappable inventory items. It can be found in the mod workshop thread.
APPENDIX C: Acknowledgments
Credits and thanksThanks to Santos and Copernicus for making the tools that enabled me to research attributes. Without them, none of this would be possible.
Thanks to Morat for researching how the attribute files work and sharing that information. It is what inspired me to look into things further, and here we are.
Thanks also to everyone who is working on mods for this fine game. Hopefully, through our combined efforts, we may be able to add more to it, bring ever greater richness to the world of Space Marine and get more bang for our gaming buck.