Thread: [Tutorial] Recruit Function
View Single Post
Old 05-28-2012, 11:14 AM   #1
Ferc Kast
Modder
 
Ferc Kast's Avatar
 
Join Date: Jan 2007
Location: Tython
Posts: 1,586
Current Game: SWTOR
Helpful! Forum Veteran Contest winner - Fan Fiction Veteran Modder 
Recruit Function

Recruit Function

Latest Version: 1.0
Supports: KotOR I and KotOR II
Download: Kast's Echo | Deadly Stream

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.

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.

Note
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 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
Code:
#include “ke_recruit”
at the beginning of your recruit script.

A) Recruit NPC
First, include this function in your script.
Code:
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.
Code:
// KotOR I NPC integer values/variables.
int NPC_BASTILA         = 0;
int NPC_CANDEROUS       = 1;
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_CANDEROUS       = 2;
int NPC_G0T0            = 3;
int NPC_HANDMAIDEN      = 4;
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.
Code:
RecruitB(sNPC);
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.
Code:
#include "ke_recruit"
void main(){
	int iNPC = NPC_MISSION;
	string sResRef = "p_ice";
	string sNPC = "Ice021";
	RecruitA(iNPC, sResRef);
	RecruitB(sNPC);
	}
That’s all, folks! Please, leave your feedback below.


Last edited by Ferc Kast; 11-13-2012 at 08:58 PM. Reason: Fixed typo in Kast's Echo link...
Ferc Kast is offline   you may: quote & reply,