From NWN2Wiki
///////////////////////////////////////////////////////////////////////////////
// SetOwnersControlledCompanion
///////////////////////////////////////////////////////////////////////////////
// Created By: Brock Heinz - OEI
// Created On: 09/23/05
// Description: This will find the player controlling oCurrentCreature, and set
// their currently controlled companion to oTargetCreature. If it
// can’t find oTargetCreature, then the player is reassigned to
// whoever their original, owned character is.
//
// Returns: The object that is now being controlled. If oCurrentCreature
// was not being controlled by a player, then this will return
// OBJECT_INVALID
///////////////////////////////////////////////////////////////////////////////
object SetOwnersControlledCompanion( object oCurrentCreature, object oTargetCreature=OBJECT_INVALID );