Jump to content

Hard to notice bug


plainab

Recommended Posts

EDIT: SORRY! JUST NOTICED I WAS IN WRONG FORUM AFTER POST.

I don't have moderator acces for forums outside of BG1fixpack, someone please move to BG2Tweaks. Thank you. :END EDIT

 

There is a bug with the component Make Montaron an Assasin.

I don't know what the bug is or what is causing it, but there is one.

 

Here's the deal. The component installs fine and runs fine in the game, but if I install igi's iiItemMod after BG2Tweaks, there is an item that gets added to Montaron's lowest level cre. That cre file becomes messed up. REALLY MESSED UP! It loads and plays in the game, but the new iiItem is in a quiver slot, there are no weapons or other potions viewable and there are two studded leather armors in his inventory. Now I know that is wrong. I thought iiItemMod was the culprit, but I did some testing.

 

With BG2Tweaks Montaron as an Assasin installed followed by iiItemMod the file _montar.cre is screwed up as described.

With BG2Tweaks Montaron as an Assasin NOT installed followed by iiItemMod the file _montar.cre is just fine.

 

Like I said, I'm really not sure what the issue is, but BG2Tweaks' new file copied over for Montaron to be an assasin gets screwed up by the use of ADD_CRE_ITEM. Whereas the original tutu file doesn't have that issue? Why does tweaks copy over a new file? Can't it modify the existing one to be an assasin? What are the changes: class from fighter/thief to thief; kit assignment from trueclass to assasin; and two assasin effects? IF I can get a working patch to make the change without replacing the actual cre files, do you want it?

 

I've not checked Khalid, but I would assume that he would have the same issue since his change to a fighter/mage is done in the same manner.

Link to comment

Okay, I've been looking into this myself. I still don't know what about the file provided by BG2Tweaks would cause the issue I had. Thinking that iiItemMod did do something else I wasn't aware of, I tried a simple ADD_CRE_ITEM to the BG2Tweaks file. Still got the same screwed up results.

I have been able to modifiy the easytutu original file via weidu patches to create an Assassin version of Montaron. It's not quite the same as what BG2Tweaks provides, but it is similar.

This may be a bit overkill in places but I believe it works. I have only set things up to convert the lowest level cre for Montaron. Why? There maybe something I missed that you want to change. Plus it could be used as a template for the higher level cre files where some info might need to be different. But this is more than you had before. After doing all this, I think the culprit might have been the spells that were already included in the low level cre file. I have no way of knowing for sure. I added the spells via ADD_KNOWN_SPELL but you may wish to use ADD_MEMORIZED_SPELL instead.

The overkill comes from trying to find out why I get a "reordering due to harmless inconsistency" error in DLTCEP when opening _montar.cre. It only happens when effects are present, but I can't figure out why.

Here is the code I came up with and BG2Tweaks may use it and change it as needed.

BEGIN ~Convert Montar to an Assassin~
 COPY_EXISTING ~_montar.cre~ ~override/cdt04090.g3~  
READ_ASCII 0xa4 "soundset" (396)
READ_BYTE  0x33 "eff_ver"
READ_LONG  0x2c4 "effects_offset"
READ_LONG  0x2c8 "fx_num"
PATCH_IF ("%eff_ver%" = 0) BEGIN
  FOR (loops = 0; loops < fx_num; loops = loops + 1) BEGIN
	READ_SHORT ("%effects_offset%" + ("%loops%" * 0x30)) "type"
	PATCH_IF (("%type%" = 176) OR ("%type%" = 126)) BEGIN
	  SET "loops" = "%fx_num%"
	  SET "eff_ver" = 4
	END
  END
END ELSE BEGIN
  FOR (loops = 0; loops < fx_num; loops = loops + 1) BEGIN
	READ_LONG ("%effects_offset%" + 8 + ("%loops%" * 264)) "type"
	PATCH_IF (("%type%" = 176) OR ("%type%" = 126)) BEGIN
	  SET "loops" = "%fx_num%"
	  SET "eff_ver" = 4
	END
  END
END

COPY_EXISTING ~_montar.cre~ ~override~
READ_ASCII 0x0 file_ver
READ_BYTE  0x33 "eff_version"
READ_LONG  0x2a0 "known_offset"
READ_LONG  0x2a8 "spell_mem_info_offset"
READ_LONG  0x2b0 "memorized_offset"
READ_LONG  0x2b8 "slots_offset"
READ_LONG  0x2bc "items_offset"
READ_LONG  0x2c4 "effects_offset"
READ_LONG  0x2c8 "fx_num"
SET snd_num = (1 - 2)
//correct empty sound strref entries for reading by dltcep
FOR (x=0;x<100;x+=1) BEGIN
 READ_LONG (0xa4 + (%x% * 4)) snd_string
 READ_STRREF (0xa4 + (%x% * 4)) ~snd_text~
 PATCH_IF (~%snd_text%~ STRING_COMPARE_REGEXP ~<Invalid Strref -1>~ =0)
   AND (%snd_string% != %snd_num%) BEGIN
  WRITE_LONG (0xa4 + (%x% * 4)) %snd_num%
 END
