Fallout 2 mod Better Miria mod as RPU patch

debrouxl

First time out of the vault
Endocore's Miria Mod, upgraded by Lionel Debroux
May 2021

Download:
Source code: https://github.com/debrouxl/Fallout2_RPU_Better_Miria .
Alpha 3 release (now containing the high-level .ssl files as well): attached to a post below.

(this README is still basically an update from Endocore's)

Thanks for trying out this Miria mod, and I hope you'll enjoy the enhancements to her character. This mod combines all the functionality of traditional B-Team and later Miria mods, such as:

-- Miria can level up six times, gaining competence (mainly in Small Guns and Energy Weapons);
-- Miria can be asked to wait while the Chosen One pursues solo missions;
-- Miria's appearance changes based on the armor she's currently wearing;

as well as a number of further embellishments I wrote offering a modest marriage-relationship simulation. Talk to Miria frequently to explore this latter aspect of the mod, or ignore the whole thing at your discretion -- the only consequences are in the relationship of the Chosen One to Miria, so the larger game is unaffected.

This mod is compatible with Fallout 2 Restoration Project Update ("RPU", https://github.com/BGforgeNet/Fallout2_Restoration_Project ). If you'd like to make futher changes yourself to this mod, feel free to do so -- this material was originally drawn from a tutorial on making NPC followers Endocore wrote, available at http://falloutmods.wikia.com/wiki/Building_a_Better_Miria_Mod , and I converted the changes to high-level source code, integrating bugfixes in the process. If you come up with something interesting, please share your work with the community -- more mods means more Fo2 playtime means more fun for everyone.


Installation Instructions:
1) Find the directory where you have the Fallout 2 RPU 2.3.3u18 (at the time of this writing) installed on your computer.
2) Uncompress the files in this download to that directory.
3) Start a new game of Fallout 2, or at least, visit Modoc for the first time. Unlike Endocore's mod, for now, this version does not modify global variables (Endocore's documentation mentions this as a potential change, anyway). If you travel to Modoc and woo Miria (Charisma 8 or a good reputation in Modoc plus Charisma 7 is needed to win her over), your journey of married life will begin.

One rather annoying peculiarity of the mod is that due to the original game's lack of animations, if

1) Miria is not currently wearing any armor, and
2) One uses the team dialogue interface to force her to equip weapons for which her base female peasant model has no animations, then:

3) the game will crash.

If Miria is not wearing any armor at all, either let her choose her own weapons at combat time or give her some armor. After all she's your character's wife, so you should take good care of her by giving her some good armor.
Working around this is planned for later.

If Miria is not wearing any armor at all, either let her choose her own weapons at combat time or give her some armor. After all she's your character's wife, so you should take good care of her by giving her some good armor.


Credit is due to:
-- the many folks who have worked on various Miria mods over the years, of course particularly Endocore who made the work I converted, and Stone-D, from whose work Endocore's iteration of Miria drew much inspiration;
-- killap, the RP team and the RPU team, for providing the fine venue of the Restoration Project as well as a number of technical aspects of the present mod;
-- MIB88 and Lexx for suggestions, though I haven't implemented MIB88's one yet :)


Changelog beyond Endocore's version 2

-- Version 3 alpha 3
-- Fixed a bug (my fault) in Cassidy's dialog.
-- Changed the folder structure to match the one used by e.g. Fo1in2, suggested by Lexx.

-- Version 3 alpha 2

-- Converted ectrappr and vccasidy changes from scattered / decompiled low-level source code to a high-level RPU patch, indirectly integrating bugfixes in the process.

-- Version 3 alpha 1

-- Converted a subset of Endocore's work from binary with scattered / decompiled low-level source code to a high-level RPU patch, indirectly integrating bugfixes in the process.
-- At least for now, the mod uses further new local variables instead of new global variables.



Motivation:
I recently finished my first vanilla Fo2 playthrough using Per Jorner's Fo2 walkthrough extensively.
Before playing Fo2, I had noticed the availability of a Better Miria mod able to make her level up. However, at first, I wanted to deal with the challenge of keeping Miria alive throughout the whole game, just like I kept Tandi alive throughout Fo1 + Fixt (both bugfix-only and expanded modes, same ST 7 / PE 7 / EN 7 / CH 8 / IN 8 / AG 8 / LK 2 / Fast Shot + Gifted player character design). In fact, since Miria can be made to wear armor, she's probably easier to keep alive than Fo1 vanilla / bugfix-only Tandi is... only The Enclave Puzzle room is too dangerous for Miria.
Now that I'm done with vanilla Fo2... let's use expanded content :)

