Two questions from me today:
First of all, in the documentation for GetPartyMemberByIndex(int nIndex) it is stated that this should return the party leader for nIndex = 0 and the two party members for nIndex = 1 & 2:
// 577: Returns the party member at a given index in the party.
// The order of members in the party can vary based on
// who the current leader is (member 0 is always the current
// party leader).
// GetPartyMemberByIndex
object GetPartyMemberByIndex(int nIndex);
However, this seems to be wrong as I've been using it to get party members 1 and 2 and it only gives a useful result (the second party member) for nIndex = 1. To get the first party member, I need to use nIndex = 0. I was wondering if anyone knows if that's how it always works as I doubt that it's intended. I'm assuming that as this is the reason for the second party member spawning in the main hall in the hostile Korriban academy instead of in it's appropriate position.
The second question is somewhat weird. I've been testing that scene where you enter the hostile Korriban academy to find what's causing the incorrect spawn point and as stated above, I found the culprit. However, I thought the issue was somewhere else for a while which is why I had a closer look at the script spawning the party members upon entering the academy after retrieving the starmap. It's the OnEnter script for korr_m35aa, called kor35_enter. Here's the relevant part:
int nGlobal = GetGlobalNumber("KOR_FINAL_TEST");
if (((nGlobal > 3) && (!sub6()))) {
SetGlobalBoolean("KOR_ADD_PARTY", 1);
sub8(1);
int int18;
int int19;
string string1;
int18 = 0;
while ((int18 < GetGlobalNumber("KOR_REMOVE_PCS"))) {
int19 = GetGlobalNumber(("KOR_REMOVE_PC" + IntToString(int18)));
sub5(((("KOR_REMOVE_PC" + IntToString((int18 - 1))) + ":") + IntToString(int19)), (6 + int18), (6 + int18), 5.0);
switch (int19) {
case 0:
string1 = "Bastila";
break;
case 1:
string1 = "Cand";
break;
case 2:
string1 = "Carth";
break;
case 3:
string1 = "HK47";
break;
case 4:
string1 = "Jolee";
break;
case 5:
string1 = "Juhani";
break;
case 6:
string1 = "Mission";
break;
case 7:
string1 = "T3M4";
break;
case 8:
string1 = "Zaalbar";
break;
}
AddPartyMember(int19, GetObjectByTag(string1, 0));
(int18++);
}
You can ignore all the subX() functions as they are either for debugging or not related to spawn NPCs. As you can see, the game will check KOR_REMOVE_PCS which should be the number of party members that got removed when leaving for the final tomb. It's set in k_pkor_partyleav and it's actually incorrectly set to the number of removed party members + 1, but that's not the issue here. The game will then go through KOR_REMOVE_PC0 to KOR_REMOVE_PC2 depending on the number of NPCs that got removed (although, it goes one step to far due to the incorrect KOR_REMOVE_PCS). These three globals are also set in k_pkor_partyleav and contain the party member indices of the removed NPCs and KOR_REMOVE_PC2 is just 0 as there is no third NPC to remove from the party (which makes me wonder, if at some point you had three companions at once). The game will then save this index in int19 and assing the proper string in string1 to spawn the NPC with AddPartyMember.
Now, this is obviously working, but as soon as I change the values of KOR_REMOVE_PC0 or KOR_REMOVE_PC1 with KSE, that NPC just won't spawn for some reason. The only two party members that will spawn are Canderous and Juhani, the two party members that should spawn in my playthrough without tinkering. However, they also spawn if I switch their positions in the globals, which makes me wonder what the hell is going on here. All I can confirm is that both the index and the string are assigned correctly, so it seems that it's the AddPartyMember that fails. I just don't know why...
Then again, it's not actually a problem as it seems to work fine in vanilla and when not using KSE to alter these two globals and I have no intentions of altering that part of the script. I'd just like to know what's going on.
Thanks for any help