Jump to content

Iterate through all Weapons and Modify Them?


Recommended Posts

Basically:

 

I'd like to make a script iterate through every weapon in the game, then modify the damage of said weapon, including any special damage values (Energy and all that) based on <some formulas>.

 

It should NOT apply to any weapons with <some name>.

 

It should operate as a Quest that operates when <time passes> or some other core condition (I'm really not sure how I'd hook this up to a Holotape for real ease of use yet) so that you can add new weapons via mods and this will run, doing its thing.

 

The objective here is, basically, to completely automate making modded and Vanilla weapons have similar-ish damage profiles to Modern Firearms, or to reduce Modern Firearms weapon stats to be more like Vanilla.

 

Currently, the only thing (vaguely) like this is a mod that's only available through Bethsoft / FO4's Mod interface called "Stronger Vanilla Weapons", which changes the damage of Vanilla weapons or all of the based weapon damage, period, through what looks like Perks. It doesn't alter projectile special damages, which is another issue.

 

I can't seem to see how it operates, script-wise, though (I'm guessing that the uncompiled Papyrus isn't available). I don't think how that code works is ideal. It doesn't fix modded weapons if the "Vanilla Only" code runs, so you end up with modded weapons that were vaguely balanced with Vanilla that don't get touched and are under-powered vs. the (modded) Vanilla values and Modern Weapons. But the only alternative is to double the damage of everything, which means every weapon ends up being massively overpowered.

 

I'm very familiar with programming in a bunch of languages, but I'm new to Papyrus, and this seemed like a reasonable task to start with, but I'm really very confused by the documentation; how do we get an Array populated with every Weapon Form via script? From there, how would we check for a string value in the weapon's name (IIRC, Modern Weapons base guns have a string like "MW_*" that could be used for such a filter. If not, that's probably fixable with an overriding ESP that just does that.

 

Sorry for the newbie Q's and if the idea looks good, feel free to steal it, too; honestly, I just wanted a modded experience where mod weapons that aren't Modern Weapons and all of the Vanilla content gets matched up, even if it's a bit rough, and doing it via script appears to be the only way to do it, short of laboriously hand-editing hundreds of data entries.

Link to comment
Share on other sites

All of the weapons in FO4 have a few keywords in common and it is the only thing i can think of that would unify everything and possibly modded weapons too. I know very little about scripting myself but if i had to pick a starting point i guess i would try to find out if you could call up all of the items that use a certain keyword then figure out how to adjust all of the weapons values and multipliers on the object mods from there.

 

Dunno if this will be helpful and thanks for reading through my ramblings.

Link to comment
Share on other sites

Interesting, if changes to base weapon (any object) records are accepted at runtime and will be reflected correctly by all instances. If so, all the rest seems possible (with Script Extender only?), but i think (don't know for sure), there's no way to detect (filter out) base records of a particular type, should be done manually, e.g. a base-game weapons FormList, and optional weapons could be inserted by GetFormFromFile() on GameLoad, can't be fully independent still, filenames and IDs must be known in advance, but is more interesting and versatile route, than hard-linking to "masters".

 

To decompile mod's pex to psc get Champollion https://www.nexusmods.com/fallout4/mods/3742 (unless you wished source code for Papyrus engine itself).

Edited by hereami
Link to comment
Share on other sites

Aha. So, I've <somewhat> figured out how the Vanilla Weapons Script works, even without using Champollion.

 

Essentially, what it does is that it modifies the Vanilla weapon Forms, inserting a tag it uses to filter with.

 

The scripting part appears to be quite a bit more complex than I thought it would be. Apparently it's applying what looks like a Perk to the weapons, like they're Legendaries, that does a damage multiplier, rather than something more straightforward, code-wise.

 

For iterating through the weapons, though, it looks like I'll have to get Champollion installed and see how they did that.

 

But yeah, I want to make it work in a way where it sets damages in a range that "makes sense" universally, with <some formula> deciding what to do. The code they wrote can "fix" Vanilla to be more like Modern Weapons, but it cannot "fix" non-Vanilla modded guns, and even then, the results are a little underwhelming; simply doubling damage values, for example, works OK-ish in some contexts (say, the Vanilla assault rifles and pistols) but not for others (the crazy-low base damage on Miniguns, for example).

Link to comment
Share on other sites

AFAIK there is NO way to modify and persist changes on base records in the game, at least not in this category.

 

There are ways you could achieve this but none of them would be pretty. You'd be better off making the changes in a plugin and calling it a day.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...