View Full Version : Recruit Function

Ferc Kast
06-16-2012, 07:54 PM
Original Thread (http://www.lucasforums.com/showthread.php?t=210187)

Recruit Function

Latest Version: 1.0
Supports: KotOR I and KotOR II
Download: Kast's Echo (http://www.kasts-echo.info/ke_mods/ke_001) | Deadly Stream (http://deadlystream.com/forum/files/file/162-recruit-function/)

This Recruit Function allows you to recruit NPCs as new party members. It was designed to ease the amount of scripting to make a recruit mod. :cool:

Not-so-long in a galaxy not-too-far away, I once created a recruit script that eased the process of creating a recruit mod for TSL only. It always felt a little unjust that TSL modders should get that burden eased while KotOR I modders still had to suffer through the old (and semi-lengthy) way of coding a recruit script. I think this should both further ease the process of TSL recruitment mods & finally relieve the process for KotOR I recruitment mods somewhat.

This tutorial will not go over the process of making a (existing or new) NPC recruit mod; this tutorial only covers making the script which will recruit the NPC. For a tutorial about the rest of the process of making a recruit mod, see this (http://www.lucasforums.com/showthread.php?t=131944) tutorial by Darth333. :)

Installation and Use
You need to place the “ke_recruit.nss” script in your K1 or TSL override, depending upon the game for which you are making the recruit mod. To use the function, add the line
#include “ke_recruit”
at the beginning of your recruit script.

A) Recruit NPC
First, include this function in your script.
RecruitA(iNPC, sResRef);
iNPC = The integer value/variable of the replaced party member
sResRef = The string value of your post-recruitment UTC ResRef

These are the various NPC integer values/variables.
// KotOR I NPC integer values/variables.
int NPC_BASTILA = 0;
int NPC_CARTH = 2;
int NPC_HK_47 = 3;
int NPC_JOLEE = 4;
int NPC_JUHANI = 5;
int NPC_MISSION = 6;
int NPC_T3_M4 = 7;
int NPC_ZAALBAR = 8;

// KotOR II NPC integer values/variables.
int NPC_ATTON = 0;
int NPC_BAO_DUR = 1;
int NPC_G0T0 = 3;
int NPC_HK_47 = 5;
int NPC_KREIA = 6;
int NPC_MIRA = 7;
int NPC_T3_M4 = 8;
int NPC_VISAS = 9;
int NPC_HANHARR = 10;
int NPC_DISCIPLE = 11;

B) Eliminate Twins
If you also wish to eliminate the original pre-recruited party member from the module, simply include this function in your script.
sNPC = The string value of your pre-recruitment UTC Tag

Example Script
I thought I'd be nice and show an example of a working script; This is for a K1 recruit mod, but it works the same for TSL aside from NPC integer values.
#include "ke_recruit"
void main(){
string sResRef = "p_ice";
string sNPC = "Ice021";
RecruitA(iNPC, sResRef);

That’s all, folks! Please, leave your feedback below.