Jump to content

Home

How to get a NPC to hand over an item to my PC?


The Source

Recommended Posts

How to get a NPC to hand over an item to my PC?

Does anyone have a solution?

 

Sucesses so far:

1. I have a character spawn created.

2. I have dialog created.

3. I assigned "a_give_item" to a dialog line.

4. I equiped my NPC with the item I want to be given to the PC.

 

What am I missing?

 

When I speak to the NPC, followed the correct dialogs, and ended the conversation, but no item was given to the PC.

 

Solutions?

Link to comment
Share on other sites

Originally posted by MacLeodCorp

How to get a NPC to hand over an item to my PC?

Does anyone have a solution?

 

Sucesses so far:

1. I have a character spawn created.

2. I have dialog created.

3. I assigned "a_give_item" to a dialog line.

4. I equiped my NPC with the item I want to be given to the PC.

 

a_give_item creates a new item in the player's inventory from the specified item blueprint. If you want the NPC to hand over an item that already exists in their inventory a script like this one would probably work:

 

void main() {
   string sTag = GetScriptStringParameter();
   ActionGiveItem(GetItemPossessedBy(OBJECT_SELF, sTag), GetFirstPC());
}

 

Set the "String Param" for the script slot you put the script in to the TAG of the item in question. I'd put it at a node by the end of the conversation to be safe too, to make sure the action actually executes before it's interrupted by something else.

Link to comment
Share on other sites

You've set the script parameters for the a_give_item right?

 

(in DLGEditor for example you have 6 collums for the scripts, P1, P2, P3, P4, P5, String Parm)

 

If you haven't you need to set P1 to the amount of items the PC should recive, and String Parm to the tag of the item (name of utc file)

 

ex. Script #1 |a_give_item|1|0|0|0|0|robe12746

 

*edit* under the assumption it doesn't matter if its from the NPC or not like stoffe's script

Link to comment
Share on other sites

FYI-------------------------------------------

 

For new modders: If you are creating a dialog, which requires an exchange of an item from NPC to PC be warned.

 

After you alter the dialog in KOTORTool, and then you edit the file in GFFEditor, do not bring the .dlg file back into KOTOR Tool, or your Paramater scripts will be erased. Therefore, create your dialog in KOTOR Tool, and do touch ups in GFFEditor.

Link to comment
Share on other sites

Originally posted by MacLeodCorp

Therefore, create your dialog in KOTOR Tool, and do touch ups in GFFEditor.

 

Ehh..

 

Create and edit dialogues in TK's excellent DLGEditor and save yourself the trouble. ;)

 

If you are making dialogues for TSL, don't use KT's conversation editor at all.

Link to comment
Share on other sites

Originally posted by Xcom

Ehh..

 

Create and edit dialogues in TK's excellent DLGEditor and save yourself the trouble. ;)

 

If you are making dialogues for TSL, don't use KT's conversation editor at all.

 

Yeah, KT ruins the dialogues. So don't open the dialogue in KT and "Save" it to your disk, just extract the dialogue file.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...