END
//ensure bg1 weap profs are removed
WRITE_BYTE 0x6e 0
WRITE_BYTE 0x6f 0
WRITE_BYTE 0x70 0
WRITE_BYTE 0x71 0
WRITE_BYTE 0x72 0
WRITE_BYTE 0x73 0
WRITE_BYTE 0x74 0
WRITE_BYTE 0x75 0
//remove old ver 1 effects
SET change = 0
PATCH_IF ((%fx_num% > 0) AND (%eff_version% =0)) BEGIN
 DELETE_BYTES (%effects_offset%) (48 * %fx_num%)
 SET change = 1
END
//change to ver 2 effects
PATCH_IF (%change% = 1) BEGIN
 WRITE_BYTE 0x33 1
//inserts 1st weap prof
 INSERT_BYTES %effects_offset% 264
 WRITE_LONG  (%effects_offset% +   8) 233	 // opcode	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  12) 1	   // target type // 4 bytes
 WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
 WRITE_LONG  (%effects_offset% +  20) 2	   // par1		// 4 bytes
 WRITE_LONG  (%effects_offset% +  24) 112	 // par2		// 4 bytes
 WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
 WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
 WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
 WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
 WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
 WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
 WRITE_LONG  (%effects_offset% +  60) 0	   // save_bonus  // 4 bytes
 WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
 WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  84) 0	   // res_type	// 4 bytes
 WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
 WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
 WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
 WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
 WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
 WRITE_ASCII (%effects_offset% + 140) ~~	  // fx_source   // 8 bytes
 WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
 WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
 WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
 WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
// inserts 2nd weap prof
 INSERT_BYTES %effects_offset% 264
 WRITE_LONG  (%effects_offset% +   8) 233	 // opcode	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  12) 1	   // target type // 4 bytes
 WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
 WRITE_LONG  (%effects_offset% +  20) 2	   // par1		// 4 bytes
 WRITE_LONG  (%effects_offset% +  24) 91	  // par2		// 4 bytes
 WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
 WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
 WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
 WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
 WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
 WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
 WRITE_LONG  (%effects_offset% +  60) 0	   // save_bonus  // 4 bytes
 WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
 WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  84) 0	   // res_type	// 4 bytes
 WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
 WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
 WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
 WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
 WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
 WRITE_ASCII (%effects_offset% + 140) ~~	  // fx_source   // 8 bytes
 WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
 WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
 WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
 WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes

//EDIT
//Made a mistake in the original code.
//In the following 5 patch blocks replace (264 * %fx_num%) with (264 * 2)
//This will fix a potential issue when TutuFix walking speeds is installed
//Also add this here where this comment block is at 
 WRITE_LONG 0x2c8 ("%fx_num%" + 2)
//Now everything should work correctly as far as I know.
//END EDIT

 PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" - (48 * %fx_num%) + (264 * %fx_num%))
 END
 PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" - (48 * %fx_num%) + (264 * %fx_num%))
 END
 PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a0 ("%known_offset%" - (48 * %fx_num%) + (264 * %fx_num%))
 END
 PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" - (48 * %fx_num%) + (264 * %fx_num%))
 END
 PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" - (48 * %fx_num%) + (264 * %fx_num%))
 END
END
//add tutufix walking speed if it was present and deleted
PATCH_IF ("%eff_ver%" = 4) AND (%change% = 1) BEGIN
 READ_LONG  0x2a0 "known_offset"
 READ_LONG  0x2a8 "spell_mem_info_offset"
 READ_LONG  0x2b0 "memorized_offset"
 READ_LONG  0x2b8 "slots_offset"
 READ_LONG  0x2bc "items_offset"
 READ_LONG  0x2c4 "effects_offset"
 READ_LONG  0x2c8 "fx_num"
 WRITE_LONG 0x2c8 ("%fx_num%" + 1)
 PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + 264)
 END
 PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" + 264)
 END
 PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%known_offset%" + 264)
 END
 PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" + 264)
 END
 PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" + 264)
 END
 INSERT_BYTES  ("%effects_offset%"	 ) 264
 WRITE_LONG  ("%effects_offset%" +  8) 176
 WRITE_LONG  ("%effects_offset%" + 12) 1
 WRITE_LONG  ("%effects_offset%" + 20) 0xfffffffd
 WRITE_LONG  ("%effects_offset%" + 24) 0
 WRITE_LONG  ("%effects_offset%" + 28) 9
 WRITE_SHORT ("%effects_offset%" + 36) 100
