The bug commonly referred to as the "Juhani Quest Glitch" has officially been fixed.
With the help of LiliArch, Kexikus, and several other people, I've managed to fix this long-standing bug in the game, and here's the bug, how the bug is caused, how to fix it, and how we found it:
The Bug:
Whenever you follow Juhani's personal dialog far enough along, you will be approached by a Twilek named Xor. He will take an interest in Juhani, but is forced to leave disappointed and angry. Later, he ambushes you outside your ship if Juhani is present, and will be dead when all is said and done.
From that first moment when you get approached by Xor, you will no longer be able to be approached by any more messengers, effectively stopping the advance of others' personal quests and blocking you off from a shop later in the game.
Because of the loss of this store, most players have learned to hold of on delving too deep into Juhani's past until later on, after the store is open.
The Cause:
The bug is caused simply because the game checks that the value of the global number K_XOR_AMBUSH is either 0 or greater than 2 when determining whether to have any messengers approach you.
K_XOR_AMBUSH is set to 1 after Xor talks to you and takes an interest in Juhani. It is set to 2 after he attacks you later on.
But it is never set to 3 after the attack is done!
The Fix:
You guessed it: you need to set the global number K_XOR_AMBUSH to 3 after Xor dies. This will allow other messengers to approach you and allow you access to a store later on.
The Discovery:
While looking into this bug, I went searching through the game's files for how the messengers were spawned and determined. I found out that each planet had one or two scripts for this, but not all could be decompiled. By examining the ones that could be decompiled, I was able to track the code that handles everything to k_inc_utility.nss in KotOR 1's scripts.bif.
The relevant code from that file:
Of importance is the following sample:
int nXor = GetGlobalNumber("K_XOR_AMBUSH"); //Do not fire any messenger plots on Kashyyyk if Chuundar is dead if(GetGlobalNumber("K_CURRENT_PLANET") == 20) { bConditional = GetGlobalBoolean("kas_ChuundarDead"); } if(bConditional == FALSE) { if(nXor == 0 || nXor > 2) {
This led me to investigate the K_XOR_AMBUSH global number and how and where it was changed. I discovered that it was set to 2 just before he attacked you, but that it was never set to 3 when he is dying.
From there, I gathered saves from Kexikus and others and tested setting the K_XOR_AMBUSH to 3 after Xor dies. And everything works!
This script is used by the game to launch Xor's death scene, but I've edited it to set the K_XOR_AMBUSH to 3 at that time as well. Simply drop it into your override folder and you're good to go!
k_hxor_state03.7z