PDA

View Full Version : Party Member as PC script


Silveredge9
01-14-2008, 04:35 PM
I've been trying to figure out a script that would temporarily replace the PC with one of the party members currently assigned to a specific slot.

Recently, to get this effect I've been using a script that changes appearance only.

object oPC = GetFirstPC();
effect eShape = EffectDisguise(123);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eShape, oPC);
The drawbacks with this is, that it only changes appearance, whilst Portraits, stats and equiped items are left as the ones associated with the PC.

This is for K1. I know it can be done. The sequences where you take control of one of your party members on the Leviathan are an example of the effect I want to achieve. :)

Any help on this would be greatly appreciated. :)

stoffe
01-14-2008, 08:56 PM
I've been trying to figure out a script that would temporarily replace the PC with one of the party members currently assigned to a specific slot.


This can be done using the SwitchPlayerCharacter() function. It removes the player character and temporarily assigns another party member as main character.

You specify the party slot constant of which slot to use for main character as parameter, so if you want the player to control T3M4 (or the character occupying T3M4's party table slot) you use it like:


void main() {
SwitchPlayerCharacter(NPC_T3_M4);
}


To switch the main character back to the player character you would do like:



void main() {
SwitchPlayerCharacter(NPC_PLAYER);
}

Silveredge9
01-14-2008, 09:05 PM
Hmm, I expected it to be much more complicated then that.

I must have missed that one in nwscript.nss. I guess I must have been searching using the wrong keywords or something. :P

Thanks.

DarthJebus05
01-14-2008, 09:10 PM
You could open the utc file in KOTOR Tool and tick the box 'Is PC' and that should work. I haven't tested that out yet. If it does work, it will save a lot of scripts.