So, I'm trying to make a script that removes all party members (both from the current party and from being select-able in the party selection screen), adds a custom version of Darth Nihilus to the party, and makes him the PC (rather than the exile); it's this last bit that's been giving me trouble now. Here's the script (minus some commented-out sections):
If I take out the "SwitchPlayerCharacter(5);" line, the rest seems to work fine- I get the custom Nihilus in my party, and everyone else is gone (and I sometimes get random items or credits, not sure why that is). However, the game freezes when I try to make him the PC; is there a reason scripting-wise why this isn't working?
Thanks
Code:
//nihilus_switch
#include "k_inc_debug"
void main(){
int i;
object oPC = GetFirstPC();
for (i = 0; i < 12; i++){
RemoveNPCFromPartyToBase(i);
RemoveAvailableNPC(i);
}
AddAvailableNPCByTemplate(5, "p_darthnihilus");
object oNih = SpawnAvailableNPC(5, GetLocation(GetFirstPC()));
AddPartyMember(5, oNih);
SwitchPlayerCharacter(5);
}
Thanks