END
//assassin info
WRITE_LONG 0x244 0x400a0000 // assasin
WRITE_BYTE 0x235 0
WRITE_BYTE 0x236 0
WRITE_BYTE 0x273 0x4 // thief
WRITE_SHORT 0x28 0x6303 //thief_male_halfling
READ_BYTE 0x45 his
READ_BYTE 0x68 stealth
//erase stealth and shadow stats
WRITE_BYTE 0x45 0
WRITE_BYTE 0x68 0
//greater of two gets put into set traps
PATCH_IF (%stealth% >= %his%) BEGIN
 WRITE_BYTE 0x64 %his%	 //detect ill
 WRITE_BYTE 0x65 %stealth% //set traps
END
PATCH_IF (%his% >= %stealth%) BEGIN
 WRITE_BYTE 0x64 %stealth%	 //detect ill
 WRITE_BYTE 0x65 %his% //set traps
END
//add assassin effects
READ_LONG  0x2a0 "known_offset"
READ_LONG  0x2a8 "spell_mem_info_offset"
READ_LONG  0x2b0 "memorized_offset"
READ_LONG  0x2b8 "slots_offset"
READ_LONG  0x2bc "items_offset"
READ_LONG  0x2c4 "effects_offset"
READ_LONG  0x2c8 "fx_num"
INSERT_BYTES %effects_offset% 264
 WRITE_LONG  (%effects_offset% +   8) 73	 // opcode	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  12) 2	   // target type // 4 bytes
 WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
 WRITE_LONG  (%effects_offset% +  20) 1	   // par1		// 4 bytes
 WRITE_LONG  (%effects_offset% +  24) 0	 // par2		// 4 bytes
 WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
 WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
 WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
 WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
 WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
 WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
 WRITE_LONG  (%effects_offset% +  60) (0 - 2)	   // save_bonus  // 4 bytes
 WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
 WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  84) 2	   // res_type	// 4 bytes
 WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
 WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
 WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
 WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
 WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
 WRITE_ASCII (%effects_offset% + 140) ~SPCL421~	  // fx_source   // 8 bytes
 WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
 WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
 WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
 WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
INSERT_BYTES %effects_offset% 264
 WRITE_LONG  (%effects_offset% +   8) 177	 // opcode	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  12) 2	   // target type // 4 bytes
 WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
 WRITE_LONG  (%effects_offset% +  20) 0	   // par1		// 4 bytes
 WRITE_LONG  (%effects_offset% +  24) 2	 // par2		// 4 bytes
 WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
 WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
 WRITE_ASCII (%effects_offset% +  40) ~HITPLUS1~	  // resref	  // 8 bytes
 WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
 WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
 WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
 WRITE_LONG  (%effects_offset% +  60) (0 - 2)	   // save_bonus  // 4 bytes
 WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
 WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  84) 2	   // res_type	// 4 bytes
 WRITE_BYTE  (%effects_offset% +  88) 1	   // par3		// 1 byte
 WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
 WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
 WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
 WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
 WRITE_ASCII (%effects_offset% + 140) ~SPCL421~	  // fx_source   // 8 bytes
 WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
 WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
 WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
 WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
WRITE_LONG 0x2c8 ("%fx_num%" + 2)
PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + (264 * 2))
END
PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2b0 ("%memorized_offset%" + (264 * 2))
END
PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2b0 ("%known_offset%" + (264 * 2))
END
PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2b8 ("%slots_offset%" + (264 * 2))
END
PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2bc ("%items_offset%" + (264 * 2))
END
BUT_ONLY_IF_IT_CHANGES
//add spells
COPY_EXISTING ~_montar.cre~ ~override~
ADD_KNOWN_SPELL ~SPCL412~ #0 ~innate~
ADD_KNOWN_SPELL ~SPCL423~ #0 ~innate~
BUT_ONLY_IF_IT_CHANGES

Link to comment

Okay folks forget about the code I posted above... I decided since I had made a start on it that I might as well finish the task. So here is the latest and greatest code to convert all EasyTutu files of Montaron into an Assassin. I don't have BGT so I can't do whatever it takes to make sure it works there.

I didn't change things like XP values, resistances or lore levels. I wasn't sure why BG2Tweaks lowered those values from the converted bioware originals. Somehow in the midst of all this, I got rid of the "harmless inconsistency error" displayed in DLTCEP. It happened only after adding in the ADD_MEMORIZED_SPELL lines. Don't know why, but it's gone now. Oh, I almost forgot about the original problem, ADD_CRE_ITEM now does what its supposed to do on the file. So not only does it patch Montaron into an assassin it also solves the problem I had between BG2Tweaks and iiItemMod.

 

CamDawg or any other BG2Tweaks author: Use it, abuse it, change it if needed. It's yours, but I reserve the right to use code from it for other stuff if needed. I see there is a newer version of BG2Tweaks available now. I should check that to see if you've solved the problem already. But the change log doesn't list this component, so its doubtful. In either case, I'll share my work. It really is a great learning experience to just get in there and mess around with a file and see what you can and can not do.

 

