Jump to content


Photo

Duplicate gem bag bug


3 replies to this topic

#1 Miloch

Miloch

    Barbarian

  • Modders
  • 4749 posts
  • Gender:Male
  • Location:At Large

Posted 06 July 2008 - 09:19 PM

Existing fixpack code:
// Amkethran duplicate gem bag fix, part one of three (see amsmug02.sto, bago2j.sto)
ACTION_IF FILE_EXISTS_IN_GAME ~mel01.cre~ THEN BEGIN // ToB-only stuff check
  COPY_EXISTING ~bag02i.itm~ ~override/bag02j.itm~

// Amkethran duplicate gem bag fix, part two of three (see bago2j.itm, bago2j.sto)
  // Amkethran duplicate gem bag fix, part two of three (see bago2j.itm, bago2j.sto)
  COPY_EXISTING ~amsmug02.sto~ ~override~
	READ_LONG 0x34 "4sale_off"
	READ_LONG 0x38 "4sale_num"
	WHILE ("%4sale_num%" > 0) BEGIN
	  SET "4sale_num" = ("%4sale_num%" - 1)
	  READ_ASCII ("%4sale_off%" + ("%4sale_num%" * 0x1c)) "item"
	  PATCH_IF ("%item%" STRING_COMPARE_CASE "bag02i" = 0) BEGIN
		WRITE_ASCII ("%4sale_off%" + ("%4sale_num%" * 0x1c)) "bag02j"
	  END
	END
	BUT_ONLY_IF_IT_CHANGES

  // Amkethran duplicate gem bag fix, part three of three (see amsmug02.sto, bago2j.itm)
  COPY_EXISTING ~bag02i.sto~ ~override/bag02j.sto~
END
This is silly (I know it's from Baldurdash, but that's no excuse :D). Bag02i is not the duplicate - it's bag02d (which appears at 3 stores in ToB - both Amkethran Smugglers and Arledrian). Also, you are copying the (wrong) bag to bag02j, which is used by RoT (thus making a non-duplicate in effect potentially a duplicate).

Code I'm using:
ACTION_IF FILE_EXISTS_IN_GAME ~amsmug02.sto~ THEN BEGIN //ToB
  COPY_EXISTING ~bag02d.itm~ ~override/t-bgem04.itm~ //Gem Bag
				~bag02d.itm~ ~override/t-bgem05.itm~
				~bag02d.itm~ ~override/t-bgem06.itm~
				~bag02d.sto~ ~override/t-bgem04.sto~
				~bag02d.sto~ ~override/t-bgem05.sto~
				~bag02d.sto~ ~override/t-bgem06.sto~

  COPY_EXISTING ~amsmug01.sto~ ~override~ //Amkethran Smugglers 1
	PATCH_IF SOURCE_SIZE > 0x9b BEGIN
	  REMOVE_STORE_ITEM ~t-bgem04~ ~bag02i~ ~bag02d~
	  ADD_STORE_ITEM ~t-bgem04~ LAST #0 #0 #0 ~IDENTIFIED~ #1
	END
  BUT_ONLY_IF_IT_CHANGES

  COPY_EXISTING ~amsmug02.sto~ ~override~ //Amkethran Smugglers 2
	PATCH_IF SOURCE_SIZE > 0x9b BEGIN
	  REMOVE_STORE_ITEM ~t-bgem06~ ~t-bgem05~ ~bag02j~ ~bag02i~ ~bag02d~
	  ADD_STORE_ITEM ~t-bgem05~ LAST #0 #0 #0 ~IDENTIFIED~ #1
	  ADD_STORE_ITEM ~t-bgem06~ LAST #0 #0 #0 ~IDENTIFIED~ #1
	END
  BUT_ONLY_IF_IT_CHANGES
END
I've used my own namespace - feel free to use it or something else - anything that's not going to get duplicated. The redundant REMOVE_STORE_ITEMs are in case anyone's installed Baldurdash or another "fix" for this. (And somewhere along Baldurdash's history, RoT has "used" bag02i somewhere else, so let it...)
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett

#2 Nythrun

Nythrun

    Long since out to pasture

  • Modders
  • 1761 posts
  • Gender:Female