Examination:
https://falloutmods.fandom.com/wiki/Building_a_Better_Miria_Mod seems to be the newest version of a code-modifying Miria mod (I noticed the recent sibling topic which modifies the text), by Endocore, and it's based on RP, which is alright.
However, I couldn't find the source code in ready-made, maintainable (.ssl) form, and RP was superseded by RPU; comparing the bits of low-level Miria mod source code against partially macro-expanded higher-level RPU source code showed that there have been bugfixes on the RPU side in the meantime. Therefore, replacing the whole mcmiria script by a decompilation of mcmiria.int is unlikely to be a good idea...

Consequences:
* for the best playing experience, the Miria mod ought to be infused with RPU code somehow;
* in order to ease the job, and forward maintenance or creation of derivatives, the Miria mod needs to be converted to higher-level source code.

=> I set out to perform that, aiming at producing a conversion faithful to the original low-level code.

Initial conversion work progress summary:
* diffed the latest release http://www.mediafire.com/download/69kt6iw2zmdat72/Miria-RP233.7z from https://falloutmods.fandom.com/wiki/Building_a_Better_Miria_Mod against a clone of https://github.com/BGforgeNet/Fallout2_Restoration_Project .
* manually trimmed many hunks of the diff: many changes performed between RP 2.3.3 and RPU 2.3.3 (between release 18 and 19 at the time of this writing) need to be kept;
* applied the diff to the RPU clone;
* copied the new or modified binary files (.pro, mcmiria.int) to the RPU clone;
* decompiled mcmiria.int using the SFall script editor, yielding mcmiria_decompiled_orig.ssl . The binary represents the source of truth;
* manually reordered functions in the decompilation output to make it easier to spot changes in the diff against RPU mcmiria.ssl , yielding mcmiria_decompiled_reordered.ssl (also manually removed the seemingly useless procedure checkPartyMembersNearDoor);
* manually replaced the header of the file with that of RPU mcmiria.ssl , yielding mcmiria_decompiled_reordered_headerfixed.ssl ;
* incrementally cooked up a relatively low-tech conversion script, convert_mcmiria.sh , to perform a bunch of automatic substitutions, into mcmiria_work.ssl . I modified the RPU headers a bit to make my life easier.
* manually integrated bits for ectrappr.ssl (derived from Endocore's documentation) and vccasidy.ssl (decompiled from vccasidy.int).
* I periodically checked that the modifications round-trip properly by compiling and diffing the decompiled mcmiria.int against mcmiria_decompiled_reordered_headerfixed.ssl , fixing the conversion script and/or my modifications to the RPU headers when they changed the meaning of the code in significant ways.

A noteworthy change is that at least for this version, I switched from using new global variables to using new local variables. Endocore's documentation mentions it as a potential change, anyway. The change is trivially undone by commenting out several lines from the conversion and diffing scripts.

Remaining work (TODO):
* apply the insights given by MIB88 (thanks !) for a method preventing the crash occurring when armor-less Miria equips a weapon her character has no animation for;
* make sure that I didn't forget to apply some useful changes from Miria-RP233.7z ;
* when the result of the conversion is deemed alright, simplify those huge if / else towers in the new version of mcmiria.ssl . The fastest route will probably be the combination of a bit of automation and manual fixups (there's only so much the less powerful regexes can do fixing a non-context-free programming language);
* clean up the commit by removing some of the auxiliary .ssl files, possibly the conversion and diffing scripts (but somebody else aiming at doing the same kind of conversion might find some useful bits in there).
* maybe integrate the Davin counterpart to the Miria mod, but clearly, I'll need help for the text ;)


Feel free to use that mod and give me some feedback, as well as feedback on the method. Thanks in advance :)
 
Last edited:
New version, mainly with ectrapper and vccasidy changes, some improvements to the conversion script, and an update to the TODO list (thanks MIB88 for hints).
I tried to update the first post, deleting the attachment in the process, but the page complained that there was spam. The result is that the first version is gone, but that shouldn't be much of a problem, given that this one is a superset of the previous one.

Download:
Source code: https://github.com/debrouxl/Fallout2_RPU_Better_Miria .
Alpha 2 release: attached to this post .


Remaining work (TODO):
* apply the insights given by MIB88 (thanks !) for a method preventing the crash occurring when armor-less Miria equips a weapon her character has no animation for;
* make sure that I didn't forget to apply some useful changes from Miria-RP233.7z ;
* when the result of the conversion is deemed alright, simplify those huge if / else towers in the new version of mcmiria.ssl . The fastest route will probably be the combination of a bit of automation and manual fixups (there's only so much the less powerful regexes can do fixing a non-context-free programming language);
* clean up the commit by removing some of the auxiliary .ssl files, possibly the conversion and diffing scripts (but somebody else aiming at doing the same kind of conversion might find some useful bits in there).
* maybe integrate the Davin counterpart to the Miria mod, but clearly, I'll need help for the text ;)


Feel free to use that mod and give me some feedback, as well as feedback on the method. Thanks in advance :)
 

Attachments

Last edited:
2) Take a look at the files in this download, and make a backup of any files with the same name currently in your Fallout 2 RPU directory in case you want to change back to standard Miria next time.
It would be easier if you just create your own \mods\ folder and drop the files in there. Then you don't need to backup anything. You also won't need to set anything to read-only.
See ettu if you need an example of how this can look like.
 
