Little "bug" in BP with BHCRYPT.CRE's script
#1
Posted 05 April 2010 - 07:05 AM
According to this, it seems like I find a little "bug" in PB. This may interest you : It seems that BP is assigning a non-existing script to BHCRYPT.CRE.
This is a "little" bug since even without this script, the Crypt King is still able to kill any stupid adventurers (like me )
Feel free to ask more informations if you need it.
Hope this helps.
Fouinto
#2
Posted 05 April 2010 - 09:02 AM
There is, however, a fairly major bug in that this Improved Crypt King hoses the memorised spells offset in a fairly major way. Look at bhcrypt.cre after installing BP (no other mods) in Near Infinity, and you'll see that offset (at 0x2b0) points to 0x768. Well, NI can't even find that offset - after effects at 0x558, items start at 0x954 and the rest is lost in the void somewhere. It might be solvable by using more recent coding techniques in BP like SET_BG2_PROFICIENCY and ADD_MEMORIZED_SPELL (or possibly Nythrun's .cre ordering macros, but I'm not sure if even those would fix it). But there's less chance for error with those commands, and they're easier than the existing code anyhow.
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
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle
#3
Posted 05 April 2010 - 09:29 AM
///////////////////Improved Crypt King///////////////////////// BEGIN @397 <<<<<<<< BHCRYPT.TBL CREATURE_NAME SPELL NUM TYPE LVL BHCRYPT.CRE SPWI105 1 WIZARD 0 BHCRYPT.CRE SPWI106 2 WIZARD 0 BHCRYPT.CRE SPWI118 3 WIZARD 0 BHCRYPT.CRE SPWI125 2 WIZARD 0 BHCRYPT.CRE SPWI205 2 WIZARD 1 BHCRYPT.CRE SPWI213 1 WIZARD 1 BHCRYPT.CRE SPWI218 2 WIZARD 1 BHCRYPT.CRE SPWI312 1 WIZARD 2 BHCRYPT.CRE SPWI314 2 WIZARD 2 BHCRYPT.CRE SPWI316 2 WIZARD 2 BHCRYPT.CRE SPWI318 1 WIZARD 2 BHCRYPT.CRE SPWI401 1 WIZARD 3 BHCRYPT.CRE SPWI408 2 WIZARD 3 BHCRYPT.CRE SPWI409 1 WIZARD 3 BHCRYPT.CRE SPWI412 1 WIZARD 3 BHCRYPT.CRE SPWI501 2 WIZARD 4 BHCRYPT.CRE SPWI506 1 WIZARD 4 BHCRYPT.CRE SPWI508 1 WIZARD 4 BHCRYPT.CRE SPWI509 1 WIZARD 4 BHCRYPT.CRE SPWI601 1 WIZARD 5 BHCRYPT.CRE SPWI604 1 WIZARD 5 BHCRYPT.CRE SPWI605 1 WIZARD 5 BHCRYPT.CRE SPWI611 1 WIZARD 5 BHCRYPT.CRE SPWI701 1 WIZARD 6 BHCRYPT.CRE SPWI704 1 WIZARD 6 BHCRYPT.CRE SPWI707 1 WIZARD 6 BHCRYPT.CRE SPWI713 1 WIZARD 6 BHCRYPT.CRE SPWI715 1 WIZARD 6 BHCRYPT.CRE SPWI807 1 WIZARD 7 BHCRYPT.CRE SPWI897 1 WIZARD 7 BHCRYPT.CRE SPWI899 1 WIZARD 7 >>>>>>>> COPY_EXISTING ~BHCRYPT.CRE~ ~override~ WRITE_SHORT 0x24 ~186~ WRITE_SHORT 0x26 ~186~ WRITE_BYTE 0x2c ~29~ WRITE_BYTE 0x2d ~36~ WRITE_BYTE 0x2e ~23~ WRITE_BYTE 0x2f ~16~ WRITE_BYTE 0x30 ~91~ WRITE_BYTE 0x31 ~30~ WRITE_BYTE 0x32 ~0~ WRITE_SHORT 0x46 ~5~ WRITE_SHORT 0x48 ~5~ WRITE_BYTE 0x52 ~7~ WRITE_BYTE 0x53 ~3~ WRITE_BYTE 0x54 ~3~ WRITE_BYTE 0x55 ~6~ WRITE_BYTE 0x56 ~7~ WRITE_BYTE 0x57 ~6~ WRITE_BYTE 0x58 ~7~ WRITE_BYTE 0x59 ~50~ WRITE_BYTE 0x5a ~100~ WRITE_BYTE 0x5b ~100~ WRITE_BYTE 0x5d ~65~ WRITE_BYTE 0x5e ~25~ WRITE_BYTE 0x5f ~100~ WRITE_BYTE 0x60 ~25~ WRITE_BYTE 0x62 ~50~ WRITE_BYTE 0x63 ~90~ WRITE_BYTE 0x234 ~18~ WRITE_BYTE 0x238 ~18~ WRITE_BYTE 0x239 ~76~ WRITE_BYTE 0x23a ~11~ WRITE_BYTE 0x23b ~14~ WRITE_BYTE 0x23c ~17~ WRITE_BYTE 0x23e ~13~ WRITE_BYTE 0x23f ~20~ WRITE_BYTE 0x240 ~3~ WRITE_BYTE 0x242 ~30~ WRITE_ASCII 0x248 ~BPCRYPT~ #8 WRITE_ASCII 0x250 ~SHOUTDL2~ WRITE_ASCII 0x258 ~BPMAG14M~ WRITE_ASCII 0x260 ~BPLEAD1~ #8 WRITE_ASCII 0x268 ~BPWTSIGT~ WRITE_BYTE 0x27b ~19~ WRITE_ASCII 0x280 ~BHCRYPT~ #8 REPLACE_CRE_ITEM ~SHLD05~ #0 #0 #0 ~NONE~ ~SHIELD~ READ_LONG 0x2a0 "known_spells_offset" READ_LONG 0x2a4 "known_spells_num" READ_LONG 0x2a8 "spell_memorization_offset" READ_LONG 0x2ac "spell_memorization_num" READ_LONG 0x2b0 "spell_memorized_offset" READ_LONG 0x2b4 "spell_memorized_num" READ_LONG 0x2b8 "item_slots_offset" READ_LONG 0x2bc "items_offset" READ_LONG 0x2c0 "items_num" READ_LONG 0x2c4 "effects_offset" READ_LONG 0x2c8 "effects_num" SET found1 = 0 SET found2 = 0 SET "info_ext" = 0 FOR( cnt=0; cnt<"%effects_num%"; cnt=cnt+1 ) BEGIN READ_LONG ("%effects_offset%"+cnt*0x108+<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' /> "type" PATCH_IF( "%type%"=233 ) BEGIN READ_LONG ("%effects_offset%"+cnt*0x108+24) "prof_type" PATCH_IF ("%prof_type%"=90) BEGIN SET found1=1 READ_LONG ("%effects_offset%"+cnt*0x108+20) "stars" PATCH_IF("%stars%" != 3) BEGIN WRITE_LONG ("%effects_offset%"+cnt*0x108+20) 3 END END PATCH_IF ("%prof_type%"=112) BEGIN SET found2=1 READ_LONG ("%effects_offset%"+cnt*0x108+20) "stars" PATCH_IF("%stars%" != 2) BEGIN WRITE_LONG ("%effects_offset%"+cnt*0x108+20) 2 END END END END PATCH_IF( found1=0 ) THEN BEGIN SET offset = ("%effects_offset%"+0x108*"%effects_num%") INSERT_BYTES offset 0x108 WRITE_LONG offset+8 233 WRITE_LONG offset+12 0 WRITE_LONG offset+20 3 WRITE_LONG offset+24 90 WRITE_LONG offset+28 9 WRITE_LONG offset+36 100 SET "effects_num"="%effects_num%"+1 WRITE_LONG 0x2c8 "%effects_num%" SET "info_ext"="%info_ext%"+0x108 END PATCH_IF( found2=0 ) THEN BEGIN SET offset = ("%effects_offset%"+0x108*"%effects_num%") INSERT_BYTES offset 0x108 WRITE_LONG offset+8 233 WRITE_LONG offset+12 0 WRITE_LONG offset+20 2 WRITE_LONG offset+24 112 WRITE_LONG offset+28 9 WRITE_LONG offset+36 100 SET "effects_num"="%effects_num%"+1 WRITE_LONG 0x2c8 "%effects_num%" SET "info_ext"="%info_ext%"+0x108 END PATCH_IF ("%info_ext%">0) BEGIN PATCH_IF ("%known_spells_offset%">="%effects_offset%") BEGIN "known_spells_offset"="%known_spells_offset%"+"%info_ext%" WRITE_LONG 0x2a0 "%known_spells_offset%" END PATCH_IF ("%spell_memorization_offset%">="%effects_offset%") BEGIN "spell_memorization_offset"="%spell_memorization_offset%"+"%info_ext%" WRITE_LONG 0x2a8 "%spell_memorization_offset%" END PATCH_IF ("%item_slots_offset%">="%effects_offset%") BEGIN "item_slots_offset"="%item_slots_offset%"+"%info_ext%" WRITE_LONG 0x2b8 "%item_slots_offset%" END PATCH_IF ("%items_offset%">="%effects_offset%") BEGIN "items_offset"="%items_offset%"+"%info_ext%" WRITE_LONG 0x2bc "%items_offset%" END PATCH_IF ("%spell_memorized_offset%">="%effects_offset%") BEGIN "spell_memorized_offset"="%spell_memorized_offset%"+"%info_ext%" WRITE_LONG 0x2b0 "%spell_memorized_offset%" END END BUT_ONLY_IF_IT_CHANGES //************************************************************************************************** //configuring creatures' spell system //************************************************************************************************** PRINT @373 COPY + ~BHCRYPT.TBL~ ~BPv179/tmp.tbl~ COUNT_2DA_ROWS 5 "rows_cnt" FOR( cntg=0; cntg<"%rows_cnt%"; cntg=cntg+1 ) BEGIN READ_2DA_ENTRY cntg 0 5 "table_file_name" READ_2DA_ENTRY cntg 1 5 "spell_name" READ_2DA_ENTRY cntg 2 5 "number" READ_2DA_ENTRY cntg 3 5 "spell_type_str" READ_2DA_ENTRY cntg 4 5 "spell_level" SET fileExistsInGame = 0 INNER_PATCH_FILE "%table_file_name%" BEGIN PATCH_IF (~%SOURCE_SIZE%~) BEGIN SET fileExistsInGame = 1 END END PATCH_IF fileExistsInGame=1 AND FILE_EXISTS_IN_GAME "%spell_name%.SPL" THEN BEGIN INNER_ACTION BEGIN COPY_EXISTING "%table_file_name%" ~override~ //patching the file from the current table entry READ_LONG 0x2a0 "known_spells_offset" READ_LONG 0x2a4 "known_spells_num" READ_LONG 0x2a8 "spell_memorization_offset" READ_LONG 0x2ac "spell_memorization_num" READ_LONG 0x2b0 "spell_memorized_offset" READ_LONG 0x2b4 "spell_memorized_num" READ_LONG 0x2b8 "item_slots_offset" READ_LONG 0x2bc "items_offset" READ_LONG 0x2c0 "items_num" READ_LONG 0x2c4 "effects_offset" READ_LONG 0x2c8 "effects_num" SET spell_type = 0 //Priest spell by default PATCH_IF (("%spell_type_str%" STRING_COMPARE_CASE "WIZARD")=0) BEGIN SET spell_type = 1 END PATCH_IF (("%spell_type_str%" STRING_COMPARE_CASE "INNATE")=0) BEGIN SET spell_type = 2 END //********************************************************************************************************** // 1st protection : it's necessary to reset yet unused memo-slots to point behind existing memorized spells FOR(count=0; count<17; count=count+1) BEGIN READ_SHORT ("%spell_memorization_offset%" + count*0x10 + 12) sp2_cnt PATCH_IF( sp2_cnt=0 ) BEGIN WRITE_SHORT ("%spell_memorization_offset%" + count*0x10 + <img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' /> "%spell_memorized_num%" END END //********************************************************************************************************** // 2nd protection : it's necessary to set a valid offset for "spell_memorized_offset" // it could contain some invalid values PATCH_IF (("%effects_num%" == 0) AND (("%effects_offset%" < 0x2d4) OR ("%effects_offset%" > BUFFER_LENGTH))) BEGIN "effects_offset" = "%spell_memorized_offset%"+"%spell_memorized_num%"*0x10 WRITE_LONG 0x2c4 "%effects_offset%" END //********************************************************************************************************** FOR(count=0; count<17; count=count+1) BEGIN READ_SHORT ("%spell_memorization_offset%" + count*0x10 + 12) sp2_cnt PATCH_IF( sp2_cnt=0 ) BEGIN WRITE_SHORT ("%spell_memorization_offset%" + count*0x10 + <img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' /> "%spell_memorized_num%" END END //********************************************************************************************************** //*********************************************************************************************** // adding new KNOWN spell if necessary //*********************************************************************************************** SET necessary=1 FOR (count=0; count<"%known_spells_num%"; count=count+1) BEGIN READ_ASCII ("%known_spells_offset%"+count*0x0c) "known_spell_name" PATCH_IF (("%known_spell_name%" STRING_COMPARE_CASE "%spell_name%")=0) BEGIN SET necessary=0 END END PATCH_IF (necessary=1) BEGIN //adding new known spell // //ADD_KNOWN_SPELL ~%spell_name%~ ~%spell_level%~ ~%spell_type%~ ------ for the future WeiDU SET offset = "%known_spells_offset%" + "%known_spells_num%"*0x0c INSERT_BYTES offset 0x0c WRITE_EVALUATED_ASCII offset ~%spell_name%~ #8 WRITE_SHORT offset+8 spell_level WRITE_SHORT offset+10 spell_type WRITE_LONG 0x2a4 "%known_spells_num%"+1 SET info_ext = 0x0c PATCH_IF ("%spell_memorized_offset%">="%known_spells_offset%") BEGIN "spell_memorized_offset"="%spell_memorized_offset%"+"%info_ext%" WRITE_LONG 0x2b0 "%spell_memorized_offset%" END PATCH_IF ("%spell_memorization_offset%">="%known_spells_offset%") BEGIN "spell_memorization_offset"="%spell_memorization_offset%"+"%info_ext%" WRITE_LONG 0x2a8 "%spell_memorization_offset%" END PATCH_IF ("%item_slots_offset%">="%known_spells_offset%") BEGIN "item_slots_offset"="%item_slots_offset%"+"%info_ext%" WRITE_LONG 0x2b8 "%item_slots_offset%" END PATCH_IF ("%items_offset%">="%known_spells_offset%") BEGIN "items_offset"="%items_offset%"+"%info_ext%" WRITE_LONG 0x2bc "%items_offset%" END PATCH_IF ("%effects_offset%">="%known_spells_offset%") BEGIN "effects_offset"="%effects_offset%"+"%info_ext%" WRITE_LONG 0x2c4 "%effects_offset%" END END //***********************************************************************************************/ //***********************************************************************************************/ SET slot_idx = "%spell_level%" PATCH_IF (("%spell_type_str%" STRING_COMPARE_CASE "WIZARD")=0) BEGIN SET slot_idx = "%spell_level%"+7 END PATCH_IF (("%spell_type_str%" STRING_COMPARE_CASE "INNATE")=0) BEGIN SET slot_idx = 16 END SET offset_memorization = "%spell_memorization_offset%" + "%slot_idx%"*0x10 //***********************************************************************************************/ // adding a necessary quantity of MEMORIZED new spells //***********************************************************************************************/ SET total_add = 0 FOR (count=0; count<"%spell_memorized_num%"; count=count+1) BEGIN READ_ASCII ("%spell_memorized_offset%"+count*0xc) "mem_spell_name" PATCH_IF (("%mem_spell_name%" STRING_COMPARE_CASE "%spell_name%")=0) BEGIN SET "number" = "%number%" - 1 END END //ADD_MEMORIZED_SPELL "%spell_name%" (~%spell_level%~) "%spell_type_str%" (~%number%~) READ_LONG offset_memorization+8 current_slot_spell_index SET offset = "%spell_memorized_offset%" + current_slot_spell_index*0x0c//"%spell_memorized_num%" WHILE ("%number%">0) BEGIN INSERT_BYTES offset 0x0c WRITE_EVALUATED_ASCII offset ~%spell_name%~ #8 WRITE_SHORT offset+8 1 //memorized SET "number" = "%number%" - 1 SET total_add = total_add + 1 SET offset = offset + 0x0c END PATCH_IF(total_add>0) BEGIN SET info_ext = 0x0c * total_add WRITE_LONG 0x2b4 "%spell_memorized_num%"+total_add READ_SHORT (offset_memorization+12) innate_spell_count WRITE_SHORT (offset_memorization+12) innate_spell_count + total_add WRITE_SHORT (offset_memorization+2) innate_spell_count + total_add WRITE_SHORT (offset_memorization+4) innate_spell_count + total_add WRITE_SHORT (offset_memorization+6) ~%spell_type%~ FOR(count=0; count<17; count=count+1) BEGIN READ_SHORT ("%spell_memorization_offset%" + count*0x10 + <img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' /> sp2_index READ_SHORT ("%spell_memorization_offset%" + count*0x10 + 12) sp2_cnt PATCH_IF( count!=slot_idx AND sp2_cnt>0 AND sp2_index>=current_slot_spell_index ) BEGIN WRITE_SHORT ("%spell_memorization_offset%" + count*0x10 + <img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' /> sp2_index+total_add END END PATCH_IF ("%known_spells_offset%">="%spell_memorized_offset%") BEGIN "known_spells_offset"="%known_spells_offset%"+"%info_ext%" WRITE_LONG 0x2a0 "%known_spells_offset%" END PATCH_IF ("%spell_memorization_offset%">="%spell_memorized_offset%") BEGIN "spell_memorization_offset"="%spell_memorization_offset%"+"%info_ext%" WRITE_LONG 0x2a8 "%spell_memorization_offset%" END PATCH_IF ("%item_slots_offset%">="%spell_memorized_offset%") BEGIN "item_slots_offset"="%item_slots_offset%"+"%info_ext%" WRITE_LONG 0x2b8 "%item_slots_offset%" END PATCH_IF ("%items_offset%">="%spell_memorized_offset%") BEGIN "items_offset"="%items_offset%"+"%info_ext%" WRITE_LONG 0x2bc "%items_offset%" END PATCH_IF ("%effects_offset%">="%spell_memorized_offset%") BEGIN "effects_offset"="%effects_offset%"+"%info_ext%" WRITE_LONG 0x2c4 "%effects_offset%" END END BUT_ONLY_IF_IT_CHANGES END END END
"I am the smiley addict, yellow and round, this is my grin when I'm usually around .
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"
BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST
GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod