LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   Holowan Laboratories (http://www.lucasforums.com/forumdisplay.php?f=324)
-   -   [Tutorial] Recruit Function (http://www.lucasforums.com/showthread.php?t=210187)

Ferc Kast 05-28-2012 11:14 AM

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. :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.

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.


All times are GMT -4. The time now is 11:13 PM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.