Jump to content

Imoen-Xan banter portrait issue


Enkida

Recommended Posts

So this is not a bug, but an interesting "feature" in the BG1NPC pack I uncovered a while ago:

 

Imoen will have a banter with Xan that results in

 

 

his hair turning pink, including a portrait change.

 

 

When he fixes this little problem, Xan's portrait reverts back to the file anbl.bmp and anbs.bmp rather than the vanilla portrait that ships with the game. This is not normally a problem unless you are using an alternative portrait for Xan, and as per Kulyok's instructions for custom Xan, portrait replacing is best done by overwriting the vanilla Xan portrait.

 

The inherent logical conflict is, if you use Kulyok's method, the Imoen-Xan banter will result in losing Xan's custom portrait after the banter because his .cre no longer refers to his vanilla portrait.

 

The most obvious "non fix" (since it's not a "bug" per se) would be to make the code in this banter redirect back to the vanilla portrait instead of anb[sl].bmp when Xan restores himself, so custom Xan portraits won't disappear.

 

Just pointing it out, in case anyone feels like meddling with it :-)

Link to comment

Yep - one of our "known unsolvables" :D

 

The problem is as you stated - but the 'unsolvable' in it is that the banter code cannot pick up and color custom portraits. So the 'pinkified' one will have to be the pinkified original shipped, no matter what. But we technically could change the behavior to revert to _anl.bmp _ans.bmp || xanl.bmp xans.bmp. It will mean that mods that change his portrait by re-writing his .cre to use a different one would have the same problem...

 

tell you what. When I go through this summer on my next round of buighunting/fixing, I will take a look and see what most currently downloaded portrait mods do, If most are still distributing and/or telling folks to edit the .cre to point to the new portrait, we will leave this alone; if most are indicating/installing NPC portraits via overwriting the actual portrait (putting a new _anl.bmp into override) teh we can recode to that %tutu_x%anl.bmp etc. are called. Taht way whichever is the largest group of users will avoid the challenge of a multi-polymorphing Xan.

Link to comment

Well, there's no need to speed a fix on this, we (Turambar, actually, I did more than nothing) found a workaround for my own portrait mod, so that's no kind of "urgent request to fix." However, if other people who are using another alternate run into this problem, it might be nice to just note it somewhere so they can take measures or at least not be surprised or confuzzled by the change.

 

If you want to have a look at the code Turambar made for my own mod, I can ask him about it. I would venture a relative guess I'm the only person nerdtastic enough to have noticed this tiny little thing in a portrait mod replacing pack that includes a Xan image, though.

 

Thanks for the reply! :)

Link to comment

Something I forgot yesterday - I've had the problem of new portraits not showing up in a game before, and found that I could overcome it by having my new custom portraits install in the Portrait rather than Override directory. In the course of doing my own mod, we found out the portrait directory has a higher override hierarchy than the override directory as well. So a possible "fix" in general for replacing any portrait in a new game is to install the new portrait in the Portrait rather than Override directory, then the .cre doesn't necessarily have to look to a new file. I think. I am known to be accident prone when testing my usually faulty modded BG installs. ;-)

 

Turambar gave an ok to showing his code here, here are some relevent bits.

 

The first is so that portrait replacements will catch generalized biffing, so players don't have to make a new install when installing new portraits. In the current release (v1) the code was just checking for the .bmp in the override folder:

BEGIN ~Alternate Suna Seni (Unfinished Business)~ DESIGNATED 217
GROUP ~Mod NPCs~
REQUIRE_PREDICATE FILE_EXISTS_IN_GAME ~SUNAS.bmp~ ~You do not appear to have UB installed~

 

More relevant to this discussion, how we got around the pink hair portrait change for Xan. LAF stands for LAUNCH_ACTION_FUNCTION. The code here does 2 things: it backs up the m and s portraits of all characters into the portrait folder (prefixing them) and then copies all new portraits to the override folder. So you only need to tell it the folder where the portraits are, and it'll do the rest.

 

I should add here the way this particular portrait mod works, is that we back up the vanilla versions of the original portraits by prefixing them and putting them back in the portrait folder, so they don't get lost when people install the alternates.

 

////XAN/////////////////////////////////
BEGIN ~All Xan portraits~ DESIGNATED 222
GROUP ~Mod NPCs~
SUBCOMPONENT ~Alternate Xan~
LAF replace_backup_all STR_VAR folder=~eportraits/xan~ END
ACTION_IF FILE_EXISTS_IN_GAME ~pinkback.spl~ BEGIN
COPY_EXISTING ~pinkback.spl~ ~override~ //spell from BG1NPC reverting Xan's hair to the original colour
 READ_LONG 0x6a off
 FOR (off += 0x14;off<SOURCE_SIZE;off+=0x30) BEGIN
  READ_ASCII off test
  PATCH_MATCH ~%test%~ WITH
~anbs~ BEGIN
	 WRITE_ASCIIT off ~xans~
END
~anbl~ BEGIN
	 WRITE_ASCIIT off ~xanm~
END
DEFAULT
  END
 END
IF ~anb[sl]~
BUT_ONLY_IF_IT_CHANGES
COPY ~eportraits/xan_pink~ ~override~
END
BEGIN ~Xan NPC only~ DESIGNATED 219
GROUP ~Mod NPCs~
SUBCOMPONENT ~Alternate Xan~
REQUIRE_FILE ~Xan/Setup-Xan.tp2~ ~You do not appear to have Xan installed~
LAF replace_backup_all STR_VAR folder=~eportraits/xan~ END
ACTION_FOR_EACH file IN ~xan4~ ~xan6~ BEGIN //Xan_s from BGT
ACTION_IF FILE_EXISTS_IN_GAME ~%file%.cre~ BEGIN
 COPY_EXISTING ~%file%.cre~ ~override~
  READ_ASCII 0x34 test
  PATCH_IF ~%test%~ STRING_EQUAL_CASE ~xans~ BEGIN
WRITE_ASCIIT 0x34 ~#nkxans~
  END
  READ_ASCII 0x3c test
  PATCH_IF ~%test%~ STRING_EQUAL_CASE ~xanm~ BEGIN
WRITE_ASCIIT 0x34 ~#nkxanm~
  END
 BUT_ONLY_IF_IT_CHANGES
 IF ~xan[sl]
END
END

Link to comment

Thanks! From Turambar, I still didn't do anything except copy and paste it here. :p

 

More to the point: if you want to use it for something, you can feel free to ask Turambar for support if you need anything. I don't know if he has an account here but you can certainly reach him over at SHS if you need to. :-)

Link to comment

Archived

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

×
×
  • Create New...