Jump to content

Editing the storage capacity of a bag of holding, scroll case and/or gem bag


a.greene

Recommended Posts

Hi,

Two questions regarding containers (bag of holding, scroll case and/or gem bag ect...):

  1. What does 'storage capacity' measures? Weight, number of items, something else?
  2. I'm trying to edit the storage capacity of the bag from 2000 to 200, and give it to Kagain as an undroppable item, how would I go about this?

 

ACTION_IF (GAME_IS ~bgee~) BEGIN
  COPY_EXISTING ~BAG31.ITM~ ~override/BAG32.ITM~
  COPY_EXISTING ~BAG31.STO~ ~override/BAG32.STO~
    SAY NAME2 @1
    SAY DESC @2
    WRITE_LONG 0x0022 200

  COPY_EXISTING_REGEXP GLOB ~kagain.*.CRE~ ~override~
    ADD_CRE_ITEM ~BAG32~ #0 #0 #0 ~UNDROPPABLE~ ~INV1~
END

Thank you in advance.

Link to comment

The storage capacity is the number of items, and it's a field in the store file. You've already got the code for editing that, but you have to be careful that you're only applying it to the store and not the item - you don't want to write random nonsense to the "equipped appearance" and "minimum level" fields. Also, it's a two-byte field. WRITE_SHORT, not WRITE_LONG.

Your current code copies the bag item, and makes no changes. Then it copies the store file, writes your new string references to the 4-byte fields at offset NAME=0x8 (which is the "type" field, so you've just corrupted the file with nonsense that isn't one of the five allowed values) and DESC=0x54 (which is half of the field for which dialogue file to source rumors from when donating at a temple). Oops. Do remember that the long list of WeiDU constants for offsets in files mostly reference the CRE format, and elements are in different places across different formats.

Finally, you edit the store's "storage capacity" element, but you write four bytes instead of two. Which doesn't actually break things this time because the next eight bytes are unused and numbers are written in an order friendly to that mistake, but it's not a good habit to get into.

The other thing to watch for is that all bags have the "critical item" flag set, so when a character holding the bag leaves the party, the bag is passed to player 1. If you're making it undroppable, you don't want that. And the flag would still be set in player 1's inventory. So you'd have to remove the flag. But that makes it possible to destroy the bag if Kagain gets stoned/frozen, or have Kagain leave forever due to high reputation - and either way, you permanently lose access to the contents of the bag. Which are likely to include important plot tokens, because that's the sort of thing you put in bags all the time. Either way, not good. I don't recommend going through with this idea.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...