Jump to content

Home

Recruiting NPC


Miltiades

Recommended Posts

Attach the script to a mandatory conversation branch located in the same module you want to spawn the npc - there are multiple other ways of doing it but this is the most simple way: the idea here is to get you started - . Per example, in the Duncan mod, I attached the script to Entry no. 4 of the dialogue with the Republic officer who greets you when you first arrive on Manaan.

 

I've done everything in the tutorial on "How to recruit a NPC in 10 steps", but this part I don't understand. Can someone explain?

Link to comment
Share on other sites

The reason why I say that is that you have to fire your script from somewhere. You can attach the script anywhere you want. To a dialogue (but if the branch is not uinque and you don't use a variable, then you'll spawn an army of clones.) I only gave one simple solution as several people want to keep scripting to a minimum.

 

 

You can also spawn your npc as soon as you enter a module. Check the 3rd post in this tutorial: http://www.lucasforums.com/showthread.php?t=143536

 

If you don't know who to attach a script to a dialogue file, use tk102's dlgeditor and type the name of your script withouth the extension in the field called "script" beside the dialogue branch you chose.

Link to comment
Share on other sites

Yes, I mean a dialogue file.

 

Well as long as it works, there are no restrcitions. You need a place to fire your script. It can be a door, a trigger, a dialogue, a module OnEnter event, etc etc. What is most appropriate depends on what you you're doing.

 

However, in some cases you will have to use a variable to prevent the script from being executed over and over.

Link to comment
Share on other sites

But if I don't want my NPC to speak (Like, if I don't want to recruit him, but attack me), where do I attach it then?

 

And do you really need to use a dialog file of another NPC already in the game? Because then it replaces that NPC, doesn't it? (Duncan replacing the Republic Officer)

Link to comment
Share on other sites

Ok, so this is what I've done. First, I used the Where Am I armband to locate my position. (The bridge in front of the Enclave) Then I filled the numbers into the script file that's in the tutorial (float x= 156.47188f; etc.) and changed the tag, and then the dlg file (btw, I don't know which dlg I have to put in here, where the script is attached to, or the dlg file the NPC uses).

 

I have extracted the dlg file (gen_merc => on Dantooine) and used it with the DLGEditor. I put the name of the script in the Script 1 line (I'm not sure what to do here, if someone can show me exactly how), and then I saved it.

 

Then I compiled my script file (.nss) and I put the 4 files into my override.

 

There's one thing I'm not sure about. When I open my savegame, I'm exactly in the plaec where the NPC should stand. Do I have to go to another area, Or is he normally suppose to appear?

 

Hopefully someone can help me..

Link to comment
Share on other sites

Depending where in your dialogue the script fires (a spawning script?), you'll need to start your savegame either before the dialogue begins, or preferably, before you enter the module/area for the first time.

 

Also, make sure you're not putting the spawn script in a dialogue that happens (or is supposed to happen) between the PC and the spawned NPC. Otherwise your spawnee will never show up ;)

 

For the location you're mentioning, you could attach it to the dialogue of the salvagers that are "escaping" the enclave for the first time (since this dialogue happens only once). Problem there is your spawned NPC will be behind you (since you have to cross the bridge first in order for the salvagers to appear)...

Link to comment
Share on other sites

Thanks. Before the bridge is not his final position. It was only for testing.

 

Does the script need to be attached to a dialog file? Because it kind of has restrictions where you can place your NPC...

 

Btw, still don't know how I have to attach it to a dialog file. (Don't know where to place it in my dlg file)

Link to comment
Share on other sites

When you're in the DLG editor there should be information and datafields at the bottom of the screen, first click on the line of dialog where you want a script to fire, then look at the bottom of the screen, there should be a datafield for scripts (not sure of the actual name, I'll check for you) in the field you just type the name of your script and when that line of dialog occurs the script will fire.

 

EDIT: You want to put the title of your script in the Script # 1 field (in tk102's DLGeditor).

Hope that helps:)

Link to comment
Share on other sites

When you're in the DLG editor there should be information and datafields at the bottom of the screen, first click on the line of dialog where you want a script to fire, then look at the bottom of the screen, there should be a datafield for scripts (not sure of the actual name, I'll check for you) in the field you just type the name of your script and when that line of dialog occurs the script will fire.

 

EDIT: You want to put the title of your script in the Script # 1 field (in tk102's DLGeditor).

Hope that helps:)

 

Thanks. This confirms that I was right.

 

But it didn't work, because I did talk to the man where the script spawns. It's because I thought I only needed to attach it to a dlg file, and then it automatically spawns in the area.

I know it's the art of knowing to which dlg file you attach it. And that's what I have to search for first.

 

The Npcs I want to spawn are going to be placed on a "planet" 'Actually a space ship, if it's possible) not yet been made (So that I'm planning to do), so I'll make it so that the NPC spawns subtle. The only thing that'll be the problem is the first NPC in my new "planet", because if he/she is the first NPC on my "planet", then I don't have dlg files before that. (Or is it possible to attach a script to a dlg file on another planet?)

Link to comment
Share on other sites

The only thing that'll be the problem is the first NPC in my new "planet", because if he/she is the first NPC on my "planet", then I don't have dlg files before that. (Or is it possible to attach a script to a dlg file on another planet?)

Then I'd take Darth333's advice about spawning NPC's upon entering a module. That way you don't have to worry about the dialogue mess :)

 

You can also spawn your npc as soon as you enter a module. Check the 3rd post in this tutorial: http://www.lucasforums.com/showthread.php?t=143536
Link to comment
Share on other sites

Thanks, it worked! After my party was dead, he began attacking the salvagers. :p

 

Few questions though:

 

1) How do you know which models are in the game?

2) I've made my own robe for the NPC, and I equipped it with the Inventory Editor in Kotor Tool, but he's not wearing it. What's the problem?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...