PDA

View Full Version : Recruiting Without Replacing Default Party


susvaine
09-05-2005, 11:11 PM
I've been doing some reading, and some modding, and I've kind of been getting the hang of modding for KOTOR2. I succeeded in modding a dewback "puppet" and making a new recruitable Trandoshan. However...

While I know that you must replace an existing party member to recruit a custom one, I also know that there are actually 12 existing party member slots, despite the fact that only ten show up in-game. The extra two are for Mira/Hanharr (depending on your alignment) and Disciple/Handmaiden (depending on your gender). Now, I was wondering if it was possible to assign a custom party member to either one of the extra spaces and somehow edit the party screen to display the new character so I could actually select it? Or perhaps some other method (perhaps via some sort of "wristband" that is so often used) that would switch the display of a certain NPC in your group to the custom one. If I didn't explain this really clearly enough, I'll give an example. I install the mod, which adds a wristband to my inventory. Whenever I equip it, on the part select screen, HK-47's portrait will be replaced by the new, custom NPC's portrait, and I can thus put him in the active party. When I unequip the wristband or equip it again, it switch the two portraits again.

If this is possible, then let the purpose of this thread be to request a generic mod that will somehow allow me to recruit an NPC without having to replace any of my party members.

Tupac Amaru
09-06-2005, 08:48 AM
From what I have read you can't change which characters are available on the party selection screen. If you have recruited the Disciple (or a custom npc occupying his slot) then the Handmaiden will be unavailable. However, you could use a wristband to call a script that directly adds/removes her from the party. A function like this would work:

// Check that the new party member is selectable and you don't already have
// two NPC's in the party before calling this.
void MakePartyMember(int nNPCConstant) {
object oNewPartyMember;
if(nNPCConstant >= 0 && nNPCConstant <= 11) {
oNewPartyMember = SpawnAvailableNPC(nNPCConstant, GetLocation(GetPartyLeader()));
if(GetIsObjectValid(oNewPartyMember)) {
AddPartyMember(nNPCConstant, oNewPartyMember);
}
}
}

To remove someone you can use the function RemoveNPCFromPartyToBase(int nNPC) or ClearPlayerParty() in k_inc_glob_party. That's how I do it at least if I take both Handmaiden and Disciple along.

stoffe
09-06-2005, 08:57 AM
While I know that you must replace an existing party member to recruit a custom one, I also know that there are actually 12 existing party member slots, despite the fact that only ten show up in-game. The extra two are for Mira/Hanharr (depending on your alignment) and Disciple/Handmaiden (depending on your gender). Now, I was wondering if it was possible to assign a custom party member to either one of the extra spaces and somehow edit the party screen to display the new character so I could actually select it?


There are 12 slots on the party selection screen as well, it's just that Hanharr's & Miras, and Handmaidens & Disciples occupy the same coordinates. While it's possible to move them, it won't do any good, since the game automatically hides the Handmaiden's portrait slot on the party screen whenever a creature occupies the Disciple's Party Table slot. Mira and Hanharr would presumably work in the same way.

Thus while you technically can have both in the party at the same time, you won't be able to add the Handmaiden to your group through conventional means (the party screen) if you have an NPC in the Disciple's slot as well.


Or perhaps some other method (perhaps via some sort of "wristband" that is so often used)

This is probably the easiest workaround, using an item that fires a script. You'd have to use it to add the Handmaiden to the group instead of the party screen if both slots are used. At its simplest form, I believe a script like this example...


void main() {
if (GetAreaUnescapable()) {
SendMessageToPC(GetPartyLeader(), "You are unable to change your party at this time.");
return;
}

if (GetPartyMemberCount() >= 3) {
SendMessageToPC(GetPartyLeader(), "Your active party is already full! Remove someone before you can add the Handmaiden.");
return;
}

if ((GetNPCSelectability(NPC_HANDMAIDEN) == 1) && IsNPCPartyMember(NPC_HANDMAIDEN)) {
SendMessageToPC(GetPartyLeader(), "The Handmaiden is already in your active party.");
return;
}

if (GetNPCSelectability(NPC_HANDMAIDEN) == -1) {
SendMessageToPC(GetPartyLeader(), "The Handmaiden had not yet joined your group.");
return;
}

if (GetNPCSelectability(NPC_HANDMAIDEN) == 0) {
SendMessageToPC(GetPartyLeader(), "The Handmaiden is unable to join your party at this time.");
return;
}

object oMaiden = SpawnAvailableNPC(NPC_HANDMAIDEN, GetLocation(GetPartyLeader()));
AddPartyMember(NPC_HANDMAIDEN, oMaiden);
}


...would do the trick. This would add the Handmaiden to the active (3 person) party, provided that you may switch party members in the current area, she is available, and your active party isn't already full.

Tupac Amaru
09-06-2005, 10:13 AM
I have noticed GetNPCSelectability doesn't work as described in nwscript.nss. The function returns -1 if a PC hasn't joined your party yet.
It returns 1 if the NPC has been recruited and is available on the party selection screen. However, that character doesn't have to be in your party at this time.
It returns 0 if a PC has been recruited, but cannot join your party at the moment. For example, this happens with the Handmaiden after the Jedi council meeting.

You'd have to see that GetNPCSelectability(NPC_HANDMAIDEN) == 1 instead of 0 and an additional check to see if she is in the party already. (Since I am lazy I just used ClearPlayerParty() before.)

stoffe
09-06-2005, 10:23 AM
I have noticed GetNPCSelectability doesn't work as described in nwscript.nss.

Oops, fixed. I should probably stop posting scripts that I don't have the opportunity to test in the game first. Thanks for pointing that out. :)