Here is the code:

BEGIN ~Convert Montar to an Assassin~
//taken from the BG2Tweaks Version 3 form of this component
//only slight modification in one variable name
 COPY_EXISTING ~_montar.cre~ ~override/cdt04090.g3~
READ_ASCII 0xa4 "soundset" (396)
READ_BYTE  0x33 "eff_ver"
READ_LONG  0x2c4 "effects_offset"
READ_LONG  0x2c8 "fx_num"
PATCH_IF ("%eff_ver%" = 0) BEGIN
  FOR (loops = 0; loops < fx_num; loops = loops + 1) BEGIN
	READ_SHORT ("%effects_offset%" + ("%loops%" * 0x30)) "type"
	PATCH_IF (("%type%" = 176) OR ("%type%" = 126)) BEGIN
	  SET "loops" = "%fx_num%"
	  SET "eff_ver" = 4
	END
  END
END ELSE BEGIN
  FOR (loops = 0; loops < fx_num; loops = loops + 1) BEGIN
	READ_LONG ("%effects_offset%" + 8 + ("%loops%" * 264)) "type"
	PATCH_IF (("%type%" = 176) OR ("%type%" = 126)) BEGIN
	  SET "loops" = "%fx_num%"
	  SET "eff_ver" = 4
	END
  END
END

//all new code by me plainab (with exeception to the section regarding tutufix walking speeds)
COPY_EXISTING ~_montar.cre~ ~override~
		  ~_montar2.cre~ ~override~
		  ~_montar4.cre~ ~override~
		  ~_montar6.cre~ ~override~
READ_ASCII 0x0 file_ver
READ_BYTE  0x33 "eff_version"
READ_LONG  0x2a0 "known_offset"
READ_LONG  0x2a8 "spell_mem_info_offset"
READ_LONG  0x2b0 "memorized_offset"
READ_LONG  0x2b8 "slots_offset"
READ_LONG  0x2bc "items_offset"
READ_LONG  0x2c4 "effects_offset"
READ_LONG  0x2c8 "fx_num"
SET snd_num = (1 - 2)
//correct empty sound strref entries for reading by dltcep
FOR (x=0;x<100;x+=1) BEGIN
 READ_LONG (0xa4 + (%x% * 4)) snd_string
 READ_STRREF (0xa4 + (%x% * 4)) ~snd_text~
 PATCH_IF (~%snd_text%~ STRING_COMPARE_REGEXP ~<Invalid Strref -1>~ =0)
   AND (%snd_string% != %snd_num%) BEGIN
  WRITE_LONG (0xa4 + (%x% * 4)) %snd_num%
 END
