Jump to content

Possible bug in BG2 Tweak pack


Aranthys

Recommended Posts

While reading the .tp2, i came across this code.

It seems like the additional spells are messed up somehow :

You give her spells if she gets 15 Wisdom

You remove spells from her if she gets 18 Wisdom

 

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////												  \\\\\
///// Stat changes: Viconia							\\\\\
/////												  \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

/////												  \\\\\
///// BG Values										\\\\\
/////												  \\\\\

BEGIN @403001 DESIGNATED 4070 // Use BG Stats
GROUP @0
SUBCOMPONENT @407000 // Stat Changes: Viconia

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt04070.g3~

COPY_EXISTING_REGEXP GLOB ~^\(bg\|_\)?viconi[0-9]*\.cre$~ ~override~
 READ_BYTE  0x5d  "mr" ELSE 50
 PATCH_IF ("%mr%" != 50) BEGIN
WRITE_BYTE 0x5d 50
 END
 READ_BYTE  0x23b "wis" ELSE 15
 PATCH_IF ("%wis%" != 15) BEGIN
WRITE_BYTE 0x23b 15 // 15 WIS
READ_LONG  0x2a8 "mem_info"
FOR (index = 1; index < 4; index = index + 1) BEGIN // adds level 2, 3, 4 bonus spell for 15 >> 18 WIS
  READ_LONG ("%mem_info%" + 0x04 + ("%index%" * 0x10)) "spells"
  PATCH_IF ("%spells%" > 0) BEGIN
	WRITE_LONG ("%mem_info%" + 0x04 + ("%index%" * 0x10)) ("%spells%" + 1)
  END
END
 END
 BUT_ONLY_IF_IT_CHANGES

/////												  \\\\\
///// BG2 Values									   \\\\\
/////												  \\\\\

BEGIN @403100 DESIGNATED 4071 // Use BG2 Stats
GROUP @0
SUBCOMPONENT @407000 // Stat Changes: Viconia

// this file does nothing, it just allows other mods to detect this component
COPY_EXISTING ~sw1h01.itm~ ~override/cdt04071.g3~

COPY_EXISTING_REGEXP GLOB ~^\(bg\|_\)?viconi[0-9]*\.cre$~ ~override~
 READ_BYTE  0x5d  "mr" ELSE 65
 PATCH_IF ("%mr%" != 65) BEGIN
WRITE_BYTE 0x5d 65
 END
 READ_BYTE  0x23b "wis" ELSE 18
 PATCH_IF ("%wis%" != 18) BEGIN
WRITE_BYTE 0x23b 18 // 18 WIS
READ_LONG  0x2a8 "mem_info"
FOR (index = 1; index < 4; index = index + 1) BEGIN // removes level 2, 3, 4 bonus spell for 18 >> 15 WIS
  READ_LONG ("%mem_info%" + 0x04 + ("%index%" * 0x10)) "spells"
  PATCH_IF ("%spells%" > 0) BEGIN
	WRITE_LONG ("%mem_info%" + 0x04 + ("%index%" * 0x10)) ("%spells%" - 1)
  END
END
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment
I modified my protagonist priest's wis with SK and found the number of bonus spell slot changing dynamically. So is it really neccesary to patch spell slot number?
Probably not, from what I recall. If it doesn't happen immediately (which it might, if what you're saying is true) then it definitely does on level up.

 

Edit: I should add, for the sake of modding interest, that ADD_KNOWN_SPELL automatically augments the number of slots, whereas ADD_MEMORIZED_SPELL augments both A_K_S and the number of slots automatically. Both of these (or at least the auto-augment feature) postdate Tweaks if I'm not wrong, which is why I told Aranthys it isn't the best mod to get current code examples from.

Link to comment

Archived

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

×
×
  • Create New...