Tutorial:RPFM For Dummies

From Total War Modding
Revision as of 04:26, 17 July 2021 by Zeldrake (talk | contribs) (huh, apparently mediawiki doesn't like you linking to images that don't exist yet)

Subtitle: A Reasonably Lengthy And Not-At-All Short Guide to Modding with RPFM – With Pictures

Also an introduction to Zeldrake's usage of Mediawiki. To be honest, I'm surprised at how little broke and how everything's working... it's suspicious. Anyway, on with the guide!

Chapter 0 - Introduction

What are WH2 mods and what can they do?

Broadly speaking, mods are .pack files which contain basically every piece of WH2 data you’ll need – models, stats, text, animations, spells, scripts, numbers. RPFM, Rusted Pack File Manager, is a tool to edit pack files. Therefore, you need to use RPFM for basically every WH2 mod you'll make. This guide will be aimed at WH2, but the ideas are the same for the other games.

It’s also possible to edit pack files with PFM (Pack File Manager) or the TW: Assembly Kit (fondly called asskit), but neither of these are recommended: the former is just old and has a habit of eating your entire mod up, and the second just doesn’t work well for modders. If a guide references PFM a lot it’s quite outdated and you should probably search around for a more updated one.

Also, before you begin, I recommend setting up a folder somewhere to stash your mods, RPFM, and other stuff. We’ll need it later. Mine is C:\REDACTED\OtherGameStuff\Warhammer2ExceptNeat


Chapter 1 - Getting RPFM

The best place to get your hands on RPFM is by checking the #rpfm channel on Da Modding Den Discord server. Chances are the latest version is pinned in the pinned. However, you should also be able to get it from this link. Which, at the moment, looks a bit like this:

RPFMForDummiesImage 01.png

At the time of writing (which is outdated already), the current version is v2.3.2. RPFM will doubtlessly have more additions and changes as time goes on (the change from RPFM v1 to v2 was quite something), but the idea should still be the same: it does things with Pack Files. The buttons might move about, but they should do the same stuff.

As for downloading it: assuming you’re on Windows, it’s the download that has ‘rpfm-something-something-windows’ in it:

RPFMForDummiesImage 02.png

At the moment, RPFM is nicely packaged into a .zip folder, which you can extract with almost anything, but previous versions were packaged into a .7z folder. I reccomend unpacking these with 7zip. 7zip is pretty straightforward to download and install: just grab any of the ones that say "windows" and, if it doesn’t seem to work, try the next one. In any case, 7-zip is beyond the scope of this guide.

Anyway, extract RPFM into your mod folder and you should end up with something like this:

RPFMForDummiesImage 03.png