END
//ensure bg1 weap profs are removed
WRITE_BYTE 0x6e 0
WRITE_BYTE 0x6f 0
WRITE_BYTE 0x70 0
WRITE_BYTE 0x71 0
WRITE_BYTE 0x72 0
WRITE_BYTE 0x73 0
WRITE_BYTE 0x74 0
WRITE_BYTE 0x75 0
//remove old effects and update offsets
SET change = 0
// version 1 effects removal (original bg1 converted files)
PATCH_IF ((%fx_num% > 0) AND (%eff_version% =0)) BEGIN
 DELETE_BYTES (%effects_offset%) (48 * %fx_num%)
 SET change = 1
 WRITE_LONG 0x2c8 0
 PATCH_IF ("%spell_mem_info_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" - (48 * %fx_num%))
 END
 PATCH_IF ("%memorized_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" - (48 * %fx_num%))
 END
 PATCH_IF ("%known_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2a0 ("%known_offset%" - (48 * %fx_num%))
 END
 PATCH_IF ("%slots_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" - (48 * %fx_num%))
 END
 PATCH_IF ("%items_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" - (48 * %fx_num%))
 END
END
// version 2 effects removal (original bg2 files & most mod provided files)
PATCH_IF ((%eff_version% = 1) AND (%fx_num% >0)) BEGIN
 DELETE_BYTES (%effects_offset%) (264 * %fx_num%)
 SET change = 1
 WRITE_LONG 0x2c8 0
 PATCH_IF ("%spell_mem_info_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" - (264 * %fx_num%))
 END
 PATCH_IF ("%memorized_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" - (264 * %fx_num%))
 END
 PATCH_IF ("%known_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2a0 ("%known_offset%" - (264 * %fx_num%))
 END
 PATCH_IF ("%slots_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" - (264 * %fx_num%))
 END
 PATCH_IF ("%items_offset%" > "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" - (264 * %fx_num%))
 END
END
//change to ver 2 effects and update offsets
PATCH_IF (%change% = 1) BEGIN
 READ_LONG  0x2a0 "known_offset"
 READ_LONG  0x2a8 "spell_mem_info_offset"
 READ_LONG  0x2b0 "memorized_offset"
 READ_LONG  0x2b8 "slots_offset"
 READ_LONG  0x2bc "items_offset"
 READ_LONG  0x2c4 "effects_offset"
 READ_LONG  0x2c8 "fx_num"
 WRITE_BYTE 0x33 1
 WRITE_LONG 0x2c8 (%fx_num% + 2)
//inserts 1st weap prof
 INSERT_BYTES %effects_offset% 264
  WRITE_LONG  (%effects_offset% +   8) 233	 // opcode	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  12) 1	   // target type // 4 bytes
  WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
  WRITE_LONG  (%effects_offset% +  20) 1	   // par1		// 4 bytes
  WRITE_LONG  (%effects_offset% +  24) 96	  // par2		// 4 bytes
  WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
  WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
  WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
  WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
  WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
  WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
  WRITE_LONG  (%effects_offset% +  60) 0	   // save_bonus  // 4 bytes
  WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
  WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  84) 0	   // res_type	// 4 bytes
  WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
  WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
  WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
  WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
  WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
  WRITE_ASCII (%effects_offset% + 140) ~~	  // fx_source   // 8 bytes
  WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
  WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
  WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
  WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
// inserts 2nd weap prof
 INSERT_BYTES %effects_offset% 264
  WRITE_LONG  (%effects_offset% +   8) 233	 // opcode	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  12) 1	   // target type // 4 bytes
  WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
  WRITE_LONG  (%effects_offset% +  20) 1	   // par1		// 4 bytes
  WRITE_LONG  (%effects_offset% +  24) 91	  // par2		// 4 bytes
  WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
  WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
  WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
  WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
  WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
  WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
  WRITE_LONG  (%effects_offset% +  60) 0	   // save_bonus  // 4 bytes
  WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
  WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  84) 0	   // res_type	// 4 bytes
  WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
  WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
  WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
  WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
  WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
  WRITE_ASCII (%effects_offset% + 140) ~~	  // fx_source   // 8 bytes
  WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
  WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
  WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
  WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
 PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + (264 * 2))
 END
 PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" + (264 * 2))
 END
 PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a0 ("%known_offset%" + (264 * 2))
 END
 PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" + (264 * 2))
 END
 PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" + (264 * 2))
 END
//add tutufix walking speed if it was present and update offsets
 PATCH_IF ("%eff_ver%" = 4) BEGIN
  READ_LONG  0x2a0 "known_offset"
  READ_LONG  0x2a8 "spell_mem_info_offset"
  READ_LONG  0x2b0 "memorized_offset"
  READ_LONG  0x2b8 "slots_offset"
  READ_LONG  0x2bc "items_offset"
  READ_LONG  0x2c4 "effects_offset"
  READ_LONG  0x2c8 "fx_num"
  WRITE_LONG 0x2c8 ("%fx_num%" + 1)
  PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + 264)
  END
  PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
WRITE_LONG 0x2b0 ("%memorized_offset%" + 264)
  END
  PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
WRITE_LONG 0x2b0 ("%known_offset%" + 264)
  END
  PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
WRITE_LONG 0x2b8 ("%slots_offset%" + 264)
  END
  PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
WRITE_LONG 0x2bc ("%items_offset%" + 264)
  END
  INSERT_BYTES  ("%effects_offset%"	 ) 264
WRITE_LONG  ("%effects_offset%" +  8) 176
WRITE_LONG  ("%effects_offset%" + 12) 1
WRITE_LONG  ("%effects_offset%" + 20) 0xfffffffd
WRITE_LONG  ("%effects_offset%" + 24) 0
WRITE_LONG  ("%effects_offset%" + 28) 9
WRITE_SHORT ("%effects_offset%" + 36) 100
 END
END
//assassin info -- Not quite like BG2Tweaks file.
//only required changes made
WRITE_LONG 0x244 0x400a0000 // assasin
WRITE_BYTE 0x235 0
WRITE_BYTE 0x236 0
WRITE_BYTE 0x273 0x4 // thief
WRITE_SHORT 0x28 0x6303 //thief_male_halfling
PATCH_IF (~%SOURCE_RES%~ STRING_COMPARE_REGEXP ~^_MONTAR$~ =0) BEGIN
//adjust thief ability stats
 WRITE_BYTE 0x45 0   // hide in shadows
 WRITE_BYTE 0x64 10  // detect ill
 WRITE_BYTE 0x65 20  // set traps
 WRITE_BYTE 0x67 0   // lock picking
 WRITE_BYTE 0x68 0   // stealth
 WRITE_BYTE 0x69 0   // find traps
 WRITE_BYTE 0x6a 10  // pick pockets
