PDA

View Full Version : Remove PC from Party


brwarner
09-06-2005, 09:54 PM
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.

Tupac Amaru
09-07-2005, 10:44 AM
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. :)

Slipstreme
09-07-2005, 11:12 AM
Why do you want to do that?

Commas
09-07-2005, 03:52 PM
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

brwarner
09-07-2005, 04:09 PM
Yea thats just what i needed Thanks.

Slipstreme
09-07-2005, 06:26 PM
Oh and don't forget Atton vs Twin Sun's

Commas
09-07-2005, 06:44 PM
^^^ i knew i had forgotten one! and that was even the first one my mind jumped too when i was typing that post

Slipstreme
09-07-2005, 07:07 PM
The only other one I know of is T3 vs the HK-50's

brwarner
10-19-2005, 05:52 PM
sorry to reply on an old thread but I recently used this script for kotor 1 and it did nothing. Is there something that must be changed, it compiles correctly.

The_Maker
10-20-2005, 12:23 AM
Some scripts only work in TSL, so the odds are the script just doesn't exist in K1 because if I remember correctly you are always your PC. Try it in TSL, if not then something didn't work correctly ;)

Darth333
10-20-2005, 01:16 AM
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

brwarner
10-20-2005, 04:10 PM
Darth333 I tried your script but the game freezes.

Also I only need this because you will only have 1 party member.

Tupac Amaru
10-20-2005, 08:10 PM
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);
}