Fallout 4 mods/Stash Those Caps

Stash Those Caps
SmGRJQ7m.jpg
Developer Greslin
Latest version 1.11
Release date 2017-04-18

DescriptionEdit

Put simply, this mod turns caps into basically what they were in Fallout 3 and Fallout: New Vegas. Give them away. Put them in a safe. Toss them on the ground. Do whatever you want with them. No crafting involved, no workshop workarounds, no charge cards. Just good old-fashioned caps in your inventory, the way God intended it.

Seriously. For real.

HOW IT WORKSEdit

This mod introduces a token called "Bottlecap" as a MISC object, just like normal Bottlecaps - except that it shows up in your inventory. This token acts as a physical interface to your actual caps, sync'ing up whenever either caps or the tokens are added or removed from your inventory. This means that you can put the tokens in a container, give them to an NPC, whatever. When the add/remove event is processed, this mod will resync the numbers and the correct balance will appear as your true cap count.

The one situational exception is when you're bartering. Your inventory bottlecaps will not appear in barter screens, as they are quietly removed before the screen opens. When you exit the barter screen, the script will place the correct number of bottlecaps into your inventory.

All in all, this should work pretty much exactly as it did in FO3/FNV. Your bottlecaps can be found in the MISC section of your Pipboy.

Note: the bottlecap token itself has no weight, so it should not interfere with any other weighted cap mods you may be running.

As always, source code is included in the RAR.

CHANGELOGEdit

  • v1.0 - 4/16/17 - Initial release
  • v1.1 - 4/17/17 - Update to handle cap amounts > 65535
  • v1.11 - 4/17/17 - Bugfix for critical vendor cap problem resulting in cap loss

THE CATCH - VERY IMPORTANTEdit

Warning: DO NOT ATTEMPT TO TRANSFER MORE THAN 65,535 CAPS AT ONCE. YOU WILL LOSE CAPS.

Part of the joy and frustration of doing these kind of mods is bumping up against bugs in the game itself. Some, you can get around. Others you can fix yourself. And others you most likely have to live with, at least for now.

Integers are stored internally as 32-bit values. However, the AddItem() and RemoveItem() functions only process item count numbers as 16-bit values. That means that while an unsigned integer variable can hold values of up to over 4 billion, you can ever only add or remove items from inventory or containers in increments up to 65,535. This is made worse by the fact that the FO4 container/item transfer UI slider is high-limited at the total amount of items (which can go up to 4 billion), but NOT the total amount that can be TRANSFERRED AT ONCE (65,535). If you attempt to transfer more than 65,535 at a time, the number rolls back over to zero.

You can test this for yourself. Go into console and type: "player.additem 00059af8 100000" and see what happens. You won't get 100,000 pencils.

This is a Bethesda bug. They clearly never expected anyone to attempt high count transfers like this. It may be why they opted to not make caps transferable in the first place (I'm guessing to simplify their console ports). Until a) AddItem() and RemoveItem() can handle 32-bit integers, b) the UI slider is fixed to cap the maximum, or c) the F4SE guys give us a better alternative to any of the above, there's likely nothing I can do about it.

You can carry as many as you like, and store as many as you like in a single container. You just can't transfer them in larger increments than the functions can handle. Again, blame Bethesda. Any complaints about this issue (unless you have a clever idea for fixing it) will be roundly ignored.

OPTIONAL FILESEdit

I've also uploaded a "weighted" version that adds a weight of 0.01 (the weight used in the FNV weighted caps mod) to the cap tokens. DO NOT use this version with any other mod that adds weights to caps! You will only double the amount of weight that you are carrying around.

I added the weight to the token rather than the cap itself so that it would also count against companion carryweights.

ISSUESEdit

Version 1.0 cannot handle cap amounts in excess of 65,535 without numerical loss. Be warned.

Version 1.1 fixed this issue about as far as is probably possible at this time, while still not being perfect. See "The Catch", above.

Other than that, we should be good. This is a fairly simple script, and except for the integer issue, it's worked flawlessly in all my own tests. You might see a UI flicker in the Pipboy from time to time, as the numbers sync up. But otherwise, it should run clean without conflicts.

I am aware that sometimes when you withdraw caps from a container, they will remain displayed in the container until you close out the transfer screen. I don't know what causes this, but as the container caps aren't actually playable, it currently seems to be a cosmetic issue rather than a functional one. It'll get fixed as soon as I have a better grasp on why it's happening.

DownloadEdit

ScreenshotsEdit

SmGRJQ7.jpg