Fair Strides

Editing the Party Configuration (K1 and K2)

Recommended Posts

This tutorial is to help someone out when they ever have to use this feature, especially since it took me a while to figure it out myself. I'm going to show you how to store and restore your current party any time you want in either game.

 

An example from KotOR 1 where this is done is when you are at the Hrakert Station on Manaan and you travel through the airlock and back. You lose your party when you go out, but the people are restored to your party instantly when you go back inside.

 

Similarly in KotOR 2, You can pick your party members at various points. The most notable is picking a team to go to Freedon Nadd's Tomb on Duxn. The game does the same thing here as it does on Manaan: programmatically adding people to your party.

 

(All examples assume it's just you in the party before running them)

The code for it is actually very simple. Say you wanted to add Bastila to the party :

object oBastila = SpawnAvailableNPC(NPC_BASTILA, GetLocation(GetFirstPC()));
AddPartyMember(NPC_BASTILA, oBastila);

That seems simple now, but it took me the longest time to figure out that the number at the beginning of AddPartyMember was the NPC's place in the party table. On the Leviathan, I was just working with Bastila and Carth, so 0 and 2 still worked for party member slots (despite the fact that the PC should be in the 0 spot) and I didn't realize the number's meaning.

 

Similarly if you wanted to add Juhani or Kreia, you'd use NPC_JUHANI or NPC_KREIA. But what if you didn't know who to summon?

 

Investigating the Manaan airlocks and the Duxn Tomb's levels, I found that the NPCs' numbers are stored in Global Numbers. These numbers are then retrieved and used in the code above. Here's the code for the Duxn Tomb's OnEnter script:

void sub3() {
	object object1 = SpawnAvailableNPC(GetGlobalNumber("403DXN_PARTY2_NPC2"), GetLocation(GetObjectByTag("sp_cnpc2", 0)));
	object object4 = SpawnAvailableNPC(GetGlobalNumber("403DXN_PARTY2_NPC3"), GetLocation(GetObjectByTag("sp_cnpc3", 0)));
	AddPartyMember(GetGlobalNumber("403DXN_PARTY2_NPC2"), object1);
	AddPartyMember(GetGlobalNumber("403DXN_PARTY2_NPC3"), object4);
}

In KotOR 1, there are two Global Numbers that you can use freely: "K_PARTY_STORE1" and "K_PARTY_STORE2". If you want to see if those have been used, the game (and you) should check and use the Global Boolean "K_PARTY_STORED".

 

In KotOR 2, Those globals aren't available, so you can either make your own or you'd have to re-purpose the Duxn ones. Re-using the Duxn ones should be safe, since using them before Duxn will have them reset and using them after Duxn shouldn't be a problem.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.