Jump to content

Rebuilding Blucher's alternate BG2 NPCs


Recommended Posts

The INNER_PATCH_SAVE is okay - that's there in case I decide at some point to examine each 0x108 effect block and do some checking that it's correctly structured. For now it doesn't - mostly because it's an error I've not ever seen :)


The PATCH_IF NOT ... will need a leading ( parenthesis, or have the ) at the end removed - I generally prefer the former as it's less chance of ambiguity, but either should work here. All of the "are you dual classed?" checks in that section ought to look this way, and it's probably my cut and paste error here.

Link to comment

By the by, the item section works something like this:

  1. Check each of the NPCs items to see if it's "generic", if so, delete it.
  2. Update the usability on anything left over so their new class and/or kit still can equip it.
  3. Add a smattering of new generic stuff based on class.

BG2 NPCs are easy, they get a +1 weapon for each weapon proficiency they have and the best non-magical armor they can wear based on their class, kit, and strength. This doesn't quite match the existing NPCs (mages get non-magical quarterstaff and sling in the unmodded game) but it's close. Minsc, Jaheira, and Imoen get nothin'.


NPCs with 2,500,000 experience get a generic +3 weapon, +1 or +2 armor, some potions, and a trinket instead.


NPCs with <89,000 experience are a little tricker: the BG1 NPCs are wildly inconsistent (Branwen and Dynaheir and Yeslick are walking around with naught but the shirts on their backs). Right now they're getting a non-magical weapon, a helmet and armor if they're of a martial class, and that's it - would welcome suggestions on how to make this either more story-faithful or less annoying :)

Link to comment

Guess I'll leave the eff structure as v1 for now and hope the modders were all very scrupulous about the length of their variable names and not using variable setting via external eff files.


Probably won't have a chance to start debugging work until Thursday.

Link to comment

Let's include forcible .eff version conversion.

// just the effects ma'am
 PATCH_IF		  ("eff_version" = 0x0) THEN BEGIN
SET "eff_size" = 0x30
 END ELSE PATCH_IF ("eff_version" = 0x1) THEN BEGIN
SET "eff_size" = 0x108
SET "eff_size" = 0x108
PATCH_PRINT ~%SOURCE_FILE% has an invalid eff version of %eff_version%, defaulting to v2.~

 PATCH_IF ("count_of_effects" > 0x00) THEN BEGIN
FOR ("count_of_effects_index1" = ("offset_to_effects" + ("count_of_effects" * "eff_size")); "count_of_effects_index1" > "offset_to_effects"; "count_of_effects_index1" -= "eff_size") BEGIN
  READ_LONG ("count_of_effects_index1" - 0x04) "count_of_effects_check" ELSE 0xeeeeeeee
  PATCH_IF ("count_of_effects_check" != 0xeeeeeeee) THEN BEGIN
	READ_ASCII "offset_to_effects" ~effects_list~ ("count_of_effects" * "eff_size")
	INNER_PATCH_SAVE ~revised_effects_list~ ~%effects_list%~ BEGIN
	  PATCH_IF ("eff_size" = 0x30) THEN BEGIN
		FOR ("eff_size_index" = ("count_of_effects" * 0x30); "eff_size_index" > 0x0; "eff_size_index" -= 0x30) BEGIN
		  READ_SHORT   ("eff_size_index" - 0x30) "opcode"
		  READ_BYTE	("eff_size_index" - 0x2d) "power"
		  READ_LONG	("eff_size_index" - 0x2c) "parameter1"
		  READ_LONG	("eff_size_index" - 0x28) "parameter2"
		  READ_BYTE	("eff_size_index" - 0x24) "timing_mode"
		  READ_BYTE	("eff_size_index" - 0x23) "dispellability"
		  READ_LONG	("eff_size_index" - 0x22) "duration"
		  READ_BYTE	("eff_size_index" - 0x1e) "probability1"
		  READ_BYTE	("eff_size_index" - 0x1d) "probability2"
		  READ_ASCII   ("eff_size_index" - 0x1c) ~resref~
		  DELETE_BYTES ("eff_size_index" - 0x30) 0x30
		  INSERT_BYTES ("eff_size_index" - 0x30) 0x108
		  WRITE_SHORT  ("eff_size_index" - 0x28) "opcode"
		  WRITE_BYTE   ("eff_size_index" - 0x20) "power"
		  WRITE_LONG   ("eff_size_index" - 0x1c) "parameter1"
		  WRITE_LONG   ("eff_size_index" - 0x18) "parameter2"
		  WRITE_BYTE   ("eff_size_index" - 0x17) "timing_mode"
		  WRITE_LONG   ("eff_size_index" - 0x10) "duration"
		  WRITE_SHORT  ("eff_size_index" - 0x0c) "probability1"
		  WRITE_SHORT  ("eff_size_index" - 0x0a) "probability2"
		  WRITE_ASCII  ("eff_size_index" - 0x08) ~resref~
		  WRITE_BYTE   ("eff_size_index" + 0x24) "dispellability"
		  WRITE_LONG   ("eff_size_index" + 0x98) 0x1
	SET "count_of_effects_index1" = "offset_to_effects"
	SET "count_of_effects" -= 0x01
	PATCH_PRINT ~%SOURCE_FILE% is listed as having more embedded effects than it actually has.~


And in other breaking news, Nythrun has forgotten to close a parethesis and has omitted the BEGIN at the end of PATCH_IF statements three times. Hilarity ensues!

Link to comment

They're okay for most purposes, but storing untruncated local variables over reloads is kind of important.


I don't seriously expect that any party joinables are going to be using the old .eff system, but it's being included to satisfy my obsessive compulsive disorder.


Most of the other new parameters in v2 effs aren't used or are used seldom, but should the occasion arise, I'd rather have them than not :rant:

Link to comment

Whoa, wait... I didn't know there was a 'Creature Corrector' component in this thing. And I've been doing it all by hand, eyeballing various tables in the 2e PHB and what not, to make sure saving throws and THAC0s aren't completely out of whack? How flexible is this thing?

Link to comment
Guest Guest_Nythrun_*

As the .2das go, so goes the corrector - it follows whatever rules set the player has to deal with (thus it'll have problems handling creatures that have a class not because they're meant to be that class but because of some goofy effect that needs to work on them).


Portrait checking is no problem to add, inventory item bams would probably be best served for an item routine, I agree :p


Right now, a primary component (required to install the others) runs, patches kit.ids, and copies over party-joinables into a temp directory while running the correction macro. Then each NPC gets their own component which copies those files back to the override while modifying them (it's a little odd, yes, but should avoid one possible source of breakage).

Link to comment

Things have grown kind of awful of late, and I've no time for this at the moment.


Here's where it's at for the time being; I'll get back to it when I can.


There are messages in my inbox here, but they appear to be blanked out. Sorry.




Obsolete download link removed.

Link to comment

Hey there; I can read your PM's, Nythrun ???


Very definitely cool (and your bonus component is on fire - little tidbits for the true code-reader/apprentice to enjoy). My only thought is that if the creature correction component is as robust as it appears, I would love it if we packaged a full stand-alone NCC utility. It looks like that wold provide a good deal of info, and a stronger way of rebuilding/correcting .cres.


Plus I want it :( I don't trust my debugging/fixing your code... kinda like giving my 4th graders the keys to my car and saying "yo, cool - go take it for a spin!

Link to comment


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

  • Create New...