Jump to content

Home

Remove PC from Party


brwarner

Recommended Posts

I have yet another question,

In my sidequest I wan't to make I want the PC(player) to be removed from your party so you only have your party members. Similar to when your on Gotos ship you play with 3 party members because the PC has been kidnapped. If anyone knows how to make a script like that please tell me.

Link to comment
Share on other sites

You can change the player character this way:

 

void SwitchToNPC(int nNPC);

void main() {
 DelayCommand(1.0, SwitchToNPC(NPC_constant));  // Delay it or it crashes.
}

void SwitchToNPC(int nNPC) {
 SwitchPlayerCharacter(nNPC);
}

 

The npc_constants are listed in nwscript. If you want the Exile back use NPC_PLAYER.

 

The command SwitchPlayerCharacter will also remove your current party members. You cannot use the party selection screen to add them, so you'll have to modify the script. This script will remove the Exile from the party and allows you to keep the current party members:

 

#include "k_inc_glob_party"
void SwitchToNPC(int nNewLeader, int nPartyMember);

void main() {
 SetPartyLeader(NPC_PLAYER);
 int nPartyMember1 = GetNPCConstant(GetTag(GetPartyMemberByIndex(1)));
 int nPartyMember2 = GetNPCConstant(GetTag(GetPartyMemberByIndex(2)));
 ClearPlayerParty();
 DelayCommand(1.0, SwitchToNPC(nPartyMember1, nPartyMember2));
}

void SwitchToNPC(int nNewLeader, int nPartyMember) {
 if(nNewLeader >= -1 && nNewLeader <= 11) {
   SwitchPlayerCharacter(nNewLeader);
 }
 if(nPartyMember >= 0 && nPartyMember <= 11) {
   object oNewPartyMember = SpawnAvailableNPC(nPartyMember, GetLocation(GetPartyLeader()));
   AddPartyMember(nPartyMember, oNewPartyMember);
 }
}

 

I hope that what you wanted. :)

Link to comment
Share on other sites

brilliant! thanks for the info Tupac Amaru! i was also wondering how to do this

 

Bookmark'd!

 

@slipstreme: perhaps to make a custom sidequest similar to

1)Mira fighting Hanharr (Nar Shaddaa and Malachor) 2)Goto's Yacht 3)Dxun Tomb 4)Remote on Malachor.

I know i am using it myself in a recruit mod.

 

edit: i decided that could use some spoiler tags

Link to comment
Share on other sites

  • 1 month later...

The above script can't work with kotor 1 but this should work:

void main()
{        
SwitchPlayerCharacter(NPC_CANDEROUS); 
}

You can replace NPC_CANDEROUS by one of the following:

NPC_BASTILA

NPC_CANDEROUS

int NPC_CARTH

NPC_HK_47

NPC_JOLEE

NPC_JUHANI

NPC_MISSION

NPC_T3_M4

NPC_ZAALBAR

 

However, as explained by Tupac Amaru, this will also remove your other party members. If you want to add them, you'll need something more than this. I can't post it tonight as I have to check a few things and it's already 1:15 am so it'll have to wait unless someone else fills the blanks in the meantime :D

Link to comment
Share on other sites

The game will crash if you try to switch to an NPC that is currently in your party. If that wasn't the reason, it may be neccessary to delay the command or do a ClearAllActions() on the current PC. This should safely switch to, for example, Canderous in K1:

 

#include "k_inc_utility"
void SwitchToNPC(int nNPC);

void main() {
 if(IsObjectPartyMember(GetObjectByTag("Cand"))) {
RemovePartyMember(NPC_CANDEROUS);
 }
 DelayCommand(1.0, SwitchToNPC(NPC_CANDEROUS));
}

void SwitchToNPC(int nNewPC) {
 SwitchPlayerCharacter(nNewPC);
}

If I understood you correctly you only have one party member want to switch to that one:

#include "k_inc_utility"
void SwitchToNPC(int nNPC);

void main() {
 SetPartyLeader(NPC_PLAYER);
 int nPartyMemberOneCode = UT_GetNPCCode(GetPartyMemberByIndex(1));
 UT_ClearAllPartyMembers();
 DelayCommand(1.0, SwitchToNPC(nPartyMemberOneCode));
}

void SwitchToNPC(int nNewPC) {
 SwitchPlayerCharacter(nNewPC);
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...