Posted 12 January 2010 - 04:46 AM

If we were going to be breaking saved game compatibility at this late date, it'd be with
COPY_EXISTING 
  amsmug01.sto override
  amsmug02.sto override
	REMOVE_STORE_ITEM bag02d
  BUT_ONLY

Bag02i is a late Bioware patch addition, if Region of Terror is trying to recycle it, it's that mod's own problem.
"You tell lies, too."
"Not I." The witch laughed; her laughter was clear and yet unpleasant. "I used to as a child, I confess. But I soon found the truth more disconcerting."

#3 Miloch

Miloch

    Barbarian

  • Modders
  • 4749 posts
  • Gender:Male
  • Location:At Large

Posted 29 January 2010 - 08:25 PM

That would be the simplest way, sure. What with "developer intent" putting the gem bag in three different stores though, I think they "intended" to have it available in those 3 stores. Not that I care, because I fixed it in Unique Containers anyhow :thumbsup:. But if you *are* going to go with "intent" and clone the bag, at least clone it with a prefix and not to some generic resource other mods (RoT being just one example) might be using/overwriting.
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett

#4 aVENGER_(RR)

aVENGER_(RR)

    Sneaksie!

  • Fixpackers
  • 1008 posts
  • Gender:Male

Posted 09 January 2012 - 10:07 PM

Prefixing the new bags which the fixpack adds seems like the least intrusive solution.

// Amkethran duplicate gem bag fix, part one of four (see amsmug01.sto amsmug02.sto, cdbag02i.sto, cdbag02j.sto)
ACTION_IF FILE_EXISTS_IN_GAME ~mel01.cre~ THEN BEGIN // ToB-only stuff check
  COPY_EXISTING ~bag02i.itm~ ~override/cdbag02i.itm~
  COPY_EXISTING ~bag02i.itm~ ~override/cdbag02j.itm~
END

  // Amkethran duplicate gem bag fix, part two of four (see cdbag02i.itm, cdbag02j.itm, cdbag02i.sto, cdbag02j.sto)
  COPY_EXISTING ~amsmug01.sto~ ~override~
	READ_LONG 0x34 "4sale_off"
	READ_LONG 0x38 "4sale_num"
	WHILE ("%4sale_num%" > 0) BEGIN
	  SET "4sale_num" = ("%4sale_num%" - 1)
	  READ_ASCII ("%4sale_off%" + ("%4sale_num%" * 0x1c)) "item"
	  PATCH_IF ("%item%" STRING_COMPARE_CASE "bag02d" = 0) BEGIN
		WRITE_ASCII ("%4sale_off%" + ("%4sale_num%" * 0x1c)) "cdbag02i"
	  END
	END
	BUT_ONLY_IF_IT_CHANGES

  // Amkethran duplicate gem bag fix, part three of four (see cdbag02i.itm, cdbag02j.itm, cdbag02i.sto, cdbag02j.sto)
  COPY_EXISTING ~amsmug02.sto~ ~override~
	READ_LONG 0x34 "4sale_off"
	READ_LONG 0x38 "4sale_num"
	WHILE ("%4sale_num%" > 0) BEGIN
	  SET "4sale_num" = ("%4sale_num%" - 1)
	  READ_ASCII ("%4sale_off%" + ("%4sale_num%" * 0x1c)) "item"
	  PATCH_IF ("%item%" STRING_COMPARE_CASE "bag02d" = 0) BEGIN
		WRITE_ASCII ("%4sale_off%" + ("%4sale_num%" * 0x1c)) "cdbag02j"
	  END
	END
	BUT_ONLY_IF_IT_CHANGES

  // Amkethran duplicate gem bag fix, part four of four (see amsmug01.sto, amsmug02.sto, cdbag02i.itm, cdbag02j.itm)
  COPY_EXISTING ~bag02i.sto~ ~override/cdbag02i.sto~
  COPY_EXISTING ~bag02i.sto~ ~override/cdbag02j.sto~

Edited by aVENGER_(RR), 15 January 2012 - 01:59 AM.

Retired modder

Rogue Rebalancing - Author
aTweaks - Author
Wizard Slayer Rebalancing - Co-Author
BG2 Fixpack - Contributor



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users