Darth Trylan Posted October 28, 2006 Share Posted October 28, 2006 the screenshots were not in the tutorial section: step 1 --> extract the .utc file for the future recruit: Select the npc you want to recruit. Extract the corresponding .utc file. 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/. 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 .utc 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 blabla.utc and it would work, as long as it is a unique name (not used by the game) that does ot exceed 16 chararacters. 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 every single 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 will crash when you reach certain points. 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).. a) AppearanceType: the number in this field corresponds to your npc's appearance row number in the appearance.2da file. For Dustil, it is row no. 432. Put the number corresponding to the appearance of the npc you want. b) then go down to the conversation field: type the name of the dlg file (without the extension) of the npc. Per example, for dustil I wrote p_ductilc, which is the name of the .dlg file that will be used by Dustil once he is recruited. c) FactionID field: set it to 2 which is the faction id for party members. The other possible factions are listed in nwscript.nss but they are useless for a recruitment mod. d) FirstName: This is the name that will appear on top of your npc's head when you play 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: Language ID English 0 French 1 German 2 Italian 3 Spanish 4 Polish 5 Korean 128 Chinese Traditional 129 Chinese Simplified 130 Japanese 131 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) PortraitID: this number in this field corresponds to the row of your npc's portrait in the portaits.2da file (this will be used to make the portrait appear in the party selection table) . 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... This step is very important: I have seen countless recruitment mods that omitted this step with the result that the npc wouldn't follow or would even turn on the PC in certain cases. 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 ScriptonBlocked -->k_hen_blocked01 ScriptonNotice --> k_hen_percept01 ScriptSpawn --> k_hen_spawn01 Delete the entries in the other script fields. Example i) go to the tag field: type the tag of the npc you want to replace: A common error is tu use a custom tag: do not do this - you have to use one of the tags below- or the game will crash at certain points if it doesn't find the original npc when this npc was supposed to talk or do something. You'll also end up with multiple "copies" of you custom npc inside the Ebon Hawk if you use a custom tag. T3M4: T3M4 Canderous: Cand Mission: Mission Jolee: Jolee Juhani: Juhani HK-47: HK47 Bastila: Bastila Carth: Carth Zaalbar: Zaalbar 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 the .utc file with the same name as what appears in your Template ResRef field 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: void main() { RemoveAvailableNPC(7); AddAvailableNPCByTemplate(7, "p_dustil"); DelayCommand(1.5,ShowPartySelectionGUI()); } In RemoveAvailableNPC, number 7 will replave t3m4, for other npcs, use one of the following slot numbers: BASTILA = 0 CANDEROUS= 1 CARTH = 2 HK_47 = 3 JOLEE= 4 JUHANI= 5 MISSION= 6 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: PC replies: 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) etc... 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?page=tutorial_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 : 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/showthread.php?s=&threadid=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 ) void main() { ActionPauseConversation(); object oGoodbye; oGoodbye = GetObjectByTag("my_npc_tag"); SetGlobalFadeOut(1.0, 0.5); DelayCommand(1.0, DestroyObject(oGoodbye)); DelayCommand(1.0,SetGlobalFadeIn(0.7,0.0)); ActionResumeConversation(); } 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. To get the tag, open the .utc file of the original npc in the game with a GFF editor or Kotor tool (for Dustil the .utc file is named kor35_dustil.utc) and check the tag field. The name of the .utc file does not always correspond to the tag field so always check. 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 ). Additional stuff: 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: void main() { //do a whereami cheat to get the coordinates of the location //where you want the npc to spawn float x=0.00f; float y=0.00f; float z=0.00f; //unless you want something specific, forget about orientation float r=0.0f; vector vecNPC=Vector(x,y,z); location locNPC=Location(vecNPC, r); //insert your npc tag instead of my_creature_resref. Don't remove the quotes and do not exceed 16 chars. object oNPC=CreateObject(OBJECT_TYPE_CREATURE,"my_creature_resref",locNPC); object oPC=GetFirstPC(); AssignCommand(oNPC,ActionMoveToObject(oPC)); //replace my_dlg by the name of the dlg file the npc is supposed to use AssignCommand(oNPC,ActionStartConversation(oPC,"my_dlg")); } If you don't know how to do a "whereami" cheat: Go on the spot where you want to spawn the npc with your PC, open the cheat console and type "whereami" without quotes. Press enter and the coordinates (XYZ) of the location will appear right under the cheat console. 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. Link to comment Share on other sites More sharing options...
Darth333 Posted October 28, 2006 Share Posted October 28, 2006 the screnshots were already in the tutorial. You just used the IMG tag instead of the url tag... so there's no real point in resposting this. I said I was going to update the tutorial later this week as it is a little outdated given the new available tools. I'd do it tomorrow if I could but Kotor is presently not installed on my machine. Since I am expecting to have a new PC on Monday there's no point in installing it beofre that date. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.