END
PATCH_IF (~%SOURCE_RES%~ STRING_COMPARE_REGEXP ~^_MONTAR2$~ =0) BEGIN
//adjust thief ability stats
 WRITE_BYTE 0x45 0   // hide in shadows
 WRITE_BYTE 0x64 10  // detect ill
 WRITE_BYTE 0x65 20  // set traps
 WRITE_BYTE 0x67 0   // lock picking
 WRITE_BYTE 0x68 10  // stealth
 WRITE_BYTE 0x69 0   // find traps
 WRITE_BYTE 0x6a 15  // pick pockets
END
PATCH_IF (~%SOURCE_RES%~ STRING_COMPARE_REGEXP ~^_MONTAR4$~ =0) BEGIN
//adjust thief ability stats
 WRITE_BYTE 0x45 0   // hide in shadows
 WRITE_BYTE 0x64 10  // detect ill
 WRITE_BYTE 0x65 20  // set traps
 WRITE_BYTE 0x67 0   // lock picking
 WRITE_BYTE 0x68 25  // stealth
 WRITE_BYTE 0x69 0   // find traps
 WRITE_BYTE 0x6a 30  // pick pockets
//add weapon style effect
 READ_LONG  0x2a0 "known_offset"
 READ_LONG  0x2a8 "spell_mem_info_offset"
 READ_LONG  0x2b0 "memorized_offset"
 READ_LONG  0x2b8 "slots_offset"
 READ_LONG  0x2bc "items_offset"
 READ_LONG  0x2c4 "effects_offset"
 READ_LONG  0x2c8 "fx_num"
 WRITE_LONG 0x2c8 ("%fx_num%" + 1)
 INSERT_BYTES %effects_offset% 264
  WRITE_LONG  (%effects_offset% +   8) 233	 // opcode	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  12) 1	   // target type // 4 bytes
  WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
  WRITE_LONG  (%effects_offset% +  20) 1	   // par1		// 4 bytes
  WRITE_LONG  (%effects_offset% +  24) 113	 // par2		// 4 bytes
  WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
  WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
  WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
  WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
  WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
  WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
  WRITE_LONG  (%effects_offset% +  60) 0	   // save_bonus  // 4 bytes
  WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
  WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  84) 0	   // res_type	// 4 bytes
  WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
  WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
  WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
  WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
  WRITE_LONG  (%effects_offset% + 120) (0 - 1) // casX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 124) (0 - 1) // casY_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 128) (0 - 1) // tarX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 132) (0 - 1) // tarY_pos	// 4 bytes
  WRITE_ASCII (%effects_offset% + 140) ~~	  // fx_source   // 8 bytes
  WRITE_LONG  (%effects_offset% + 156) (0 - 1) // unknown	// 4 bytes
  WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
  WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
  WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
 PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + (264 * 1))
 END
 PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" + (264 * 1))
 END
 PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a0 ("%known_offset%" + (264 * 1))
 END
 PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" + (264 * 1))
 END
 PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" + (264 * 1))
 END
END
PATCH_IF (~%SOURCE_RES%~ STRING_COMPARE_REGEXP ~^_MONTAR6$~ =0) BEGIN
//adjust thief ability stats
 WRITE_BYTE 0x45 0   // hide in shadows
 WRITE_BYTE 0x64 10  // detect ill
 WRITE_BYTE 0x65 20  // set traps
 WRITE_BYTE 0x67 0   // lock picking
 WRITE_BYTE 0x68 40  // stealth
 WRITE_BYTE 0x69 0   // find traps
 WRITE_BYTE 0x6a 45  // pick pockets
//add weapon style effect
 READ_LONG  0x2a0 "known_offset"
 READ_LONG  0x2a8 "spell_mem_info_offset"
 READ_LONG  0x2b0 "memorized_offset"
 READ_LONG  0x2b8 "slots_offset"
 READ_LONG  0x2bc "items_offset"
 READ_LONG  0x2c4 "effects_offset"
 READ_LONG  0x2c8 "fx_num"
 WRITE_LONG 0x2c8 ("%fx_num%" + 1)
 INSERT_BYTES %effects_offset% 264
//all known effect offsets are listed - not all are used
//keeping this set as a descriptive whole for future possible uses
// Write Type  Offset location		  Value   Read Variable  Size in bytes
  WRITE_LONG  (%effects_offset% +   8) 233	 // opcode	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  12) 1	   // target_type // 4 bytes
  WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
  WRITE_LONG  (%effects_offset% +  20) 1	   // par1		// 4 bytes
  WRITE_LONG  (%effects_offset% +  24) 113	 // par2		// 4 bytes
  WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
  WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
  WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
  WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
  WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
  WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
  WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
  WRITE_LONG  (%effects_offset% +  60) 0	   // save_bonus  // 4 bytes
  WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
  WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
  WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
  WRITE_LONG  (%effects_offset% +  84) 0	   // res_type	// 4 bytes
  WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
  WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
  WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
  WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
  WRITE_LONG  (%effects_offset% + 120) (0 - 1) // casX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 124) (0 - 1) // casY_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 128) (0 - 1) // tarX_pos	// 4 bytes
  WRITE_LONG  (%effects_offset% + 132) (0 - 1) // tarY_pos	// 4 bytes
  WRITE_ASCII (%effects_offset% + 140) ~~	  // fx_source   // 8 bytes
