How to recruit an npc in less than 10 steps
Check the Getting started with modding: Tools + downloads to get the tools and basic instructions on how to use them.
(out of scope of this tutorial) Make your custom dialogue: use tk102's very practical and flexible DLGeditor.
2. Making the mod:
step 1 --> extract the .utc file for the future recruit:
step 2 --> edit the utc file for the future recruit:
You have 2 options here - GFF editor (old school) and Kotor tool - I use Bioware's GFF editor for the present tutorial -
screenshot - the letters on the screenshot correspong to the steps a to h described hereinbelow.
Open the .utc file with GFFeditor and check the following fields:
(note, the present tutorial covers only the basics of making a recruitment mod. You can edit class, feats, inventory, etc. in the utc file but it is not covered here)..
step 3 --> the script:
This is the script that will tell your game to recruit your npc.
Open notepad and paste the following script:
BASTILA = 0
CARTH = 2
HK_47 = 3
T3_M4 = 7
ZAALBAR = 8
In AddAvailableNPCByTemplate(7, "p_dustil"), also replace number 7 by the slot number of the npc you want to replace and replace p_dustil by the TemplateResRef you used in the .utc file.
Save the script as "recruit_npc.nss" (or whatever name you wish as long as it has a .nss extension - for dustil , the script is: 'dus_recruit.nss' - ) and compile your script. For instructions and troubleshooting concerning the script compiler, read this thread: http://www.lucasforums.com/showthread.php?t=143681 COMPILING YOUR SCRIPT IS MANDATORY. YOU CANNOT BYPASS THIS - it takes only 2-3 seconds to do.
Once compiled, you should now have an new .ncs file - example the dustil mod gives you 'dus_recruit.ncs' .
You could also give the player the option to recruit whoever he wants by making various dialogue options. Rough example:
1. ok, come with me, i have a droid to replace (attach script to replace t3-m4) (and why not add the obligation for the pc to sell the droid to a merchant first - conditional script - to make place on the Ebon hawk )
2. ok, come with me, you'll take the place of my wookie slave (attach script here)
3. ok, come with me, you'll certainly be more useful than a 14 yrs old girl for this "mission"... (attach script to replace Mission)
step 4 --> attach the script to a conversation:
To recruit your npc, you need to attach the script somewhere in order to fire it. The best bet is to attach it to a conversation (dlg file).
This tutorial uses tk102's DLGeditor - link provided at the top of this post -
Open the dlg the dialogue editor and select and entry or a reply. In the field where it says Script that fires when spoken, type the name of your script without the extension and in the field entitled script. Per example, in the Dustil mod, the recruit script is attached to Entry no. 104 in the kor39_utharwynn.dlg file.
step 5 --> edit the apprearance of your npc:
If you want your npc to be able to wear armors and robes, you have to edit the appearance.2da file with Kotor Tool.
I suggest you follow the BIFs section in T7's tutorial concerning editing appearance.2da: http://www.map-review.com/index.php?...ial_view&id=28
In any event, look at what i did in the appearance.2da file for the Dustil mod: compare row 432 in the original file and the file included in my mod download. I edited the columns from modela to texj so that my custom recruit can wear armor.
step 6 --> take a photo of your npc :D :
You can now test your mod. Go to the game and test it, recruit your npc, select your new npc in the party selection table and take screenshot of your npc while in game and edit your screenshot with a graphic application such as photoshpop, paint shop pro or GIMP (it has to support the .tga extension) and make a 64 or 256 pixels square, per example, and save at 32 bits.
Save your image as po_blahblah.tga ( for dustil, i used po_dustil.tga)
Then, go to the portrait.2da file and add a new row:
If you don't know how to add a new row to a.2da file, look at this thread: http://www.lucasforums.com/showthrea...hreadid=130290
In the baseref column, type the name of your .tga file (po_blahblah) without the extension. Then, in the "appearance number", "appearance_f" and "appearance_s" colums, enter the row number of the appearance.2da file corresponding to the appearance of your npc. Race, normally it's 6 but check the "Race" field in your npc's .utc file just in case. screenshot of portraits.2da modifications in the dustil mod
Save and close (before saving, just click on another row you'll loose your new row).
Finally, open the .utc file with GFF editor and in the field entitled portraitID, and check the number of the row you just added to the portrait.2da file (per example 41).
Step 7 --> eliminate "twins" :
If you are recruiting an npc that is already used by the game, you may want to use an additional script or you may end up with twins. If you look at step 1 of this tutorial, you'll remember that we extracted the original .utc and renamed it. For the game these are two different objects, even if they have the same appearance. So when you recruit the npc, the original npc will still be there and you'll end up with 'twins". In order to avoid this, you can use the following script which will destroy the original npc on place: (note: don't look for this in the Dustil mod, it's not there. I made him run away ;) instead of destroying him on place )
Save your script with a .nss extension, compile and attach to dialog (do this at the very end of the conversation with the original npc or you'll ran into trouble if he disappears permanently before the end of the conversation :rolleyes: ).
What you can do with a recruit mod is infinite. You can add sound, conditions upon which the npc will be recruited, sidequests, journal entries, experience points, etc. : these have all been covered at holowan labs so explore the other tutorials if you want to add more stuff.
There is only one more thing I will add: If you want to recruit a custom npc and want to spawn him somewhere before recruiting it.
You need another custom .utc file. Extract a .utc file from a similar npc in the game (not the apperance but in characteristics - it's easier to simply change the appearance number than re-edit all the stats). This is a new npc for the game so give it a new name. For the purpose of this tutorial , we will call it not_recruited_yet.utc
a) Change the AppearanceType filed to the row number you wish in appearance.2da
b) then go down to the conversation field: type the name of the custom .dlg file (without the extension) . Per example, not_recruited_speaks
c) FactionID field: set it to 5 which is neutral (if you set it to 1 -ennemy - you'll only have a battle and no dialog so no possibility to recruit).
d) FirstName: This is the name that will appear on top of your npc's head when you paly the game. Refer to the 1st part of this tutorial
e) Last name: works the same way as as first name but it is the last name of your npc...
f) the scripts that define the npc's behavior should be already set if you did not first extracted an original party member .utc
g) go to the tag field: type a custom tag. example "not_yet_recruited"
j) go to the TemplateResRef field and type a custom Template ResRef : you can use the same name as the tag, "not_yet_recruited"
k) save and close the utc file
Spawning: you can use the script below or one of the other solutions proposed in this thread: http://www.lucasforums.com/showthread.php?t=143536
Spawn script: paste in notepad, make appropriate changes, save as a .nss file and compile:
Attach the script to a mandatory conversation branch located in the same module you want to spawn the npc . You can also use the module on enter event to spawn you custom npc (see: http://www.lucasforums.com/showthread.php?t=143536) - there are multiple other ways of doing it but this is the most simple way: the idea here is to get you started -
Feedback always appreciated. If you feel some points are not clear or if i forgot something, just say so and I'll complete the tutorial.
|All times are GMT -4. The time now is 07:47 PM.|
Powered by vBulletin®
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.