Thanks for the input :)
I had previously cloned your Fo1in2 repo and updated it multiple times, but I didn't pay attention to this "mods" file tree, let alone the fact that I could take advantage of it...

I have now used your Fo1in2 example to implement what you suggested, and updated the README. This mod should be more usable now. I also fixed a bug I inttroduced in Cassidy's dialog.

Is there a registry of sorts for e.g. critter .pro file numbers, so that mods which follow the same convention can avoid collisions ?

I'll now clean up my two first messages in this thread... EDIT: done.
 

Attachments

Last edited:
Is there a registry of sorts for e.g. critter .pro file numbers, so that mods which follow the same convention can avoid collisions ?
Nah, doesn't exist. You can't really do stuff like that anyways, as .pro files are numbered through. The only thing that would make it work is if the RPU would provide template .pro files which can be overwritten by mods, but that's unlikely to happen.
 
ACK. I understand that this is one of the reasons why the mod load order is important and the interoperability between independently developed mods is hard...
 
I mean, someone could make a base mod update like that. It is very unlikely that the UPU / RPU will get new proto or art files at this point, so someone could make a "rpu_mod_base" which adds 100 of everything as a template, which then can be used by other mods.

The load order then would be rpu -> rpu_mod_base -> mod1, mod2, mod3 ...

It's not impossible, it's just a question of if people would actually use it.

/Edit: Text changes in .msg files from the \game\ directory would still be able to conflict and need to be dealt with manually, though.
 
I think you can emulate level ups with sfall functions without adding new proto files. There are functions to add new msg, too. Although as you change other files too, at this time it's not possible to create true "plug-n-play" Miria mod, but the less you change from base, the easier it would be to make upgrades when a new UPU/RPU release comes out.
As for mods dir, I prefer to package everything into a single dat file (see FO2tweaks, RPU itself, etc), that seems cleaner to me.
 
I'd be happy to help with this however I could, even if it was just writing text to update Davin to the same standard for later inclusion. It always bugged me that Miria and Davin weren't "proper" NPCs and while I can understand Miria got modded first, it's a bit of a shame Davin was passed over IMO.
 
Thanks for the replies :)

I mean, someone could make a base mod update like that. It is very unlikely that the UPU / RPU will get new proto or art files at this point, so someone could make a "rpu_mod_base" which adds 100 of everything as a template, which then can be used by other mods.

The load order then would be rpu -> rpu_mod_base -> mod1, mod2, mod3 ...

It's not impossible, it's just a question of if people would actually use it.
Yeah, whether people would actually use it for mod interoperability going forward (and upgrading old mods) looks like the main roadblock for doing that work.

