Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

How do I make a custom npc ?

Page: 1 of 1
 Darth Xander
09-12-2007, 3:05 PM
#1
I don't want to add a custom head but I would to have the one in this image(bottom). I want him equipped with a custom item. If anyone can help (not do it for me) I'd greatly appreciate it. Also I want this guy to be fightable.
I would also wish to include dialog editing to include this guys words and I would like to include a few recordings which his voice(mine)and last but not least choose what goes in his remains. Thanks


http://i184.photobucket.com/albums/x284/cheshirebadges/HolowanLabsAvatar.jpg)
 stoffe
09-12-2007, 4:16 PM
#2
I don't want to add a custom head but I would to have the one in this image(bottom). I want him equipped with a custom item. If anyone can help (not do it for me) I'd greatly appreciate it. Also I want this guy to be fightable.

Create an UTC file for your character. You can use one of the standard ones as a base to make your own to make it a bit quicker. For example, open n_jedimemm.utc with KotorTool, found in Kotor II --> BIFs --> templates.bif --> Blueprint, Character. In the Creature Editor first press the Save button to make a copy of the template, save it in your override folder, name it something unique (max 16 characters, only a-z, 0-9 or _ allowed in the name).

Then on the Basic tab, change the value in the Appearance field to P_MAL_C_MED_02, and set the Tag field to the same as you named your file you just saved (without the .utc extension).

Then fill out the Name field with what you want your character to be called in-game, leave the race as Human, gender as Male and don't set anything in the portrait field. If you want the player to be able to speak with your NPC, set the name of a DLG file (without the .dlg extension) in the Conversation box.

Use the Statistics, Skills, Feats, Class and Force Powers tabs to give your character the stats and abilities you want it to have, most of it is pretty self-explanatory.

On the Advanced tab, set Template Resref field to the same as the filename (without .utc). Leave the boxes in the Special group alone unless you know what you're doing*, set Faction to 1 if you want the NPC to attack the player on sight, or 5 if you want them to be non-hostile when meeting the player. Pick a soundset you want the NPC to use for AI barks and grunts during combat.

The Special Abilities tab does not work, so don't bother with that. If you use the template mentioned above as base the proper AI scripts should already be set in the Scripts tab so you won't need to modify anything there.

Press the Inventory button to modify what the NPC carries. To give it standard game items drag them from the list to the left into the desired inventory slot. To add custom items (made by you) doubleclick on an equipment slot and type in the name of the file (without the .uti extension) that contains the item the NPC should have equipped.

For creating a dialog for your NPC, please see the excellent Dialog Editing tutorial made by Pavlos which can be found in the General Tutorials forum (http://www.lucasforums.com/showthread.php?t=180845).






* - If you want to know what you are doing: :p
Disarmable isn't used for anything in KOTOR AFAIK
No permanent death - I think this is unused as well
Plot - Makes the NPC totally invulnerable, nothing can hurt him
Is PC - Unused AFAIK.
Doesn't reorient - Don't make the NPC turn to face the PC when interacting with it
Doesn't block PC - Turns off the collision box of the NPC, you can walk right through them like they aren't there.
Is Hologram - Makes the NPC semi-transparent, glowing and sparkly to make them look like a holographic image (Goto etc).
MultiplierSet - Used by the game's autobalancer feature to automatically make the NPC tougher depending on the character level of the player character. Set to 0 to disable autobalancing for your NPC. The numbers here refer to line numbers in autobalance.2da which contains a series of multipliers used when boosting the NPC. Generally the higher the number the tougher the NPC will be. Valid range is 0-5.

If this is turned on you need to make sure the level of the character is pretty low since the autobalanced levels will be added on top of what's already set in the template, you also need to set the Force and Hitpoint values low in the template since those numbers will be used as multipliers in calculating the autobalanced values, otherwise the NPC might end up with thousands of HP/FP.
Subrace - Sets a race for the character. This is used for things such as determining what can be equipped, or what combat AI routines will be used. Leave at None unless you have a good reason to change it. :)
 Darth Xander
