CamDawg Posted January 17, 2006 Share Posted January 17, 2006 I wrote a little tool to help me find odd things in creature inventories--unequipped weapons, shields in armor slots, bows without arrows, etc. Between it and Near Infinity's tools, I've put together a fairly large number of patches for inventory funk. First, the easy ones: typos in resource references. ///// \\\\\ ///// creatures with invalid item fixes \\\\\ ///// \\\\\ // resref typo COPY_EXISTING ~genie01.cre~ ~override~ ~genie02.cre~ ~override~ ~genie03.cre~ ~override~ ~genie04.cre~ ~override~ ~ppdjinn.cre~ ~override~ ~trgeni02.cre~ ~override~ ~trgeni03.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "b3-18" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "b3-18m3" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~cor.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "2hsw02" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "sw2h02" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~pirexe01.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "blunt06" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "blun06" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~senani03.cre~ ~override~ ~sendro03.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "bwbolt01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "dwbolt01" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~gorje.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "cham01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "chan01" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~cuphaer.cre~ ~override~ ~drow05.cre~ ~override~ ~udchal.cre~ ~override~ ~udphae02.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "dwcha01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "dwchan01" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~sahspc01.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "ghost01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "ghost" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~pirsea01.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "leath01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "leat01" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~cultist1.cre~ ~override~ ~excult1.cre~ ~override~ ~excult2.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "leath04" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "leat04" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~gorwom01.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "rdntre03" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "rndtre03" #8 // corrected resref END ELSE PATCH_IF ("%item%" STRING_COMPARE_CASE "rdntre04" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "rndtre04" #8 // corrected resref END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~demosum4.cre~ ~override~ ~gorcamb.cre~ ~override~ ~gorcamb6.cre~ ~override~ ~gorcamb7.cre~ ~override~ ~hgfel01.cre~ ~override~ ~telimp1.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "rngdemn" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "ringdemn" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~arntra01.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "sh1h04" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "sw1h04" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~tirthold.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "staff01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "staf01" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~gorsta10.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "umber1" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "umber01" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // resref typo COPY_EXISTING ~laune.cre~ ~override~ READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "vamp01" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "vamp1" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // Varscona is unique; repacing all references save Catti-Brie's with generic +2 sword COPY_EXISTING ~C6BRAN.cre~ ~override~ // Branet Al-Thon ~C6ELF1.cre~ ~override~ // Elven Warrior ~C6FAKE.cre~ ~override~ // Elhan ~C6GENER.cre~ ~override~ // General Sovalidaas ~C6GOD.cre~ ~override~ // Elven God ~C6KACH2.cre~ ~override~ // Kachiko ~C6KALDEN.cre~ ~override~ // Kalden ~C6LEVIN.cre~ ~override~ // Levin Rayn ~C6NERIT.cre~ ~override~ // Nerit ~C6WILL.cre~ ~override~ // William Reirrac ~CUPRIS1.cre~ ~override~ // Elven Warrior ~CUPRIS2.cre~ ~override~ // Elven Warrior ~E34.cre~ ~override~ // Coran ~RIBALD.cre~ ~override~ // Ribald ~SUELF12.cre~ ~override~ // Captain Aduo'on ~SUELF13.cre~ ~override~ // Elven Warrior ~SUELLEG1.cre~ ~override~ // Elven Warrior ~SUENDEL1.cre~ ~override~ // Elven Warrior ~SUENDEL2.cre~ ~override~ // Elven Warrior ~SUENDEL3.cre~ ~override~ // Elf Male ~SUENDEL4.cre~ ~override~ // Elf Female ~SUENDEL5.cre~ ~override~ // Elf ~SUENDEL6.cre~ ~override~ // Elf READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "sw1h06" = 0) BEGIN // find Varscona WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "sw1h41" #8 // replace with Long Sword +2 SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES // icgob02 has overlapping refs COPY_EXISTING ~icgob02.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 SET "dupe" = 0 FOR (index2 = 13; index2 < 17; index2 = index2 + 1) BEGIN // search through quiver slots READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 3) BEGIN // dupe reference in quivers PATCH_IF ("%dupe%" = 0) BEGIN SET "dupe" = 1 END ELSE BEGIN WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) 1 // removes dupe reference SET "index2" = 17 // kills loop END END END BUT_ONLY_IF_IT_CHANGES The last chunk is a fix we discussed a while back to make Varsona unique again. Link to comment
CamDawg Posted January 17, 2006 Author Share Posted January 17, 2006 Next I tackled invalid references. Many creatures had items listed in their inventories but not actually assigned in their inventory slots. These I examined individually--the majority of them were redundant entries and just got deleted. Some, though, merited being assigned to inventory. Some were also caused due to another inventory item being assigned multiple times by mistake. The latter I had to address before the rest of the changes. // icgob02 has overlapping refs COPY_EXISTING ~icgob02.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 SET "dupe" = 0 FOR (index2 = 13; index2 < 17; index2 = index2 + 1) BEGIN // search through quiver slots READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 3) BEGIN // dupe reference in quivers PATCH_IF ("%dupe%" = 0) BEGIN SET "dupe" = 1 END ELSE BEGIN WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) 1 // removes dupe reference SET "index2" = 17 // kills loop END END END BUT_ONLY_IF_IT_CHANGES // both have dupe ring ref in weapon slot instead of weapon COPY_EXISTING ~impqua01.cre~ ~override~ ~kuocle20.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ((("%item%" STRING_COMPARE_CASE "impqua" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "impqua01" = 0)) OR (("%item%" STRING_COMPARE_CASE "blun33" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "kuocle20" = 0))) BEGIN WRITE_SHORT ("%slot_off%" + 0x12) "%index%" // puts in primary weapon slot END END BUT_ONLY_IF_IT_CHANGES // has armor in weapon slot, weapon not assigned (fixed later) COPY_EXISTING ~ppsail03.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "leat01" = 0) BEGIN WRITE_SHORT ("%slot_off%" + 0x02) "%index%" // puts in armor slot END ELSE PATCH_IF ("%item%" STRING_COMPARE_CASE "sw1h20" = 0) BEGIN WRITE_SHORT ("%slot_off%" + 0x18) "%index%" // puts in primary weapon slot END END BUT_ONLY_IF_IT_CHANGES // rskel03 has dupe entries for throwing axes COPY_EXISTING ~rskel03.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "ax1h04" = 0) BEGIN SET "exists" = 0 SET "insert" = 0 FOR (index2 = 9; index2 < 13; index2 = index2 + 1) BEGIN // search through weapon slots READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%index%" = "%ref%") BEGIN SET "exists" = 1 SET "index2" = 17 // kills loop END ELSE PATCH_IF (("%insert%" = 0) AND ("%ref%" = 0xffff)) BEGIN // if null entry, set insert point SET "insert" = "%index2%" END END PATCH_IF ("%exists%" = 0) BEGIN PATCH_IF ("%insert%" = 0) BEGIN // no insert point found already FOR (index3 = 21; index3 < 36; index3 = index3 + 1) BEGIN // search through weapon slots READ_SHORT ("%slot_off%" + ("%index3%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN WRITE_SHORT ("%slot_off%" + ("%index3%" * 0x02)) "%index%" // adds reference END END END ELSE BEGIN WRITE_SHORT ("%slot_off%" + ("%insert%" * 0x02)) "%index%" // adds reference END END END END BUT_ONLY_IF_IT_CHANGES // sewyag03 has dupe quiver reference COPY_EXISTING ~sewyag03.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 SET "dupe" = 0 FOR (index2 = 18; index2 < 36; index2 = index2 + 1) BEGIN // search through quiver slots READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 4) BEGIN // dupe reference in quivers PATCH_IF ("%dupe%" = 0) BEGIN SET "dupe" = 1 END ELSE BEGIN WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) 3 // removes dupe reference SET "index2" = 36 // kills loop END END END BUT_ONLY_IF_IT_CHANGES // number of creatures with dupe entries for rndtre05 COPY_EXISTING ~drush.cre~ ~override~ ~ogrema01.cre~ ~override~ ~ogrmag01.cre~ ~override~ ~plshom01.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "rndtre05" = 0) BEGIN SET "exists" = 0 SET "insert" = 0 FOR (index2 = 18; index2 < 36; index2 = index2 + 1) BEGIN // search through quick slots & inventory READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%index%" = "%ref%") BEGIN SET "exists" = 1 SET "index2" = 36 // kills loop END ELSE PATCH_IF (("%insert%" = 0) AND ("%ref%" = 0xffff)) BEGIN // if null entry, set insert point SET "insert" = "%index2%" END END PATCH_IF ("%exists%" = 0) BEGIN FOR (index3 = 21; index3 < 36; index3 = index3 + 1) BEGIN // search through weapon slots READ_SHORT ("%slot_off%" + ("%index3%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN WRITE_SHORT ("%slot_off%" + ("%index3%" * 0x02)) "%index%" // adds reference END END END END END BUT_ONLY_IF_IT_CHANGES // has shield in armor slot, armor not assigned COPY_EXISTING ~kpsold06.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "chan04" = 0) BEGIN WRITE_SHORT ("%slot_off%" + 0x02) "%index%" // puts in armor slot END ELSE PATCH_IF ("%item%" STRING_COMPARE_CASE "shld05" = 0) BEGIN WRITE_SHORT ("%slot_off%" + 0x04) "%index%" // puts in shield slot END END BUT_ONLY_IF_IT_CHANGES // items to be deleted COPY_EXISTING ~amwyvern.cre~ ~override~ ~bazdra03.cre~ ~override~ ~bearbr01.cre~ ~override~ ~bearca01.cre~ ~override~ ~bearpo01.cre~ ~override~ ~bhelm.cre~ ~override~ ~bodhi.cre~ ~override~ ~bodhi2.cre~ ~override~ ~bodhiamb.cre~ ~override~ ~braiwa2.cre~ ~override~ ~c6bodhi.cre~ ~override~ ~c6drizz.cre~ ~override~ ~c6drizz2.cre~ ~override~ ~c6drizz3.cre~ ~override~ ~c6guen.cre~ ~override~ ~c6guen2.cre~ ~override~ ~catjag01.cre~ ~override~ ~catjagsu.cre~ ~override~ ~catjagwp.cre~ ~override~ ~catlio01.cre~ ~override~ ~catliosu.cre~ ~override~ ~catliowp.cre~ ~override~ ~catlis01.cre~ ~override~ ~catpan01.cre~ ~override~ ~cefald02.cre~ ~override~ ~chevil02.cre~ ~override~ ~cubodhi.cre~ ~override~ ~deck622.cre~ ~override~ ~dopgre01.cre~ ~override~ ~dopple01.cre~ ~override~ ~dragyell.cre~ ~override~ ~drizzt.cre~ ~override~ ~e32.cre~ ~override~ ~famimp.cre~ ~override~ ~famqua25.cre~ ~override~ ~famquas.cre~ ~override~ ~firkra02.cre~ ~override~ ~fsridd.cre~ ~override~ ~genie1.cre~ ~override~ ~golsan01.cre~ ~override~ ~hellho01.cre~ ~override~ ~hellil01.cre~ ~override~ ~idjinni.cre~ ~override~ ~kgenie1.cre~ ~override~ ~kgenie2.cre~ ~override~ ~korgan8.cre~ ~override~ ~korgan9.cre~ ~override~ ~korgan11.cre~ ~override~ ~korgan12.cre~ ~override~ ~lacedo01.cre~ ~override~ ~lacedo02.cre~ ~override~ ~mumgre01.cre~ ~override~ ~nwyvbab.cre~ ~override~ ~obsdem04.cre~ ~override~ ~plywyvrn.cre~ ~override~ ~ppbhaal.cre~ ~override~ ~pries12c.cre~ ~override~ ~resuna.cre~ ~override~ ~riftcr03.cre~ ~override~ ~rngsta01.cre~ ~override~ ~rskel01.cre~ ~override~ ~sahlace.cre~ ~override~ ~sendai2.cre~ ~override~ ~sahoty01.cre~ ~override~ ~shape.cre~ ~override~ ~skele2.cre~ ~override~ ~skelet01.cre~ ~override~ ~skelhp1.cre~ ~override~ ~tranim03.cre~ ~override~ ~trevil05.cre~ ~override~ ~trgeni01.cre~ ~override~ ~uddeath2.cre~ ~override~ ~udlesa.cre~ ~override~ ~vbearca.cre~ ~override~ ~vvamn1.cre~ ~override~ ~weregrdr.cre~ ~override~ ~wolfdi01.cre~ ~override~ ~wraithsu.cre~ ~override~ ~wyvbab01.cre~ ~override~ ~ysfire02.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 READ_LONG 0x2c4 "fx_off" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ( ("%item%" STRING_COMPARE_CASE "b1-8" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "bearbr01" = 0) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "b1-12" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "bearpo01" = 0) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "scrl25" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "bhelm" = 0) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "s2-16" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "bodhi" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "bodhi2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "bodhiamb" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6bodhi" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "cubodhi" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "boot01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "c6drizz" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6drizz2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6drizz3" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "drizzt" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "s1-12" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "c6drizz" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6drizz2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6drizz3" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "chevil02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dopgre01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dopple01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "drizzt" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "p1-8" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "c6guen" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6guen2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "catjag01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "catjagsu" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "catjagwp" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "catpan01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "cefald02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "tranim03" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "trevil05" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "wolfdi01" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "p1-10" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "catlio01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "catliosu" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "catliowp" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "hellho01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "hellil01" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "p1-12" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "catlis01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "s3-8m3" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "deck622" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "b3-18" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "genie1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "idjinni" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "kgenie1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "kgenie2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "trgeni01" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "ax1h02" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "korgan8" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "korgan9" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "korgan11" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "korgan12" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "ghast1" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "lacedo02" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "ghoul1" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "lacedo01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahlace" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "rods05" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "obsdem04" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "sw1h01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "ppbhaal" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "resuna" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "b2-8" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "sahoty01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "blun21" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "sendai2" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "sw2h01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "uddeath2" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "dwsw1h02" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "udlesa" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "b1-10" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "bearca01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "vbearca" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "s1-12m2" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "weregrdr" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "s1-8" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "wraithsu" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "giafir2" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "ysfire02" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "plat01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "braiwa2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "pries12c" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "leat04" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "e32" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "chan01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "vvamn1" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "dragyell" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "bazdra03" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dragyell" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "dragyell" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "bazdra03" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "misc52" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "amwyvern" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "firkra02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "nwyvbab" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "plywyvrn" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "wyvbab01" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "vampreg2" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "bodhiamb" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "immune1" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "famimp" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "famqua25" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "famquas" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "fsridd" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "golsan01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "mumgre01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "riftcr03" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "shape" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "misc50" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "rskel01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "skele2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "skelet01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "skelhp1" = 0) ) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "rngsta01" = 0) ) ) BEGIN FOR (index2 = 0; index2 < 36; index2 = index2 + 1) BEGIN // search through slots to alter references READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = "%index%") BEGIN // if deleted item WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) 0xffff // removes reference END ELSE PATCH_IF (("%ref%" > "%index%") AND ("%ref%" != 0xffff)) BEGIN // if higher index than delted WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) ("%ref%" - 1) // decrements by one END END DELETE_BYTES ("%itm_off%" + (0x14 * "%index%")) 0x14 // deletes item SET "itm_num" = ("%itm_num%" - 1) WRITE_LONG 0x2c0 "%itm_num%" SET "index" = ("%index%" - 1) PATCH_IF ("%fx_off%" > "%itm_off%") BEGIN SET "fx_off" = ("%fx_off%" - 0x14) WRITE_LONG 0x2c4 "%fx_off%" END PATCH_IF ("%slot_off%" > "%itm_off%") BEGIN SET "slot_off" = ("%slot_off%" - 0x14) WRITE_LONG 0x2b8 "%slot_off%" END END END BUT_ONLY_IF_IT_CHANGES // items for quiver COPY_EXISTING ~bhaal01.cre~ ~override~ ~dragblac.cre~ ~override~ ~elekob01.cre~ ~override~ ~kobcom01.cre~ ~override~ ~kobsla01.cre~ ~override~ ~plmetg02.cre~ ~override~ ~sahcpt02.cre~ ~override~ ~sahpri02.cre~ ~override~ ~sahramb1.cre~ ~override~ ~sahrnt01.cre~ ~override~ ~sarevok.cre~ ~override~ ~swsfoll1.cre~ ~override~ ~swsfoll6.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ( ("%item%" STRING_COMPARE_CASE "arow01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "elekob01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "kobcom01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "kobsla01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "swsfoll1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "swsfoll6" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "arow07" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "plmetg02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dragblac" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "arow11" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "dragblac" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "bolt01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "sahpri02" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "bolt04" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "sahrnt01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "bolt06" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "bhaal01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sarevok" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dragblac" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "bull03" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "dragblac" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "sahbolt" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "sahrnt01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahcpt02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahramb1" = 0) ) ) BEGIN FOR (index2 = 13; index2 < 36; index2 = index2 + 1) BEGIN // search through quiver slots and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // first null reference in quivers WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END PATCH_IF ("%index2%" = 16) BEGIN // if end of quiver slots, skip ahead to inventory SET "index2" = 20 END END END END BUT_ONLY_IF_IT_CHANGES // weapons COPY_EXISTING ~c6coran.cre~ ~override~ ~centeo01.cre~ ~override~ ~cowled.cre~ ~override~ ~duearc01.cre~ ~override~ ~e32.cre~ ~override~ ~firmon02.cre~ ~override~ ~gith04.cre~ ~override~ ~gorgith2.cre~ ~override~ ~gorkuo05.cre~ ~override~ ~jaerto1.cre~ ~override~ ~jaerto2.cre~ ~override~ ~kchild1.cre~ ~override~ ~kuowhi01.cre~ ~override~ ~pirmur02.cre~ ~override~ ~pries18c.cre~ ~override~ ~rumar01.cre~ ~override~ ~sahextra.cre~ ~override~ ~sarjai01.cre~ ~override~ ~swshaman.cre~ ~override~ ~tethto.cre~ ~override~ ~tethto2.cre~ ~override~ ~vvshad1.cre~ ~override~ ~vvshad4.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "ax1h01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "duearc01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "b1-2" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "kchild1" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "blun04" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "pries18c" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "blun05" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "tethto" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "tethto2" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "bow01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "firmon02" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "bow03" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "c6coran" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "dagg01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "vvshad1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "vvshad4" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "dart01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "cowled" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "staf02" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "rumar01" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "sw1h01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "jaerto1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "jaerto2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "ppbhaal" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "resuna" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "sw1h05" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "sarjai01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "sw1h07" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "pirmur02" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "sw1h08" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "swshaman" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "sw2h01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "e32" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gith04" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gorgith2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "uddeath2" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "sw2h06" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "centeo01" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "xbow01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "sahextra" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gorkuo05" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "kuowhi01" = 0) ) ) ) BEGIN FOR (index2 = 9; index2 < 36; index2 = index2 + 1) BEGIN // search through slots and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // first null reference in weapons WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END PATCH_IF ("%index2%" = 12) BEGIN // if end of weapon slots, skip ahead to inventory SET "index2" = 20 END END END END BUT_ONLY_IF_IT_CHANGES Link to comment
CamDawg Posted January 17, 2006 Author Share Posted January 17, 2006 Continued. // armor COPY_EXISTING ~aerie9.cre~ ~override~ ~c6god.cre~ ~override~ ~cutmelis.cre~ ~override~ ~hobcap01.cre~ ~override~ ~jondal.cre~ ~override~ ~mel01.cre~ ~override~ ~meliss01.cre~ ~override~ ~plfarm06.cre~ ~override~ ~tethto.cre~ ~override~ ~tethto2.cre~ ~override~ ~udduer01.cre~ ~override~ ~uhogre03.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "chan02" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "tethto" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "tethto2" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "chan04" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "hobcap01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "uhogre03" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "clck17" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "cutmelis" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "mel01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "meliss01" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "leat01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "udduer01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "leat04" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "aerie9" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "plat01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "jondal" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "plfarm06" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "plat14" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "c6god" = 0) ) BEGIN FOR (index2 = 1; index2 < 36; index2 = index2 + 1) BEGIN // search through slots and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // if null reference in armor WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END PATCH_IF ("%index2%" = 1) BEGIN // if end of armor slots, skip ahead to inventory SET "index2" = 20 // otherwise go to inventory slots END END END END BUT_ONLY_IF_IT_CHANGES // rings/amulets COPY_EXISTING ~c6elven2.cre~ ~override~ ~c6elvenw.cre~ ~override~ ~centeo01.cre~ ~override~ ~d1ghost.cre~ ~override~ ~dacemist.cre~ ~override~ ~delmist.cre~ ~override~ ~ghogr01.cre~ ~override~ ~imp01.cre~ ~override~ ~impqua01.cre~ ~override~ ~lester.cre~ ~override~ ~riftcr01.cre~ ~override~ ~rumar03.cre~ ~override~ ~sahimp01.cre~ ~override~ ~sahimp02.cre~ ~override~ ~sahimp03.cre~ ~override~ ~sahimp04.cre~ ~override~ ~sahimp05.cre~ ~override~ ~sahimp06.cre~ ~override~ ~sahimp07.cre~ ~override~ ~suziyaad.cre~ ~override~ ~udimp.cre~ ~override~ ~tanomist.cre~ ~override~ ~valemist.cre~ ~override~ ~warsage.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "ghost3" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "d1ghost" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "immune1" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "ghogr01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "imp01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "impqua01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "riftcr01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "rumar03" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp03" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp04" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp05" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp06" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "sahimp07" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "udimp" = 0) ) ) ) OR ( ("%item%" STRING_COMPARE_CASE "immune2" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "suziyaad" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "mage06" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "lester" = 0) ) OR ( ( ("%item%" STRING_COMPARE_CASE "minhp1" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "c6elven2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6elvenw" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dacemist" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "delmist" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "tanomist" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "valemist" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "warsage" = 0) ) ) ) OR ( ( ("%SOURCE_RES%" STRING_COMPARE_CASE "centeo01" = 0) AND // not technically jewelry, but shouldn't be pickpocketable ( ("%item%" STRING_COMPARE_CASE "ring18" = 0) OR ("%item%" STRING_COMPARE_CASE "ring23" = 0) ) ) ) BEGIN FOR (index2 = 4; index2 < 36; index2 = index2 + 1) BEGIN // search through quiver slots and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // first null reference in rings, amulets WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END PATCH_IF ("%index2%" = 6) BEGIN // if end of jewelry slots, skip ahead to inventory SET "index2" = 20 END END END END BUT_ONLY_IF_IT_CHANGES // helms COPY_EXISTING ~garock.cre~ ~override~ ~rock.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "helm01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "garock" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "rock" = 0) ) ) BEGIN FOR (index2 = 0; index2 < 36; index2 = index2 + 1) BEGIN // search through slots and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // if null reference in helm WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END PATCH_IF ("%index2%" = 0) BEGIN // if end of helm slots, skip ahead to inventory SET "index2" = 20 // otherwise go to inventory slots END END END END BUT_ONLY_IF_IT_CHANGES // shields COPY_EXISTING ~plfarm03.cre~ ~override~ ~plmetr01.cre~ ~override~ ~tethto.cre~ ~override~ ~tethto2.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "shld03" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "plfarm03" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "plmetr01" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "shld04" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "tethto" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "tethto2" = 0) ) ) BEGIN FOR (index2 = 2; index2 < 36; index2 = index2 + 1) BEGIN // search through slots and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // if null reference in shield WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END PATCH_IF ("%index2%" = 2) BEGIN // if end of shield slots, skip ahead to inventory SET "index2" = 20 // otherwise go to inventory slots END END END END BUT_ONLY_IF_IT_CHANGES // quickslot items COPY_EXISTING ~centeo01.cre~ ~override~ ~chgood09.cre~ ~override~ ~cowled.cre~ ~override~ ~davaeo.cre~ ~override~ ~gorion.cre~ ~override~ ~hamasu.cre~ ~override~ ~imoen.cre~ ~override~ ~sahbeh04.cre~ ~override~ ~teltief3.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "potn02" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "davaeo" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "potn08" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "cowled" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gorion" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "hamasu" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "imoen" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "potn09" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "imoen" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "potn20" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "hamasu" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "potn32" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "sahbeh04" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "potn55" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "chgood09" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "teltief3" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "scrl1g" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "cowled" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "scrl1q" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "cowled" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "scrl77" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "gorion" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "scrl84" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "gorion" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "wand02" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "davaeo" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "wand06" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "centeo01" = 0) ) BEGIN FOR (index2 = 18; index2 < 36; index2 = index2 + 1) BEGIN // search through quick slots/inventory and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // if null reference WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END END END END BUT_ONLY_IF_IT_CHANGES // generic inventory COPY_EXISTING ~aegnoll.cre~ ~override~ ~ammerc07.cre~ ~override~ ~c6lanf.cre~ ~override~ ~centeo01.cre~ ~override~ ~dagnoll.cre~ ~override~ ~dragblac.cre~ ~override~ ~garkid02.cre~ ~override~ ~gibbersu.cre~ ~override~ ~gibmut01.cre~ ~override~ ~gnleli01.cre~ ~override~ ~gnlwar01.cre~ ~override~ ~gnoll01.cre~ ~override~ ~gnollhp1.cre~ ~override~ ~hobcap01.cre~ ~override~ ~icliz01.cre~ ~override~ ~icliz02.cre~ ~override~ ~tasloisu.cre~ ~override~ ~xvartsu.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "misc90" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "centeo01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "rndtre02" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "ammerc07" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "c6lanf" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "garkid02" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gibbersu" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gibmut01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "tasloisu" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "xvartsu" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "rndtre03" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "hobcap01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "rndtre04" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "aegnoll" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dagnoll" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gnleli01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gnlwar01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gnoll01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "gnollhp1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "icliz01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "icliz02" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "dart04" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "dragblac" = 0) ) BEGIN FOR (index2 = 21; index2 < 36; index2 = index2 + 1) BEGIN // search through quick slots/inventory and add reference to first null slot READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref" PATCH_IF ("%ref%" = 0xffff) BEGIN // if null reference WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item SET "index2" = 36 // kills loop END END END END BUT_ONLY_IF_IT_CHANGES Link to comment
CamDawg Posted January 17, 2006 Author Share Posted January 17, 2006 Next was tackling errors of shields in armor slots, armor in cloak slots, etc. As part of this, I also checked inventories to see if there were items to be equipped. In general, I tried to avoid moving items from inventory to equipped unless it made sense. I also made checks for launchers without ammo and, in the handful of cases it made sense, added bows/arrows/etc. // has dupe armor entry in weapon slot; properly equipping weapon is handled in mass patch COPY_EXISTING ~ppsail03.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 9; index < 13; index = index + 1) BEGIN // search through weapon slots READ_SHORT ("%slot_off%" + ("%index%" * 0x02)) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN // if legit reference READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "leat01" = 0) BEGIN WRITE_SHORT ("%slot_off%" + ("%index%" * 0x02)) 0xffff // blanks reference END END END BUT_ONLY_IF_IT_CHANGES // has shield in quickslot/inventory COPY_EXISTING ~bjorni.cre~ ~override~ ~trfued05.cre~ ~override~ ~yaga01.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 18; index < 37; index = index + 1) BEGIN // quick slots/inventory READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "shld01" = 0) OR ("%item%" STRING_COMPARE_CASE "shld04" = 0) OR ("%item%" STRING_COMPARE_CASE "shld32" = 0) ) BEGIN READ_SHORT ("%slot_off%" + 0x04) "shld" // read shld slot PATCH_IF ("%shld%" = 0xffff) BEGIN // if shld slot open WRITE_SHORT ("%slot_off%" + 0x04) "%ref%" // write reference WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff // removes old reference END SET "index" = 37 //kills loop END END END BUT_ONLY_IF_IT_CHANGES // has helm in quickslot/inventory COPY_EXISTING ~gorfirg.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 18; index < 37; index = index + 1) BEGIN // quick slots/inventory READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "helm31" = 0) BEGIN READ_SHORT ("%slot_off%") "helm" // read helm slot PATCH_IF ("%helm%" = 0xffff) BEGIN // if helm slot open WRITE_SHORT ("%slot_off%") "%ref%" // write reference WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff // removes old reference END SET "index" = 37 //kills loop END END END BUT_ONLY_IF_IT_CHANGES // has amulet in quickslot/inventory COPY_EXISTING ~pthral01.cre~ ~override~ ~pthral04.cre~ ~override~ ~pthral10.cre~ ~override~ ~pthral11.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 18; index < 37; index = index + 1) BEGIN // quick slots/inventory READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "misc7y" = 0) BEGIN READ_SHORT ("%slot_off%" + 0x0c) "amul" // read amulet slot PATCH_IF ("%amul%" = 0xffff) BEGIN // if amulet slot open WRITE_SHORT ("%slot_off%" + 0x0c) "%ref%" // write reference WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff // removes old reference END SET "index" = 37 //kills loop END END END BUT_ONLY_IF_IT_CHANGES // has bracers in quickslot/inventory COPY_EXISTING ~gorwom03.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 18; index < 37; index = index + 1) BEGIN // quick slots/inventory READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "brac21" = 0) BEGIN READ_SHORT ("%slot_off%" + 0x06) "brac" // read helm slot PATCH_IF ("%brac%" = 0xffff) BEGIN // if helm slot open WRITE_SHORT ("%slot_off%" + 0x06) "%ref%" // write reference WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff // removes old reference END SET "index" = 37 //kills loop END END END BUT_ONLY_IF_IT_CHANGES // has armor in cloak/quickslots/inventory COPY_EXISTING ~aerie10.cre~ ~override~ ~elearb01.cre~ ~override~ ~elearb02.cre~ ~override~ ~elearb03.cre~ ~override~ ~elearb04.cre~ ~override~ ~elearb05.cre~ ~override~ ~elearb06.cre~ ~override~ ~elearb07.cre~ ~override~ ~elearb08.cre~ ~override~ ~elearb09.cre~ ~override~ ~elearb10.cre~ ~override~ ~elearb11.cre~ ~override~ ~flyfgt04.cre~ ~override~ ~gmage14.cre~ ~override~ ~gorsta11.cre~ ~override~ ~gromg05.cre~ ~override~ ~gromg08.cre~ ~override~ ~gromg13.cre~ ~override~ ~hlsion.cre~ ~override~ ~jangit02.cre~ ~override~ ~loveone5.cre~ ~override~ ~rigen02.cre~ ~override~ ~rumar01.cre~ ~override~ ~sarmag01.cre~ ~override~ ~shugmg01.cre~ ~override~ ~shupol01.cre~ ~override~ ~stein.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 17; index < 37; index = index + 1) BEGIN READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" // slots starting with cloak PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ( ("%item%" STRING_COMPARE_CASE "clck10" = 0) OR ("%item%" STRING_COMPARE_CASE "clck13" = 0) OR ("%item%" STRING_COMPARE_CASE "clck14" = 0) OR ("%item%" STRING_COMPARE_CASE "clck15" = 0) OR ("%item%" STRING_COMPARE_CASE "clck16" = 0) OR ("%item%" STRING_COMPARE_CASE "leat04" = 0) ) BEGIN READ_SHORT ("%slot_off%" + 0x02) "armor" // read armor slot PATCH_IF ("%armor%" = 0xffff) BEGIN // if armor slot open WRITE_SHORT ("%slot_off%" + 0x02) "%ref%" // add as armor WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff // removes old reference END SET "index" = 37 //kills loop END END END BUT_ONLY_IF_IT_CHANGES // have ammo in quickslot/inventory COPY_EXISTING ~elekob01.cre~ ~override~ ~kobcom01.cre~ ~override~ ~swsfoll1.cre~ ~override~ ~swsfoll6.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 18; index < 37; index = index + 1) BEGIN // quick slots, inventory READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "arow08" = 0) BEGIN FOR (index2 = 13; index2 < 17; index2 = index2 + 1) BEGIN //quiver slots READ_SHORT ("%slot_off%" + (0x02 * "%index2%")) "ref2" PATCH_IF ("%ref2%" = 0xffff) BEGIN // empty slot WRITE_SHORT ("%slot_off%" + (0x02 * "%index2%")) "%ref%" WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff SET "index" = 37 //kills loop SET "index2" = 17 // kills loop END END END END END BUT_ONLY_IF_IT_CHANGES // have weapons in quickslot/inventory COPY_EXISTING ~bshop01.cre~ ~override~ ~corneil.cre~ ~override~ ~dario.cre~ ~override~ ~DSHOP01.cre~ ~override~ ~elders.cre~ ~override~ ~ffactor2.cre~ ~override~ ~garrick.cre~ ~override~ ~gerhardt.cre~ ~override~ ~jaga4.cre~ ~override~ ~jamage1.cre~ ~override~ ~jamage2.cre~ ~override~ ~jameroni.cre~ ~override~ ~jan15.cre~ ~override~ ~pwarden.cre~ ~override~ ~scyarryl.cre~ ~override~ ~surly.cre~ ~override~ ~temsup.cre~ ~override~ ~thief5.cre~ ~override~ ~valyg9.cre~ ~override~ ~valyg11.cre~ ~override~ ~valyg12.cre~ ~override~ ~vara.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 READ_LONG 0x2bc "itm_off" ELSE 0 FOR (index = 18; index < 37; index = index + 1) BEGIN // quick slots, inventory READ_SHORT ("%slot_off%" + (0x02 * "%index%")) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%ref%")) "item" PATCH_IF ( ( ("%item%" STRING_COMPARE_CASE "dagg01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "bshop01" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "ffactor2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "thief5" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "staf01" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "corneil" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "dario" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "elders" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "jamage1" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "jamage2" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "vara" = 0) ) ) OR ( ( ("%item%" STRING_COMPARE_CASE "bow03" = 0) OR ("%item%" STRING_COMPARE_CASE "sper01" = 0) ) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "valyg9" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "valyg11" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "valyg12" = 0) ) ) OR ( ("%item%" STRING_COMPARE_CASE "sw1h07" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "DSHOP01" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "sw1h35" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "pwarden" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "hamm01" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "surly" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "blun20" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "scyarryl" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "blun03" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "temsup" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "blun02" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "gerhardt" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "xbow12" = 0) AND ("%SOURCE_RES%" STRING_COMPARE_CASE "jan15" = 0) ) OR ( ("%item%" STRING_COMPARE_CASE "xbow04" = 0) AND ( ("%SOURCE_RES%" STRING_COMPARE_CASE "garrick" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "jaga4" = 0) OR ("%SOURCE_RES%" STRING_COMPARE_CASE "jameroni" = 0) ) ) ) BEGIN FOR (index2 = 9; index2 < 37; index2 = index2 + 1) BEGIN // start at weapon slots READ_SHORT ("%slot_off%" + (0x02 * "%index2%")) "ref2" PATCH_IF ("%ref2%" = 0xffff) BEGIN // empty slot WRITE_SHORT ("%slot_off%" + (0x02 * "%index2%")) "%ref%" WRITE_SHORT ("%slot_off%" + (0x02 * "%index%")) 0xffff SET "index" = 21 //kills loop READ_SHORT ("%slot_off%" + 0x4c) "equipped" PATCH_IF (("%index2%" < 13) AND ("%equipped%" = 0xffff)) BEGIN WRITE_SHORT ("%slot_off%" + 0x4c) ("%index2%" - 9) // equipped weapon END SET "index2" = 37 // kills loop END PATCH_IF ("%index2%" = 0) BEGIN SET "index2" = 20 // skip ahead to inventory if at end of weapons END END END END END BUT_ONLY_IF_IT_CHANGES // bow but no arrows COPY_EXISTING ~amarch01.cre~ ~override~ ADD_CRE_ITEM ~arow01~ #20 #0 #0 ~NONE~ ~QUIVER1 QUIVER2 QUIVER3~ // bow but no arrows COPY_EXISTING ~yoshi11.cre~ ~override~ ADD_CRE_ITEM ~arow01~ #20 #0 #0 ~NONE~ ~QUIVER1~ ADD_CRE_ITEM ~arow01~ #20 #0 #0 ~NONE~ ~QUIVER2~ ADD_CRE_ITEM ~arow01~ #20 #0 #0 ~NONE~ ~QUIVER3~ // monk has no fist COPY_EXISTING ~ammonk03.cre~ ~override~ ADD_CRE_ITEM ~mfist8~ #0 #0 #0 ~UNSTEALABLE&UNDROPPABLE~ ~WEAPON1 WEAPON2 WEAPON3 WEAPON4~ EQUIP // bolts but no crossbow COPY_EXISTING ~orc06.cre~ ~override~ ADD_CRE_ITEM ~xbow01~ #0 #0 #0 ~NONE~ ~WEAPON1 WEAPON3 WEAPON4~ // already has weapon equipped // arrows but no bow COPY_EXISTING ~refigh01.cre~ ~override~ ADD_CRE_ITEM ~bow01~ #0 #0 #0 ~NONE~ ~WEAPON2 WEAPON3 WEAPON4~ // already has weapon equipped // arrows but no bow COPY_EXISTING ~prisonk1.cre~ ~override~ ADD_CRE_ITEM ~bow01~ #0 #0 #0 ~NONE~ ~WEAPON3 WEAPON4~ // already has weapon equipped Link to comment
CamDawg Posted January 17, 2006 Author Share Posted January 17, 2006 Next were creatures who had incorrect weapons equipped. If they had a legit weapon in their weapon slots and either an incorrect or non-existent value for equipped weapon, these were caught and corrected. And lastly, I recoded two previous fixes. The first were the pickpocket fixes--we had moved items to ring/amulet slots, but these are also pickpocketable. I also expanded it to include moving non-helmets out of the helmet slot, to avoid creatures benefitting from spurious critical hit protection. Lastly, the Anath fixes (ringwlf for ringloup) were re-coded to not use ADD_CRE_ITEM, as it was leaving the old items in inventory. (Yes, this is an anal-retentive cosmetic change that only makes me feel better.) // have incorrect equipped weapon reference COPY_EXISTING ~aemess.cre~ ~override~ ~alex.cre~ ~override~ ~ARLED.cre~ ~override~ ~BGUARD1.cre~ ~override~ ~BOUNHA02.cre~ ~override~ ~BOUNHA03.cre~ ~override~ ~C6KACH2.cre~ ~override~ ~COPAMB01.cre~ ~override~ ~COPAMB03.cre~ ~override~ ~COPAMB04.cre~ ~override~ ~DAWNMAS.cre~ ~override~ ~DERRICK.cre~ ~override~ ~firorc02.cre~ ~override~ ~firorc03.cre~ ~override~ ~glad2.cre~ ~override~ ~hlassa.cre~ ~override~ ~hlketta.cre~ ~override~ ~hlketta2.cre~ ~override~ ~jolus.cre~ ~override~ ~kendak.cre~ ~override~ ~kuocle20.cre~ ~override~ ~pace.cre~ ~override~ ~ppguard3.cre~ ~override~ ~ppsail03.cre~ ~override~ // armor in weapon slot fixed elsewhere ~ppsuna.cre~ ~override~ ~rethie01.cre~ ~override~ ~ribald.cre~ ~override~ ~ryan.cre~ ~override~ ~sahamb03.cre~ ~override~ ~sahamb06.cre~ ~override~ ~salvanas.cre~ ~override~ ~sarcult.cre~ ~override~ ~sarcult2.cre~ ~override~ ~sarculto.cre~ ~override~ ~sarhal.cre~ ~override~ ~senorc01.cre~ ~override~ ~senorc03.cre~ ~override~ ~suna.cre~ ~override~ ~temsup.cre~ ~override~ ~thief5.cre~ ~override~ ~udtrap05.cre~ ~override~ READ_LONG 0x2b8 "slot_off" ELSE 0 FOR (index = 0; index < 4; index = index + 1) BEGIN // search through weapon slots READ_SHORT ("%slot_off%" + 0x12 + ("%index%" * 0x02)) "ref" PATCH_IF ("%ref%" != 0xffff) BEGIN // if valid reference in weapon slots WRITE_SHORT ("%slot_off%" + 0x4c) "%index%" // equipped weapon SET "index" = 4 // kills loop and prevents next patch_if END ELSE PATCH_IF ("%index%" = 3) BEGIN // if value hits 12, means no weapon slots are valid WRITE_SHORT ("%slot_off%" + 0x4c) 0xffff // equipped weapon is null, -1 END END BUT_ONLY_IF_IT_CHANGES // eliminates pickpocket exploits COPY_EXISTING ~ankheg01.cre~ ~override~ ~bazdra02.cre~ ~override~ ~cltiva01.cre~ ~override~ ~gemch02.cre~ ~override~ ~hellgen.cre~ ~override~ ~hlkang.cre~ ~override~ ~jarlich.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~neb.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~ppjoye2.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~pptroll1.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~sctelwyn.cre~ ~override~ ~trolsi01.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~trolsi02.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~trolsp01.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~trolsp02.cre~ ~override~ // non-helm in helm slot for non-legit critical protection ~trrak01.cre~ ~override~ ~udprince.cre~ ~override~ READ_LONG 0x2b8 "slot_off" READ_LONG 0x2bc "itm_off" READ_LONG 0x2c0 "itm_num" SET "added" = 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ( ( ("%item%" STRING_COMPARE_CASE "bazplo02" = 0) OR // draconis' head ("%item%" STRING_COMPARE_CASE "ghost3" = 0) OR // item w/ visual effects ("%item%" STRING_COMPARE_CASE "illblur" = 0) OR // item w/ visual effects ("%item%" STRING_COMPARE_CASE "misc12" = 0) OR // ankheg shell ("%item%" STRING_COMPARE_CASE "misc7f" = 0) OR // Ti'Vael's head ("%item%" STRING_COMPARE_CASE "misc8k" = 0) OR // ihtafeer's head ("%item%" STRING_COMPARE_CASE "misc9h" = 0) OR // neb's head ("%item%" STRING_COMPARE_CASE "misca7" = 0) OR // sahuagin prince's blood ("%item%" STRING_COMPARE_CASE "miscb7" = 0) OR // tears of bhaal ("%item%" STRING_COMPARE_CASE "miscbg" = 0) // lich's tooth ) OR ( ("%item%" STRING_COMPARE_CASE "helm03" = 0) AND // helm of glory ("sctelwyn" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0) // from telwyn ) OR ( ("%item%" STRING_COMPARE_CASE "misc6z" = 0) AND // beljuril ("gemch02" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0) // from chicken ) OR ( ("%item%" STRING_COMPARE_CASE "ring39" = 0) AND // ring of gaxx ("hlkang" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0) // from kangaxx ) ) BEGIN FOR (index2 = 0; index2 < 36; index2 = index2 + 1) BEGIN // search through item slots READ_SHORT ("%slot_off%" + (0x02 * "%index2%")) "ref" PATCH_IF ((("%index2%" > 0) AND ("%index2%" < 4)) OR (("%index2%" > 6) AND ("%index2%" < 18))) BEGIN // if legit slot (1-3, 7-17) PATCH_IF ("%ref%" = "%index%") BEGIN // if item in question PATCH_IF ("%added%" = 0) BEGIN // if found in a legit slot SET "added" = 1 END ELSE BEGIN // if already found WRITE_SHORT ("%slot_off%" + (0x02 * "%index2%")) 0xffff // nulls reference END END ELSE PATCH_IF (("%ref%" = 0xffff) AND ("%added%" = 0)) BEGIN // if empty, legit slot WRITE_SHORT ("%slot_off%" + (0x02 * "%index2%")) "%index%" // adds reference SET "added" = 1 END END ELSE BEGIN // if non-legit spot PATCH_IF ("%ref%" = "%index%") BEGIN // if reference to item being moved and in non-legit spot WRITE_SHORT ("%slot_off%" + (0x02 * "%index2%")) 0xffff // nulls reference END END END END END BUT_ONLY_IF_IT_CHANGES // fixes Anath's 28 CON score COPY_EXISTING ~rngwlf01.cre~ ~override~ ~rngwlf02.cre~ ~override~ ~rngwlf03.cre~ ~override~ ~rngwlf04.cre~ ~override~ ~rngwlf05.cre~ ~override~ WRITE_BYTE 0x23d 25 READ_LONG 0x2bc "itm_off" ELSE 0 READ_LONG 0x2c0 "itm_num" ELSE 0 FOR (index = 0; index < itm_num; index = index + 1) BEGIN // searches through items READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item" PATCH_IF ("%item%" STRING_COMPARE_CASE "ringloup" = 0) BEGIN // find invalid resref WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "ringwolf" #8 // corrected resref SET "index" = "%itm_num%" // kills loop END END BUT_ONLY_IF_IT_CHANGES Link to comment
CamDawg Posted January 17, 2006 Author Share Posted January 17, 2006 OK, so remaining questions. In addition to the couple hundred of these that devSin will remove as non-legit/unnecessary bugfixes, there were a couple in particular for which I wanted to solicit opinions. Should hostile Aran Linvail (when Bodhi sends you to wipe out the Shadow Thieves) have his Ring of Protection +2 equipped? Anomen has his mace equipped and bullets in his quiver slots. Should his sling be moved fom inventory to a weapon slot? Similar to Anomen, Nalia has a short sword in her hand and arrows in her quivers, but her bow is in her inventory. High-level Edwin has a similar issue as Anomen and Nalia; should his sling be equipped? Unlike Nalia and Anomen, though, he has no ammo. What in the hell are the e[0-9]+.cre files and should I care that there inventories are fucked? Link to comment
devSin Posted January 17, 2006 Share Posted January 17, 2006 Actually, I was to ask for a volunteer to compare this and mine and see where they deviate. Thanks! Otherwise, you'll have to wait till I shift back to Baldur's Gate II. Aran: probably. I'm pretty sure I do. Anomen, Nalia: doesn't matter. I know I do. Edwin: doesn't matter. I probably do. E* CREs. I want to say these were likely from an E3 demo long forgotten (similarly named creatures exist in Baldur's Gate), but it's only a logical deduction. Link to comment
cirerrek Posted January 17, 2006 Share Posted January 17, 2006 OK, so remaining questions. In addition to the couple hundred of these that devSin will remove as non-legit/unnecessary bugfixes, there were a couple in particular for which I wanted to solicit opinions. Should hostile Aran Linvail (when Bodhi sends you to wipe out the Shadow Thieves) have his Ring of Protection +2 equipped? Anomen has his mace equipped and bullets in his quiver slots. Should his sling be moved fom inventory to a weapon slot? Similar to Anomen, Nalia has a short sword in her hand and arrows in her quivers, but her bow is in her inventory. High-level Edwin has a similar issue as Anomen and Nalia; should his sling be equipped? Unlike Nalia and Anomen, though, he has no ammo. What in the hell are the e[0-9]+.cre files and should I care that there inventories are fucked? <{POST_SNAPBACK}> The shade of Gorion pats Cam on the shoulder and says "You have done well my, son. Now it is time to rest. Take off your cloak and cap, pull up a chair, and play a game of BG2 without modding anything for a week." Okay, since that is unlikely to happen, my vote is Ask yourself the following question "If I was the Master of a city/region/continent spanding Thieves' Guild and I had a +2 Ring of Protection, would I have it equipped or in my pocket?" to equip weapons where they have ammo in an ammo slot, only because it always struck me as weird that they had the weapons in an inventory slot, rather than equipped. Link to comment
icelus Posted January 17, 2006 Share Posted January 17, 2006 [*]Anomen has his mace equipped and bullets in his quiver slots. Should his sling be moved fom inventory to a weapon slot? Similar to Anomen, Nalia has a short sword in her hand and arrows in her quivers, but her bow is in her inventory. <{POST_SNAPBACK}> What is the "norm" for other joinable NPC cre files? Do the rest of them have their ranged weapon equipped (if they have ranged weapons) or their melée weapon? Personally, I'd prefer them to be equipped with ranged weapons upon joining, but that's just a personal preference. Link to comment
devSin Posted January 17, 2006 Share Posted January 17, 2006 The shade of Gorion pats Cam on the shoulder and says "You have done well my, son. Now it is time to rest. Take off your cloak and cap, pull up a chair, and play a game of BG2 without modding anything for a week."In other words, back to business as usual. What is the "norm" for other joinable NPC cre files? Do the rest of them have their ranged weapon equipped (if they have ranged weapons) or their melée weapon?It's not an issue of the weapon they have equipped, it's the fact that they have it sitting in their inventory (instead of the quick weapon slot). I wouldn't be in favor of changing the equipped weapon, but it doesn't bother me to move around the unequipped/unwielded items. Link to comment
BigRob Posted January 17, 2006 Share Posted January 17, 2006 If they have the capacity to have all their weapons equipped, you might as well do it. If you have the weapon and ammo on you, you'd probably have it somewhere asily accessable. Since Edwin has no ammo though, you could leave his, on the excuse that if he has no amunition for the sling, he doesn't bother to keep it at the ready. Link to comment
CamDawg Posted January 17, 2006 Author Share Posted January 17, 2006 Heh, well, I started this as a sick day project from last Monday, presuming it'd be a nice, one-day project. And, uh, well... E* CREs. I want to say these were likely from an E3 demo long forgotten (similarly named creatures exist in Baldur's Gate), but it's only a logical deduction. This seems correct. They seem to be slightly mangled creature files of the joinable BG2 NPCs. At any rate they didn't look like they were used so I was hoping to safely ignore them. devSin's got it for Nalia, Edwin, and Anomen. I don't want to change the default equipped weapon but to simply move their ranged weapons to a weapon slot instead of leaving them in inventory. Ask yourself the following question "If I was the Master of a city/region/continent spanding Thieves' Guild and I had a +2 Ring of Protection, would I have it equipped or in my pocket?" I agree, but we need to be careful with using strictly logical arguments. Otherwise we'd put EscapeArea() blocks at the top of every monster script once the PC reached level 12 or so. What is the "norm" for other joinable NPC cre files? Do the rest of them have their ranged weapon equipped (if they have ranged weapons) or their melée weapon? Aerie, Keldorn, Korgan, Mazzy, Valygar, and Yoshimo are the only NPCs (other than those above) to come with melee and ranged weapons. Save Valygar, none of the weapons are in inventory. One of Valygar's incarnations comes with multiple equipped weapons (one bow, rest melee), whereas the rest did not. I did change all versions of Valygar to come with equipped weapons for consistency. So with that, I say we move 'em to weapon slots. Link to comment
Andyr Posted January 17, 2006 Share Posted January 17, 2006 Congratulations, Cam--you have gained your black belt in WeiDU ninjary! Now your real training may begin... I'd say Aran should have his ring equipped. It makes sense since he's hostile. I would leave .CREs with ranged weapons in inventory, though, for the following reasons: - More code, and not really much difference to the end result. - Could potentially cause problems if some other modder tries to add something to their other weapon slots (well, it could potentially work too, but I'm better most modders are lazier than you, Cam).. Link to comment
Grim Squeaker Posted January 17, 2006 Share Posted January 17, 2006 Personally, I'd put them in the correct weapon slots. They are pretty blatently meant to be the character's ranged weapon so it makes sense for them to be in a weapon slot. It shouldn't be that much more code I think and no more confusing than what's already there. It shouldn't cause many compatibility problems as either: 1) The modder is replacing the item with a different weapon and R_T will work fine 2) They are equiping a new item and ADD_CRE_ITEM will bump any overflow into their inventory, which is fine. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.