It’s not truly neccessary, but we’ll make a shortcut to RPFM so we don’t have to get lost down this rabbithole of folders each time we want to open it (and you’ll want to open it a lot). Find rpfm.exe (that’s the program – I don't know what the other ones do. In earlier, or perhaps later, versions of RPFM the executable name might change. Try running things until it works), right-click, and Create Shortcut:

RPFMForDummiesImage 04.png


Select that and move it to somewhere memorable. Desktop works fine – at the moment mine is in my WH2 mods folder:

RPFMForDummiesImage 05.png

That’s RPFM! Open it up and – for this version, in any case – it should look at least a little like:

RPFMForDummiesImage 06.png

(though the icon in the middle of the screen might be different).


Chapter 2 - Setting RPFM Up

Before we start running down rabbit holes of modding, we still need to do a bit with RPFM to get it set up so Everything Works Nicely. Go under PackFile -> Preferences

RPFMForDummiesImage 07.png

and a big box should open up! Don’t worry, we don’t need to worry about most of the stuff in here, but some stuff is very important:

RPFMForDummiesImage 08.png

It’s critically important to fill out the boxes I’ve outlined in red. The first points RPFM to WH2’s mod directory: it’s just the folder where the .exe is (as the handy tooltip demonstrates!) The second points to a fancy shmancy “MyMod” folder. You’ll need to create this and put it somewhere safe - it can be anywhere that isn’t in Program Files. Making a nice big WH2 folder under Documents or somewhere to put everything WH2-related is a good idea.

The blue box isn’t critical, but it’ll save you a bit of effort: defaulting RPFM to WH2 (it’s probably on Three Kingdoms) means less clicks when we start up. The remaining settings can be left at defaults, you don’t need them. From here, everything else is optional. As you can see, I also filled out my path for Troy, because I like to mod that a little, but it’s not needed – we’re modding WH2 so only WH2 needs to be set up! There’s also “Use Dark Theme” hiding in the checkbox list on the left, which is good for modding at 3am when you’re feeling vampiric and bright light destroys you.

Close RPFM and restart it again, just for good measure. (It’s not actually needed for these settings, contrary to the red warning text, but saves us a little bit of clicking).

There’s one more thing we’ll need to do to get RPFM working properly and that is install the Total War: Warhammer 2 Assembly Kit. There’s a neat guide on how to do this by CA here but in short, Steam -> Library -> Tools then install the TW: Assembly Kit.

RPFMForDummiesImage 09.png

It’s important (for RPFM) that the Assembly Kit is installed on the same drive as WH2. Once it’s downloaded, boot up RPFM again and hit Special Stuff -> Warhammer 2 -> Generate Dependencies Cache. (If the button’s greyed out, just open any WH2 packfile you care to name; easily done with Open From Data and clicking on whatever you like).

RPFMForDummiesImage 10.png


It’ll take a minute, but this is really helpful for RPFM’s diagnostic tool that tells you when your keys don’t match up (in short, it lets you know where you goofed up).


Chapter 3 - Making a Mod

Before we begin, it’s worth noting what sort of stuff mods do, and what can even be done:

  • Table editing. Simplest and easiest. A lot of Warhammer 2 information like unit health, building recruitments, what spells do what, what skillpoints do what, dilemmas: almost all data for that is stored in tables.
  • Graphics, Model, Animation, and Effects Editing. I have absolutely no clue how this works so if somebody else could fill in this blank I’d appreciate it. I know textures exist, models exist, and animations exist, but that's about it.
    • You can make new units! From “Handgunners but they’re blue instead of red” to “Treemen with Great Bows” to “Entirely custom floating ships as Tomb King character mounts,” you can basically do anything with the new tools of Phazer’s tools and h3ro’s Asset Editor (fondly nicknamed ‘assed’).
    • You can make new effects (think the shiny things that go off when a spell activates).
    • You can reassign and add new animations, if you’re feeling dedicated enough.
    • What I do know about the above is that it’s all quite difficult, and I would not recommend someone starting out modding to start with this. Search up for other guides – there are some good modding guides on WH2’s Steam mod page.
  • Scripts. While tables specify what stuff exists, scripts can specify how stuff happens. For instance, the Chaos invasion in Mortal Empires is almost entirely script-based. So is Hellebron’s Death Night. Even Encounters at Sea (the ones where you can fight a whole bunch of vampirates) is script. Wood Elf Forest Encounters, Empire Count dilemmas – the list of script-based functionality goes on. Quite often these link into database stuff (sometimes moreso than others – for instance, traits are entirely database defined but actually gaining any trait is script-based)
  • UI Script. Still strictly speaking the realm of script, but stuff that has lots of pretty buttons to press, like the Mortuary Cult crafting, the Wood Elf Forge of Daith, Throt’s Flesh Lab; this kind of stuff. Unfortunately, I’m not familiar with any of it and my understanding is it can be quite difficult to adapt to what you want to do.
    • Again, if someone was willing to fill out a bit more information I’d appreciate it!
  • Startpos. This specifies how things are set up at turn 1 in a campaign. If you’re really screwing with the game (eg: adding new factions) this is necessary, and it’s an absolute pain, earning it the nickname ‘asspos.’ Being a startpos mod also makes it fundamentally incompatible with any other startpos mod, as you can only have one way things are set up in the start of a campaign! Fortunately, if you just want to move a character to a new spot you can do that with script, which is much nicer. There's almost no good reason to mod startpos, so if you are, you shouldn't be.

RPFM’s speciality is table editing'. It can handle scripts pretty well, but ultimately you’re better off writing them somewhere else (Visual Studio Code is good for dedicated scripters), then pasting them into RPFM when done. Additionally, RPFM as a tool combines all the above together – you may have your fancy model and Chaos Knights (Ratling Guns), but you’ll need to put this into RPFM to turn it into a pack file to make it a mod.

RPFM cannot edit startpos (... well, yet) and you’ll need the Total War Assembly Kit to do that, but you should stay away from that unless you have a really good reason to do it (and most reasons aren’t good enough).


With all of this in mind, we’re going to make two simple mods. Firstly, we’ll increase Lord Skrolk’s melee attack to 100. This is going to be a table edit. Secondly, we’re going to make him start in Caledor, instead of where he normally is. You could do that with startpos, but I can’t stress how much of a bad idea that is, so we’re going to use script. We can put these both together in a single mod.

Well, what are we waiting for? Start RPFM from that handy shortcut you made earlier, and beeeeefore we begin, we need to check one thing:

RPFMForDummiesImage 11.png

WH2 needs to be the Game Selected. We are, of course, making a mod for WH2! If this isn’t correct a bunch of silly stuff will happen.

Now, let’s make a mod in RPFM! You can do this the old-fashioned way by PackFile -> New PackFile but RPFM’s MyMod functionality makes everything so much cleaner: open the MyMod menu and hit New MyMod!

RPFMForDummiesImage 12.png

A small box will come up that’s pretty self-explanatory.

RPFMForDummiesImage 13.png

All the text there explains itself. As for name, I like to start with my username, then use underscores to describe a bit about the mod. So I’ll call it aidenpons_lord_skrolk_yes_yes , hit Save, and let’s go!

RPFMForDummiesImage 14.png

Now, we wanted to change Skrolk’s melee attack. That’s going to be in some form of table. So I need to right-click the mod, click Create (not Add! that’s a different table), and then DB (short for database, aka table)

RPFMForDummiesImage 15.png

Click that and a box with a bajillion things in its dropdown box comes up!

RPFMForDummiesImage 16.png

That’s no good, we want melee attack, not fonts! We need to know what table it’s in, and to find this, we have a couple of choices:

  1. Poke the folks on Da Modding Den using one of the #modding-tech channels – a valid call if you’re doing something complicated
  2. Find it yourself like an independent and capable person!

I recommend b) where possible. Don’t worry though, it’s not too difficult. What do we know about melee attack? It might not be called that in the game files though, so we don’t want to search it by name. What else do we know? Well, we know Lord Skrolk has a melee attack. So let’s just run a search through the original CA data and see where he turns up.