I think you can emulate level ups with sfall functions without adding new proto files. There are functions to add new msg, too. Although as you change other files too, at this time it's not possible to create true "plug-n-play" Miria mod, but the less you change from base, the easier it would be to make upgrades when a new UPU/RPU release comes out.
For level ups, a quick grep through the sfall headers found npc_engine_level_up, but that's probably not what you had in mind. For new messages, message_str_game and add_extra_msg_file (which raises the issue of file numbering and therefore a centralized registry for maximizing interoperability) ?

As for mods dir, I prefer to package everything into a single dat file (see FO2tweaks, RPU itself, etc), that seems cleaner to me.
Understood. I'm not there yet, and it raises the bar for simple message customization on top of this mod (e.g. https://www.nma-fallout.com/threads/sexual-flavor-edit-for-miria-mod.220321/ ), but I'll write it down in the TODO list next time I produce a release.

I'd be happy to help with this however I could, even if it was just writing text to update Davin to the same standard for later inclusion. It always bugged me that Miria and Davin weren't "proper" NPCs and while I can understand Miria got modded first, it's a bit of a shame Davin was passed over IMO.
That would be great :)
AFAICT, most of the code added to mcmiria.ssl by Endocore, updated by me, could be integrated almost verbatim to mcdavin.ssl, after simplifying these if towers. Messages are much more of a mixed bag...
At the moment, besides reduced connectivity and day job work, I'm slowly making progress on a second game playthrough to check the functionality of the mod a bit further, even if I previously tested the paths where Miria trusts the player enough to tell about her plans by cheating on the value of the tally variable.
 
Over a month later, I've now eaten my own dogfood at length: my second game full playthrough, doing nearly all quests on the good side, with the same ST 7 / PE 7 / EN 7 / CH 8 / IN 8 / AG 8 / LK 2 / Fast Shot + Gifted character as before, is now done. Phew :)
It took nearly the whole game before Miria started trusting the player enough to tell about her plans, despite spending time with her frequently enough, not being a slaver / Made Man for more than a few seconds before turning on the 3 first families, etc. Waiting for days should have had a similar effect, but I'd still have needed to travel to all of the locations she can be interested in settling to, or cheat with the variable's value.

One thing is sure: besides making Miria a significantly better companion, this RPU + Better Miria mod also makes her a much better fighter, able to wield e.g. a Gauss Rifle.
Her accuracy is lower than those of Vic and Cassidy equipped with the same weapon, and unless a Psycho is used on her, she can't fire the Gauss Rifle twice per round, but still: a Gauss Rifle is a large improvement over vanilla Miria wielding a H&K P90c or something like that, with limited accuracy as well.
With Sulik (H&K G11E) + Vic (Gauss Rifle) + Miria (Gauss Rifle) + Cassidy (Gauss Rifle) + Cat Jules (Turbo Plasma Rifle at first, Pulse Rifle after finding a second one) + K-9, the PC at level 34 -> 37 wielding the Pulse Rifle found in the SF Brotherhood building as main weapon, and everyone - even K-9 - under Psycho + Buffout + Mentats, the Enclave in full hostile mode isn't hard.