// this unknown value below is consistent within all bioware provided version 2 effects
// (at least the ones I looked at)
  WRITE_LONG  (%effects_offset% + 156) (0 - 1) // unknown	 // 4 bytes
  WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
  WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
  WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
 PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + (264 * 1))
 END
 PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b0 ("%memorized_offset%" + (264 * 1))
 END
 PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2a0 ("%known_offset%" + (264 * 1))
 END
 PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2b8 ("%slots_offset%" + (264 * 1))
 END
 PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
  WRITE_LONG 0x2bc ("%items_offset%" + (264 * 1))
 END
END
//add assassin effects and update offsets
READ_LONG  0x2a0 "known_offset"
READ_LONG  0x2a8 "spell_mem_info_offset"
READ_LONG  0x2b0 "memorized_offset"
READ_LONG  0x2b8 "slots_offset"
READ_LONG  0x2bc "items_offset"
READ_LONG  0x2c4 "effects_offset"
READ_LONG  0x2c8 "fx_num"
INSERT_BYTES %effects_offset% 264
 WRITE_LONG  (%effects_offset% +   8) 73	 // opcode	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  12) 2	   // target type // 4 bytes
 WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
 WRITE_LONG  (%effects_offset% +  20) 1	   // par1		// 4 bytes
 WRITE_LONG  (%effects_offset% +  24) 0	 // par2		// 4 bytes
 WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
 WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
 WRITE_ASCII (%effects_offset% +  40) ~~	  // resref	  // 8 bytes
 WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
 WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
 WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
 WRITE_LONG  (%effects_offset% +  60) (0 - 2)	   // save_bonus  // 4 bytes
 WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
 WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  84) 2	   // res_type	// 4 bytes
 WRITE_BYTE  (%effects_offset% +  88) 0	   // par3		// 1 byte
 WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
 WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
 WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
 WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
 WRITE_ASCII (%effects_offset% + 140) ~SPCL421~	  // fx_source   // 8 bytes
 WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
 WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
 WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
 WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
INSERT_BYTES %effects_offset% 264
 WRITE_LONG  (%effects_offset% +   8) 177	 // opcode	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  12) 2	   // target type // 4 bytes
 WRITE_LONG  (%effects_offset% +  16) 0	   // power	   // 4 bytes
 WRITE_LONG  (%effects_offset% +  20) 0	   // par1		// 4 bytes
 WRITE_LONG  (%effects_offset% +  24) 2	 // par2		// 4 bytes
 WRITE_BYTE  (%effects_offset% +  28) 9	   // timing	  // 1 byte
 WRITE_LONG  (%effects_offset% +  32) 0	   // duration	// 4 bytes
 WRITE_SHORT (%effects_offset% +  36) 100	 // prob1	   // 2 bytes
 WRITE_SHORT (%effects_offset% +  38) 0	   // prob2	   // 2 bytes
 WRITE_ASCII (%effects_offset% +  40) ~HITPLUS1~	  // resref	  // 8 bytes
 WRITE_LONG  (%effects_offset% +  48) 0	   // dice_thrown // 4 bytes
 WRITE_LONG  (%effects_offset% +  52) 0	   // dice_sides  // 4 bytes
 WRITE_LONG  (%effects_offset% +  56) 0	   // save_throw  // 4 bytes
 WRITE_LONG  (%effects_offset% +  60) (0 - 2)	   // save_bonus  // 4 bytes
 WRITE_LONG  (%effects_offset% +  64) 0	   // var_uk	  // 4 bytes
 WRITE_LONG  (%effects_offset% +  68) 0	   // 1st_school  // 4 bytes
 WRITE_LONG  (%effects_offset% +  76) 0	   // lal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  80) 0	   // hal		 // 4 bytes
 WRITE_LONG  (%effects_offset% +  84) 2	   // res_type	// 4 bytes
 WRITE_BYTE  (%effects_offset% +  88) 1	   // par3		// 1 byte
 WRITE_BYTE  (%effects_offset% +  89) 0	   // par4		// 1 byte
 WRITE_ASCII (%effects_offset% + 104) ~~	  // vvc_resref  // 8 bytes
 WRITE_ASCII (%effects_offset% + 112) ~~	  // res_2	   // 8 bytes
 WRITE_LONG  (%effects_offset% + 120) (0 - 1)	   // casX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 124) (0 - 1)	   // casY_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 128) (0 - 1)	   // tarX_pos	// 4 bytes
 WRITE_LONG  (%effects_offset% + 132) (0 - 1)	   // tarY_pos	// 4 bytes
 WRITE_ASCII (%effects_offset% + 140) ~SPCL421~	  // fx_source   // 8 bytes
 WRITE_LONG  (%effects_offset% + 156) (0 - 1)	   // unknown	// 4 bytes
 WRITE_ASCII (%effects_offset% + 160) ~~ (32) // variable (32) // 32 bytes char array
 WRITE_SHORT (%effects_offset% + 192) 0	   // cas_level   // 2 bytes
 WRITE_LONG  (%effects_offset% + 200) 0	   // 2nd_school  // 4 bytes