09-13-2007, 1:43 AM
#3
Thanks Stoffe how do I choose where he is (his location) and how do I make him attackable once my dialog ends?
 stoffe
09-13-2007, 6:35 AM
#4
Thanks Stoffe how do I choose where he is (his location) and how do I make him attackable once my dialog ends?

Either by using a script to spawn in the NPC into the game world, or placing him in the game world by editing the area where you want it to appear.

Scripting method:
Use the WhereAmI armband while standing in the spot you want the NPC to appear, and write down the coordinates it reports.


Find a way to run your script. The most common methods here is to either insert it as an action script in one of the existing dialogs of the area, making the NPC get spawned when that conversation is triggered. Or modifying the existing OnEnter event script for the area, or OnModuleLoad event script for the module, to fire the script spawning the NPC.


Write the script that spawns the NPC. Like:

void main() {
vector vCoords;
float fAngle = 0.0;
vCoords.x = 0.0;
vCoords.y = 0.0;

CreateObject(OBJECT_TYPE_CREATURE, "UTCname", Location(vCoords, fAngle));
}

Change the number in green to the X coordinate gotten from the whereami armband, the number in blue to the Y coordinate, the number in red to the angle the NPC should be facing (0-360°), and UTCname to the name of the UTC file containing your NPC (without the .utc extension).


Compile the script and put the NCS file in the override folder.





Area editing method:
Extract the .GIT file from the module RIM file containing the area you want the NPC to appear in.


Open the .GIT file with k-gff and locate the Creature List field.


Copy & paste one of the existing structs below the Creature List field. On your new copy, change the values of the sub-fields like:
TemplateResRef - set to the name of your .UTC file containing your creature template, without the .utc extension.
XOrientation - set to the X coordinate of the orientation vector the whereami armband should have provided, determines which way the NPC will be facing.
XOrientation - likewise, set to the Y coordinate of the orientation vector the whereami armband should have provided, determines which way the NPC will be facing.
XPosition - set to the X coordinate of where in the world the NPC should appear, as provided by the whereami armband.
XPosition - set to the Y coordinate of where in the world the NPC should appear, as provided by the whereami armband.

Click on another field and save changes to the .GIT file.


Open the RIM file you extracted the .GIT file from, and put your modified .GIF file back into it. (Make a backup copy of the RIM file first!)
 Darth Xander
09-13-2007, 11:14 AM
#5
thanks again how I make him attack me once the dialog has ended?
and how do I get the whereami armband? and can you explain it so a thirteen year old can understand it please?
 stoffe
09-13-2007, 12:23 PM
#6
thanks again how I make him attack me once the dialog has ended?

Put a_atkonend as action script on the very last node in the dialog.


and how do I get the whereami armband?

http://www.lucasforums.com/showthread.php?t=144260)
 Darth Xander
09-13-2007, 12:32 PM
#7
thank you now how do I add my voice recordings to teh dialog?
 stoffe
09-13-2007, 12:36 PM
#8
thank you now how do I add my voice recordings to teh dialog?

You put the name (without extension) of the sound file containing the speech in the VO_ResRef field on each dialog node in the DLG file, and put the sound files in the StreamVoice folder.
 Darth Xander
09-13-2007, 1:10 PM
#9
Put a_atkonend as action script on the very last node in the dialog.
how? and where?
 stoffe
09-13-2007, 1:26 PM
#10
how? and where?

See this: http://www.lucasforums.com/showthread.php?t=180845)

You should check the read-only forums at the top of holowan, they contain various tutorials that describe how to do certain modding tasks. Those should help you to figure out how some things can be done. :)
 Darth Xander
09-13-2007, 2:49 PM
#11
thanks stoffe what i meant before is how do I input an action script I've checked the tutorial and it doesn't say how to input one!
p.s nice new avatar its cool you should have used your old one as a portrait for a custom pc appearance that would be cool!

EDIT: I've added the action script but I'm having trouble spawning him heres my way I add him to appearance.2da making it possible to spawn him using KOTOR Tool module editor but... how?
Page: 1 of 1