a.greene Posted September 4, 2023 Share Posted September 4, 2023 Hi, Two questions regarding containers (bag of holding, scroll case and/or gem bag ect...): What does 'storage capacity' measures? Weight, number of items, something else? 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. Quote Link to comment
jmerry Posted September 5, 2023 Share Posted September 5, 2023 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. Quote Link to comment
a.greene Posted September 5, 2023 Author Share Posted September 5, 2023 (edited) @jmerry Thank you for your feedback, I will heed your wisdom. Edited September 5, 2023 by a.greene Quote Link to comment
Recommended Posts
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.