In the process, I noticed several bugs (I haven't yet checked whether they were inherited), and got a couple improvement ideas:
* a more realistic, time-based handling of Miria's periods and the dude's, if female;
* a tradeoff between "will never leave the player" (vanilla) and "will always happily re-join the player over the party limit" (Better Miria mod). For instance, if she's happy with the player and the player doesn't have terrible karma (causing abusive dialog), Miria could complain about loneliness but she's told to stay here e.g. 3+ times, and refuse to leave the player beyond e.g. 5 times.
I told her to stay here when attempting to recruit Cat Jules after selecting the Magnetic Personality perk, so that she joined again over the party limit... and that's about it. I don't remember why I'd have had to tell her to stay even twice. 5 shouldn't prove to be a problem in a game played in a reasonable way.
In vanilla Fo2, the Enclave Puzzle Room is fairly dangerous for such a low HP character, so if possible, the player needs to heal her frequently somehow; however, thanks to the Party control mod integrated in RPU, she can be trivially made to heal herself until the player fixes the wire.

WDYT ?
 
Last edited:
I am having issues installing this. As instructed, I unzipped the contents of the last uploaded archive to my fallout 2 folder. It created a subfolder 'fo2_better_miria'. Played the game, made it to Modoc, had the shotgun wedding, it's vanilla Miria. Using the latest version of RPU. What did I do wrong?
 
Thanks for your report. I guess that my instructions, mostly copied from Endocore's README, aren't correct or complete enough... sorry for that.

Try moving the file tree contained in fo2_better_miria one level up. I can't check my own computer (VM) at the moment to make sure that this is what I did. One thing is sure, I did not mess with any .ini file.
I suppose that creating a packed up module, as suggested above, and having users chain the modules, would help solve problems such as the one you're describing here.

While playing the game, I lost Cassidy's talking head ability, but I assumed that it was natural, since the mod modifies Cassidy's dialog. Maybe it was due to another interaction with other modules.
 
Thanks for your report. I guess that my instructions, mostly copied from Endocore's README, aren't correct or complete enough... sorry for that.

Try moving the file tree contained in fo2_better_miria one level up. I can't check my own computer (VM) at the moment to make sure that this is what I did. One thing is sure, I did not mess with any .ini file.
I suppose that creating a packed up module, as suggested above, and having users chain the modules, would help solve problems such as the one you're describing here.

While playing the game, I lost Cassidy's talking head ability, but I assumed that it was natural, since the mod modifies Cassidy's dialog. Maybe it was due to another interaction with other modules.
Regarding the Cassidy's Talking head issue, does the mod uses Cassidy's (decompiled and recompiled) .int file? (Referring to vccassidy.int)

If so, did you acquire the .int file from vanilla FO2, or from RPU? If you had gotten the file from vanilla, then it is likely that is causing the missing talking head issue, as Cassidy's talking head was only introduced in RP (&RPU). In that case, you'll have to decompile the RPU script (or get the source .ssl) and add in the changes for the Miria mod.
 
Last edited:
I have decompiled the file from Endocore's better Miria mod, integrated the changes into RPU, and recompiled the modified file. However, the new dialog lines don't have corresponding sound files; I attributed the loss of Cassidy's talking head to this fact, but maybe I was wrong.
 
I'm very interested in this, but it seems to be quite behind the RPU, which is now at v23. Will it work OK?
What is the current status of this, are there problems? Is Cassidy's talking head fixed? What works or doesn't work?
 
Thanks for the heads-up and the interest.
Indeed, my mod could use a rebase. Looking at the commit history, there's been one commit modifying mcmiria.ssl in the meantime. It should be neutral, though: the replacement expressions should be equivalent to the current ones. Fortunately, my relatively painful conversion to a maintainable source form was precisely aimed at making rebases easier :)

I haven't touched the game or anything related to it for over two months... I must say that the full playthrough I made to test the mod took a significant toll on my free time, my amount of sleep and energy, and I've not recovered yet ^^
In its current state, nothing in the mod gets in the way of finishing the game - and as I wrote above, the better Miria, besides being a nicer companion, makes finishing the game easier.

There are three main annoyances:
* per the above, the install instructions being incomplete / incorrect / user-unfriendly, and/or the packaging to a bundle format not being performed. For my own usage, I put the .int files without a mod sub-directory, because I didn't read about the mod loader enough, and I made it work; however, AFAICS, that's not considered user- and mod-friendly;
* Cassidy's talking head being lost - well, I should probably just forego that part of the mod's changes from the main distribution, though I find that some dialog lines were improved by endocore;
* giving unarmored Miria a weapon for which her base, unarmored critter has no animations is supposed to crash the game. That's pretty bad and obviously worth fixing, but it's also trivially avoided by e.g. quickly giving Miria a Leather Jacket - found in Modoc at low cost if the player doesn't have one just yet.

I'm working on a high-priority project at the moment, so no much time for the other projects...
I mean, the rebase should be easy enough, but at least fixing the unarmored critter animation crash (mib88 gave me some insights about that), splitting the Cassidy script and dialog changes apart, sorting out the install instructions and/or learning how to package the mod in a user-friendly way, and most of all doing several hours of testing, is harder to find for me at the moment.

RFS: add several unused local variables in mcmiria.ssl for future use (periods, not wanting to leave a non-abusive spouse too many times, etc.).
 
Thanks for the heads-up and the interest.
Indeed, my mod could use a rebase. Looking at the commit history, there's been one commit modifying mcmiria.ssl in the meantime. It should be neutral, though: the replacement expressions should be equivalent to the current ones. Fortunately, my relatively painful conversion to a maintainable source form was precisely aimed at making rebases easier :)

I haven't touched the game or anything related to it for over two months... I must say that the full playthrough I made to test the mod took a significant toll on my free time, my amount of sleep and energy, and I've not recovered yet ^^
In its current state, nothing in the mod gets in the way of finishing the game - and as I wrote above, the better Miria, besides being a nicer companion, makes finishing the game easier.

There are three main annoyances:
* per the above, the install instructions being incomplete / incorrect / user-unfriendly, and/or the packaging to a bundle format not being performed. For my own usage, I put the .int files without a mod sub-directory, because I didn't read about the mod loader enough, and I made it work; however, AFAICS, that's not considered user- and mod-friendly;
* Cassidy's talking head being lost - well, I should probably just forego that part of the mod's changes from the main distribution, though I find that some dialog lines were improved by endocore;
* giving unarmored Miria a weapon for which her base, unarmored critter has no animations is supposed to crash the game. That's pretty bad and obviously worth fixing, but it's also trivially avoided by e.g. quickly giving Miria a Leather Jacket - found in Modoc at low cost if the player doesn't have one just yet.

I'm working on a high-priority project at the moment, so no much time for the other projects...
I mean, the rebase should be easy enough, but at least fixing the unarmored critter animation crash (mib88 gave me some insights about that), splitting the Cassidy script and dialog changes apart, sorting out the install instructions and/or learning how to package the mod in a user-friendly way, and most of all doing several hours of testing, is harder to find for me at the moment.

RFS: add several unused local variables in mcmiria.ssl for future use (periods, not wanting to leave a non-abusive spouse too many times, etc.).

What does the Cassidy thing enhance? It is possible to use this mod without the Cassidy thing, whatever it is? And without affecting the talking head and such?

If it can be used without the Cassidy thing, could you please at least rebase it and modify the README on your git branch with additional info? (like how to install it... from what I could read here, it's pretty much a file override).

I just wish to download the rebased version to have a package with which I can create a fully functional RPU + Miria + Tweaks installation later before I start LPing the game. :P

Thanks again, from the description of modifications done at a lower programming level (and then the conversions to ssl), it sounds like it was a massive amount of work and time to get it where it is now.
 
Maybe removing mods/fo2_better_miria/scripts/vccasidy.int + mods/fo2_better_miria/scripts/vccasidy.ssl + mods/fo2_better_miria/text/english/dialog/vccasidy.msg after unpacking the latest ZIP I posted would work for the purpose of canceling the Cassidy modifications (slightly better wording IMO for some of the lines + new dialog about Cassidy's family), but I can't test right now, and it's unlikely I can remotely access the appropriate computer tonight (though I'll try)... sorry.

Rebuilding the modifications made by endocore from the text description + the decompiled binaries + the message files under a maintainable form took several days of work indeed. Neither really massive, nor trivial - still, reversing the poorly maintainable way the mod was produced (using a largely automated procedure) was more difficult than I'd have hoped.

EDIT: right before leaving the appropriate computer, I finished the rebase, but for some reason, SSH to Github won't work due to a local issue. Meh.
 
Last edited:
Maybe removing mods/fo2_better_miria/scripts/vccasidy.int + mods/fo2_better_miria/scripts/vccasidy.ssl + mods/fo2_better_miria/text/english/dialog/vccasidy.msg after unpacking the latest ZIP I posted would work for the purpose of canceling the Cassidy modifications (slightly better wording IMO for some of the lines + new dialog about Cassidy's family), but I can't test right now, and it's unlikely I can remotely access the appropriate computer tonight (though I'll try)... sorry.

Rebuilding the modifications made by endocore from the text description + the decompiled binaries + the message files under a maintainable form took several days of work indeed. Neither really massive, nor trivial - still, reversing the poorly maintainable way the mod was produced (using a largely automated procedure) was more difficult than I'd have hoped.

EDIT: right before leaving the appropriate computer, I finished the rebase, but for some reason, SSH to Github won't work due to a local issue. Meh.
The effort is well appreciated.
 
Back
Top