WRITE_LONG 0x2c8 ("%fx_num%" + 2)
PATCH_IF ("%spell_mem_info_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2a8 ("%spell_mem_info_offset%" + (264 * 2))
END
PATCH_IF ("%memorized_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2b0 ("%memorized_offset%" + (264 * 2))
END
PATCH_IF ("%known_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2b0 ("%known_offset%" + (264 * 2))
END
PATCH_IF ("%slots_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2b8 ("%slots_offset%" + (264 * 2))
END
PATCH_IF ("%items_offset%" >= "%effects_offset%") BEGIN
 WRITE_LONG 0x2bc ("%items_offset%" + (264 * 2))
END
BUT_ONLY_IF_IT_CHANGES
//adds spells to all versions of montar
COPY_EXISTING ~_montar.cre~ ~override~
		  ~_montar2.cre~ ~override~
		  ~_montar4.cre~ ~override~
		  ~_montar6.cre~ ~override~
ADD_KNOWN_SPELL ~SPCL412~ #0 ~innate~
ADD_KNOWN_SPELL ~SPCL423~ #0 ~innate~
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~_montar.cre~ ~override~
		  ~_montar2.cre~ ~override~
		  ~_montar4.cre~ ~override~
ADD_MEMORIZED_SPELL ~SPCL412~ #0 ~innate~
ADD_MEMORIZED_SPELL ~SPCL423~ #0 ~innate~
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~_montar6.cre~ ~override~
ADD_MEMORIZED_SPELL ~SPCL412~ #0 ~innate~
ADD_MEMORIZED_SPELL ~SPCL412~ #0 ~innate~
ADD_MEMORIZED_SPELL ~SPCL423~ #0 ~innate~
ADD_MEMORIZED_SPELL ~SPCL423~ #0 ~innate~
BUT_ONLY_IF_IT_CHANGES
//make sure spells can be memorized
COPY_EXISTING ~_montar.cre~ ~override~
		  ~_montar2.cre~ ~override~
		  ~_montar4.cre~ ~override~
		  ~_montar6.cre~ ~override~
READ_LONG  0x2a8 "spell_mem_info_offset"
READ_LONG  0x2ac ~smi_num~
PATCH_IF !(~%SOURCE_RES%~ STRING_COMPARE_REGEXP ~^_MONTAR6$~ =0) BEGIN
 FOR (x=0;x<%smi_num%;x+=1) BEGIN
  WRITE_SHORT (%spell_mem_info_offset% + (%x% * 0x10) + 0x2) 4 //number of memorizable spells
  WRITE_SHORT (%spell_mem_info_offset% + (%x% * 0x10) + 0x4) 4 //number of memorizable spells (after effects)
 END
END
PATCH_IF (~%SOURCE_RES%~ STRING_COMPARE_REGEXP ~^_MONTAR6$~ =0) BEGIN
 FOR (x=0;x<%smi_num%;x+=1) BEGIN
  WRITE_SHORT (%spell_mem_info_offset% + (%x% * 0x10) + 0x2) 6 //number of memorizable spells
  WRITE_SHORT (%spell_mem_info_offset% + (%x% * 0x10) + 0x4) 6 //number of memorizable spells (after effects)
 END
END
BUT_ONLY_IF_IT_CHANGES
Link to comment
Ummm. Sorry, I didn't read all of your posts, but why not just try Level 1 NPC mod <development thread>: skip the BG2 tweak, install L1 at the end of your installation, make Montaron whatever kit you want??

The goal was not to make montaron as an assassion. If that was the case, I could have done what you suggest. The goal was to solve a problem with a specific mod component. You may not find it worth doing, but why should I just say "Hey here is a problem" and then sit back and hope that someone else will find a solution or workaround. I've learned a little in weidu coding so I took the problem and solved it myself.

Link to comment
...why should I just say "Hey here is a problem" and then sit back and hope that someone else will find a solution or workaround.

Some would say that's what happens in a modding forum.

You are right. For the most part that is how things go.

 

But how are we to learn, if we just say here's a problem and let it go at that? G3 or any other modding forum is not Bioware and thus should not be left to solve the problems all on their own (and Bioware is not solving problems anymore). It is we the members who make up the various modding forums that must put forth the solutions. So to that end, I found a problem, solved and have provided that solution. It is up to others to decide if it gets used or not. In the end, it does not matter for I've learned a few new things about coding cre files in the process.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...