This is a tutorial on how to make your own recruitment mod:
Gff editor (I'll use Bioware's GFFeditor for this mod) edit (10-03-2004): now you can do most of this job with Kotor tool
Graphic application that supports the .tga extension ( to add a portrait to the party selection table: otherwise, you can recruit the npc but his portrait will be black)
HazardX script compiler
2. Make your custom dialogue: use Kotor tool integrated dialogue editor or tk102's wonderful DLGeditor
3. For more info concerning dialogues, read this post of mine
Check the Guide for the Newbie sticky
to get all and the tools and for instructions on how to use them.
2. Making the mod:
step 1 --> extract the .utc file for the future recruit:
Select the npc you want to recruit. Extract the corresponding .utc. Since it is easier to work with an example, I will use Dustil ( you can download the mod at http://www.pcgamemods.com/u/3451/
- pls use my website only if you are unable to access pcgamemods: it is a 2.7 MB download - because of the sound files - and I have limited bandwidth. If I exceed it, then the site is down for a couple of hours
). I included the source code in the download. I strongly suggest that you follow this tutorial with the mod in hand.
For Dustil, I extracted: kor35_dustil.utc
Then rename the file: for dustil, i used p_dustil.utc. The name doesn't matter as it won't appear in the game. You could name it hello_holowan.utc and it would work, as long as it is a unique name (not used by the game). However, I recommend you use a name that will permit to identify the file easily. The reason why the name has to be unique is that it you simply use g_sithtroop002.utc (for a sith trooper), you'll end up overwriting everysingle g_sithtroop002.utc file in the game. Not only you'll have a ton of new friends (you'll see later, we will change the faction and behavior of the npc to that of a party member) but the game may crash when you reach certain points.
For Dustil, I extracted: kor35_dustil.utc
step 2 --> edit the utc file for the future recruit:
Open the .utc file with GFFeditor.
Now, we will edit the following fields (note, the present tutorial also covers editing .utc files for custom made npcs. However, it 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):
a) AppearanceType: the number at the side , corresponds to yor npc's appearance row number in apprerance.2da. For Dustil, it is 432. Put the number corresponding to the appearance of the npc (in short, you will use this only if you recruit a custom made npc)
b) then go down to the conversation field: type the name of the dlg file (without the extension) . Per example, for dustil i wrote p_ductilc: which is the name of the .dlg file that will be used by ductil once recruited.
c) FactionID field: set it to 2 which is the faction id for party members.
d) FirstName: This is the name that will appear on top of your npc's head when you paly the game. If you want to change the npc's first name (useful for custom made npcs) , put -1 in the top box (this means you are not referring to an entry no. in the .tlk file) and , if you have the English version of the game, 1 in the lower box. For other laguages, type one of the following numbers in the lower box:
Chinese Traditional 129
Chinese Simplified 130
e) you may also alter the ForcePoints and GoodEvil fields ( for force points, take your npc's level into consideration and for GoodEvil:100 is 100% good and 0 is 100% evil )
f) Last name: works the same way as as first name but it is the last name of your npc...
g) portrait id, this number will correspond to the row of your npc's portrait in portaits.2da file (this will bu used to make the portrait appear in the party selection table) . You may leave it blank for now unless except if you are not using any ither recruitment mod. If you are not using any other recruitment mod, then type 41, the original portraits.2da stops at 40)
h) the scripts: this will define your npc's behavior. You want your npc to follow your pc and to react like a party member and not like an ennemy during battles, etc...
Replace k_hen_blahblah by k_def_blahblah as follows in the following fields:
ScriptAttacked --> k_hen_attacked01
ScriptDamaged --> k_hen_damage01
ScriptDialogue --> k_hen_dialogue01
ScriptEndRound --> k_hen_combend01
ScriptHeartbeat --> k_hen_heartbt01
ScriptonNotice --> k_hen_percept01
ScriptSpawn --> k_hen_spawn01
Delete the entries in the other script fields.
i) go to the tag field: type the tag of the npc you want to replace: (don't use a custom tag or the game will crash when it doesn't find the original npc when it was supposed to talk or do something )
j) go to the TemplateResRef field and type a custom Template ResRef for your new npc: could be new_npc (i recommend using a name that will allow you to regognize the npc easily - it will not be seen in game but if you type hlf_f8fsrdfs you'll have probelms remembering what to type later on...)
k) save and close the utc file.
step 3 --> the script:
This is the script that will tell your game to recruit your npc.
Open notepad and paste the following script:
In RemoveAvailableNPC, number 7 will replave t3m4, for other npcs, use one of the following slot numbers:
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 usedin 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 with HazardX's script compiler. For instructions and troubleshooting concerning the script compiler, read this thread: http://www.lucasforums.com/showthrea...ostid=1555923.
COMPILING YOUR SCRIPT IS MANDATORY. YOU CANNOT BYPASS THIS.
Once compiled, you should now have an new .ncs file - example the dustil mod gives you 'dus_recruit.ncs' (if you followed the instructions in the script compiler thread, the compiled script (.ncs file) should be placed in your override folder.
You could also give the player the option to recruit whoever he wants. See this post and the following: http://www.lucasforums.com/showthrea...79#post1579579
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).
Open the dlg file with GFFeditor or TK102's dlg edit and select and entry or a reply. In the script field of that entry, type the name of your script without the extension anme in the field entitled script. Per eaxmple, in the Dustil mod, the script is attached to Entry no. 104 in the kor39_utharwynn.dlg file. Note, contrary to DLGedit, you wont be able to see the text with Gff editor so you will need to knoe the exact Entry/Reply number to which you want to attach the script to. You can view (BUT NOT EDIT) a dlg file with Kotor Tool: select the dlg you wish to view in the RIMs and press ctrl + double click. You should see something like this: http://img47.photobucket.com/albums/...h333/dlgkt.jpg
With dlg edit the procedure is similar: example DLGedit
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 appearance.2da 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. (model is for model and tex is for texture...but do I need to explain this...)
Look at the row number of the apprearance. If you need , reopen the utc file and change the row number corresponding to your npc's appearance in the apperance field (number 432 for Dustil).
step 6 --> take a photo of your npc :
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, open it with a graphic application suc as photoshpop or paint shop pro (it has to support the .tga extension) and make a 64 or 256 pixels square, per example, and save at 32 bits. Check this thread for a state of the art explanation: http://www.lucasforums.com/showthre...hlight=sv%F6sh.
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). Check the portrait.2da file in one of my recruitable mods to see how it's done.
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 )
oGoodbye = GetObjectByTag("my_npc_tag");
oGoodbye = GetObjectByTag("my_npc_tag"); (leave the quotes there) and replace my_npc_tag by the tag of the original npc in the the game. OPen the .utc file of the original npc in the game with GFF or Kotor tool, for Dustil the .utc file is named kor35_dustil.utc, and check the tag field. For Dustil the tag is also kor35_dustil but the name of the file does not always correspond to the tag field so always check.
Save with an .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).
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, experiance points, etc. : these have all been covered at holowan labs and look at T7's stickcy Do you want to start modding? Then start here.
Therefore, 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 appearnace 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) . ër example, not_recruited_speaks
c) FactionID field: set it to 5 which is neutral (if you set it to 1, 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: use the following script:
I'll use the Spawn Deadeye Duncan on Manaan Mod as an example. I uploaded the mod at pcgamemods but forgot to include the source. Here you have a complete package that includes the source code: http://mars.walagata.com/w/darth333/duncan_source.zip
Spawn script: paste in notepad, make apporpriate changes, save as an .nss file and compile:
(originally made by tk102)
//do a whereami cheat to get the coordinates of the location
//where you want the npc to spawn
//unless you want something specific, forget about orientation
location locNPC=Location(vecNPC, r);
//insert your npc tag instead of dan26_duncan. Don't remove the quotes.
//replace man26_duncan by the name of the dlg file the npc is supposed to use
Attach the script to a mandatory conversation - there are other ways of doing it but this is the most simple way: the idea here is to get you started - branch in the game, located in the same module you want to spawn the npc. Per example, when you first arrive on Manaan, a conversation begins with a republic officer. I attached the script to Entry no. 4, which is not being repeated (thus no problems spawning a new deadeye Duncan everytime you speak to the officer and no need to add anything else to the script.
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.