Put this aside, and open another instance of RPFM by clicking on that handy shortcut you made previously. After making sure Game Selected is Warhammer 2, left click on PackFile. We have a couple of choices here...

RPFMForDummiesImage 17.png

We want to load WH2’s data so we can search through it all to find what we want. Thanks to improvements in RPFM, we no longer have to worry about thinking which packfile we specifically want: we can just open them all at once using the “Load All CA Packfiles” button.

It’s also worth mentioning Open from Content will open from Steam’s workshop content: handy if you want to check a mod’s pack file, but we don’t want that. Open From Data opens from WH2’s data folder, where both the game’s pack files and mod pack files reside, which explains the massive box that pops up should you hover over it.

Anyway, Load All CA PackFiles, give it a bit to load – it’s a lot of big packs, and we should have something like this:

RPFMForDummiesImage 18.png

... well, that’s not very big! Click on the little > arrow next to the .pack, and a load of folders should expand! Expand the db folder (the folder where all the tables are), and even more folders should come up! ... Okay, that’s why it took this long to load. Expand a random folder and click on its data__ (they all have that name):

RPFMForDummiesImage 19.png

This is a table. In this case, it’s the table that governs how fatigue happens in battle: so you can see climbing walls nukes fatigue at 10,000, when idle changes fatigue by -18 (which probably means fatigue goes down, which checks out with game knowledge).

Anyway, we wanted Lord Skrolk’s melee attack. Well, we know Lord Skrolk has a melee attack. So let’s try finding him! To do that, we’ll use RPFM’s incredibly handy Global Search. Hit View -> Toggle Global Search Window to bring it up.

RPFMForDummiesImage 20.png

(Note: In RPFM v1-ish - which is totally obselete - Global Search was accessed by right-clicking anywhere in the folder view on the left. We’re working with more modern tech though!) A box on the right should pop up as part of RPFM:

RPFMForDummiesImage 21.png

Let’s put Lord Skrolk in the Search bar, hit Search and see what happens! After waiting a bit (around 7s on my machine – shouldn’t take more than a minute by any means), we get some results: (Note: Results may differ depending on what version of RPFM and WH2 is being used, but either way, the idea of global searching still works).

RPFMForDummiesImage 22.png

Huh. Let’s examine one of these more: Click on the > next to the db/character_skills_tables/data__ to expand it, and see what it found.

RPFMForDummiesImage 23.png

Hrm. Double-click that and the table will open.

RPFMForDummiesImage 24.png

Well, we at least got Lord Skrolk. This is clearly a description for something, not melee attack. But if we scroll around left and right, we can see from the Key - which is what a lot of WH2 tables use to refer to something unique (eg: units have keys, projectiles have keys, dilemmas have keys, regions have keys, provinces have keys, building have keys, etc etc etc) that WH2 doesn’t use spaces like we searched and instead uses underscores. So, with that in mind, let’s try searching lord_skrolk instead!

Wait a couple of seconds, and, wow, what a bunch more results! I guess that makes sense for the leader of an entire faction – model, audio, events, and all! And one of these tables is hopefully melee attack...

RPFMForDummiesImage 25.png

We’re currently hunting in db but it’s worth giving a mention to the other tabs. Loc Matches searches inside WH2’s complex text database, and is a really good way to get started on finding something if all you know is its in-game name. Text Matches searches, among other things, script and the bit of a model called a “variantmesh” (don’t ask me what this means because I don’t know) – good if you’re hunting script or models, which we aren’t, so we can ignore it. I have no clue what Schema Matches does and have never needed it so we can hopefully ignore it.

Additionally, feel free to resize the window (drag on various handles that pop up), if you’ve got the screen real estate for it. Anyway, we wanted melee attack. There’s no table that looks like melee_attack, but, scrolling a bit up from the bottom, let’s try main_units_tables?

RPFMForDummiesImage 26.png

land_unit! That’s something! Double-click on that and a new tab in RPFM should open and scroll down to the line needed.

RPFMForDummiesImage 27.png

(Addendum: WH2, this guide, and RPFM have had so very many updates since things began. If you have a keen eye, you’ll see that the top left is called data.pack not warhammer_2, and that Skrolk is at line 709 when currently he’s at line 789. Things change, and I genuinely cannot keep this guide perfectly up to date. When modding, if nothing else, it’s important to be able to think on your feet as things keep changing around you.)

You can see our previous character_skills_tables open in a non-active tab. We really don’t need that anymore and you can close it if you want, we’re taking a look at main_units now.

Scrolling across, we see things like Upkeep Cost, Multiplayer Cost, some voiceover stuff, but nothing that looks like melee attack. Well, this does look like Lord Skrolk (the wh2_main_skv_cha_lord_skrolk seems about right), so we’re probably on the right track. What about that Land Unit? If we hover over the column header in RPFM, it’ll tell us which table this is referencing. (Some columns in tables link other tables together, like this one – but obviously Upkeep Cost doesn’t reference a table!)

RPFMForDummiesImage 28.png

Huh, a table called land_units. Would be nice to find that quickly. There are two ways you can do this: one, fishing the table out by hand. This is actually pretty speedy since if we select a random folder on the left and hit L (for Land_units), the folder view will scroll to the first match of L. (You can type even quicker if you want, typing L A N D _ U N I T S , but that’s too much typing for my fingers).

RPFMForDummiesImage 29.png

Well, lab_settings is definitely not what we want, but if we scroll down a bit, we’ll find land_units_tables.

The other – and much speedier – option is to use RPFM’s handy Go To functionality. Right-click on the cell and Go To -> Go To Definition, and fazam, RPFM will take you right there!

RPFMForDummiesImage 30.png

Either way, we’ve now got land_units_tables open in front of us:

RPFMForDummiesImage 31.png

Now, we really don’t want to scroll through all ten bazillion lines of this table to find Skrolk, but instead RPFM has a handy Filter section just below the table view. Type skrolk in that and it’ll only show rows that match skrolk in the Key section. (We wouldn’t want to search for skrolk in the Category section!) There’s tons of superpowerful stuff you can do with more detailed filters (they support Regex, very powerful for searching), but this simple filter will do:

RPFMForDummiesImage 32.png

Only one hit? That’s usually pretty good, as it suggests this is a Master Node of some sort, linking a lot of things together. Scroll across the table and we some things about mounts, morale, armor, melee weapon, and – what’s this? Melee attack! We found it!

RPFMForDummiesImage 33.png

Now, before we get too excited, this is the data packs of the game themselves. Editing these is a terribly bad idea as it makes there be no way to revert to unmodded short of reinstalling the game, and the reason RPFM won’t let you save your changes if you try. Instead, that’s why we created a mod!

Hop back to the instance of RPFM that has your mod open (or open it again, if you closed it). If you did close it, there’s a super-nifty RPFM trick that allows you to open it super quickly, and it’s under the MyMod menu:

RPFMForDummiesImage 34.png

Super speedy and super handy. Anyway, we’d shut that because we didn’t know what table we wanted, but now we know we want land_units tables! So again, right-click, create, create DB...

RPFMForDummiesImage 35.png

... and this time we know what table we want – it’s the land_units table! Typing in land_units doesn’t quite land the hit we need, but it’s easy to find it from the four in the dropdown box:

RPFMForDummiesImage 36.png

The new_file in the first line will be the name of your table. This isn’t super important – except that it shouldn’t end with a number and should have no spaces in it – but I like to, again, preface it with my name and then have something about the table. So aiden_land_units will do just fine.

RPFMForDummiesImage 37.png

Hit Create, open it up, and it’s blank. Well, of course it’s blank – we haven’t added anything to it!

RPFMForDummiesImage 38.png

Well, we want to put the line about Lord Skrolk in here and change his melee attack. I guess you could re-type everything out by hand if you were feeling like you wanted some bonus suffering, but I like my modding to be an enjoyable experience (which is why I don’t touch startpos), and in RPFM, we can copy and paste rows (and much more!) over! Hop back to RPFM that has data.pack open, and it should be right where we left it. Now – just like Excel – if you click on the row number the entire row will be selected. Right-click somewhere in that row, select Copy, then Copy (the other option we don’t need for this):

RPFMForDummiesImage 39.png

Now hop back to our mod, right-click anywhere in the table view, and hit Paste as New Row!

RPFMForDummiesImage 40.png

Results should look like this!

RPFMForDummiesImage 41.png

Stuff’s a bit squished, but it’s there! Now scroll over to the Melee Attack, double-click to select it, put our nice modded 100 value in, hit Enter, and, that’s done!

RPFMForDummiesImage 42.png

But before we get toooooo excited about using an overpowered Lord Skrolk, there’s two more things we need to do:

The first is save the mod! Ctrl+S does the trick, or PackFile -> Save. The second’s more important: to copy the mod to WH2’s data directory so the mod managers actually pick it up. Instead of fishing up the packfile manually and pasting it over, RPFM does this all with two mouse clicks: PackFile -> Install !

RPFMForDummiesImage 43.png

(Addendum: Previous versions of RPFM had this under the MyMod menu. Again, the buttons might move around and about – it’s important to think on your feet)

Oh, by the way, if you get an error that looks like this:

RPFMForDummiesImage 43b.png

Now our nice little packfile is sitting in WH2’s data directory ready for either the CA mod loader (affectionately called George) or Kaedrin’s Mod Manager (KMM) to pick it up. It’s vitally important to playtest your mods first (and, if nothing else, make sure they load and the game doesn’t crash!), so we’ll do that.

While KMM is definitely superior for managing large amounts of mods and its Profile feature is a godsend, we do actually need the CA mod loader to upload a mod (more on that later), so for this I’ll be using the CA mod loader. Boot it up, and if you scroll down, tadaaaaaaa!

RPFMForDummiesImage 44.png

Enable that, hit Play, hit Play on the obligatory “warning you are modded” menu (does anyone besides me actually read that?), and WH2 boots up with our mod in tow! :D

We could start a new campaign to check things out, but we could also be lazy, and just check things in Custom Battles instead. And will you look at that!

RPFMForDummiesImage 45.png

It woooooooooooooorks! :D


Chapter 4 - Script

To Be Continued...