You need KotOR tool to make the NPC's template. Then you need to know the coordinates you want the new npc to spawn, then you'll need to create a script in KotOR tool, clicking on the big Txt button, like this one
CreateObject(OBJECT_TYPE_CREATURE, "creature_template", Location(Vector(0.00, 0.00, 0.00), 0.0));
Then save it as a file like "spawn_new_character.nss" (without the quotes, but you can name it whatever you like), set it as a script for K1 or K2 on the script function of the txt box. Then attatch the code to a dialogue file, or the more prefered method by allowing it to be an OnEnter script.