DarthRevan101

Merchant and Quest mod.

Recommended Posts

Hello! I'm new here and this is my first mod that I'm working on. I intend to add a new merchant and add a small quest for him on Tatooine. 

 

This thread's mainly so I can order my thoughts and ask for help.

 

Things I need to do:

- Create an NPC and give them a store: Done

- Start a quest from the merchant NPC: Done

- Create an item to get from the NPC to the merchant: Done

- Spawn an NPC(s) to get an item from for the quest: Done

- Add another journal entry when the PC receives the item: Done

- Give the item back to the merchant to finish the quest

- Give the PC a reward (Credits or a custom item)

 

I'm learning how to add the quest by editing the global.jrl but I have some questions:

 

My main question is how to make certain dialog options only appear when the quest is active.

 

How to put a custom item in someone's remains.

 

How to have a conversation with more than one NPC.

Share this post


Link to post
Share on other sites

Tools you will need:

  • DLG Editor by tk102
  • KotOR Tool by Fred Tetra
  • K-GFF by tk102

Concepts I'll be covering:

  • Global Variables
  • DLG Editing
  • Action Scripts (Scripts that do something and then stop)
  • Conditional Scripts (Scripts that check something, or several things, and then return 0 or 1)

 

I will mostly leave the DLG Editor to you to learn, but some things I will mention:

  1. NPC lines are Red, Player responses are Blue. Entries are NPC, Replies are PC.
  2. Paste Node as Copy adds a reference to the entry or reply, instead of a new instance (moves the dialog to that entry's or reply's section, and helps reduce file-size by avoiding needless duplicates).
  3. When you select an Entry, the Speaker part is the tag of the creature (or placeable or door) and is what the camera will focus on. If blank, the game will use the object the PC is talking to (so leave it blank by default).

Some concepts for you about DLG nodes (a node is anything in the DLG file, regardless of whether it is an Entry or a Reply):

The Script part is the Action Script that will be ran when that node is used in-game (if it's an Entry, it's when that line shows up; if it's a Reply, it's when that line is activated or used). When you put a script in, don't add the ".ncs" part.

The Conditional part is the Conditional Script that will return 0 (FALSE) or 1 (TRUE), which will determine whether that node shows up or is available in-game. When you put a script in, don't add the ".ncs" part.

The VO Resref part is the file in the StreamVoice folder, and is also the name of the .lip file used for lip-sync (animates the mouth as the character talks).

The Sound part is the file in the StreamSounds folder, and is used for alien VO. You need to check the Sound present box, though.

 

A quick way to have "First-time you meet them" dialog is to make two main Entries (two entries right off the black filename line at the top of the dlg) and have the top one be your first-time dialog's starting point. You'd enter "k_con_talkedto" as the Conditional and "k_act_talktrue" as the Script.

 

Now, here is a sample script that you can use as a template for your Conditional Scripts for the dlg files to make certain dialog only appear at certain points in the quest:

 

int StartingConditional()
{
    // And DO NOT leave the < > marks.
    // == means equal
    // <= means number on the left is less than or equal to
    // <  means number on the left is less than
    // >= means number on the left is greater than or equal to
    // >  means number on the left is greater than
    if(GetJournalEntry("<tag of the quest in the global.jrl file>") == ##)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

Besides this, I'd say to use KotOR Tool's Text Editor for scripting, and be sure to select KotOR 1 in the Script menu to see all the functions you can use (the empty text line above the list can be used to search for functions).

Share this post


Link to post
Share on other sites

About the conversation with more than one NPC: You'll need the Speaker and Listener part in your dialog lines.

As FS described, Speaker determines who is speaking. Keep it blank for any PC responses (as it's always your PC in this case) and you can also keep it blank when the NPC you started the conversation with is talking. Otherwise add the tag of the character you want to be speaking. Just make sure that all NPCs are close to your PC or you might run into some trouble.

Listener determines who the Speaker is talking to, that is which character the Speaker is facing. When blank it'll default to the PC in Entry lines and the NPC you started the conversation with in Response lines. If you want to change that, once again, add the tag of the NPC.

 

And about your custom loot: Do you want to add an entirely new item or just have the character drop a certain item already existing in the game?

Share this post


Link to post
Share on other sites

 


 

 

Tools you will need:

  • DLG Editor by tk102
  • KotOR Tool by Fred Tetra
  • K-GFF by tk102

Concepts I'll be covering:

  • Global Variables
  • DLG Editing
  • Action Scripts (Scripts that do something and then stop)
  • Conditional Scripts (Scripts that check something, or several things, and then return 0 or 1)

 

 

I will mostly leave the DLG Editor to you to learn, but some things I will mention:

  • NPC lines are Red, Player responses are Blue. Entries are NPC, Replies are PC.
  • Paste Node as Copy adds a reference to the entry or reply, instead of a new instance (moves the dialog to that entry's or reply's section, and helps reduce file-size by avoiding needless duplicates).
  • When you select an Entry, the Speaker part is the tag of the creature (or placeable or door) and is what the camera will focus on. If blank, the game will use the object the PC is talking to (so leave it blank by default).

Some concepts for you about DLG nodes (a node is anything in the DLG file, regardless of whether it is an Entry or a Reply):

 

 

The Script part is the Action Script that will be ran when that node is used in-game (if it's an Entry, it's when that line shows up; if it's a Reply, it's when that line is activated or used). When you put a script in, don't add the ".ncs" part.
The Conditional part is the Conditional Script that will return 0 (FALSE) or 1 (TRUE), which will determine whether that node shows up or is available in-game. When you put a script in, don't add the ".ncs" part.
The VO Resref part is the file in the StreamVoice folder, and is also the name of the .lip file used for lip-sync (animates the mouth as the character talks).
The Sound part is the file in the StreamSounds folder, and is used for alien VO. You need to check the Sound present box, though.

 

A quick way to have "First-time you meet them" dialog is to make two main Entries (two entries right off the black filename line at the top of the dlg) and have the top one be your first-time dialog's starting point. You'd enter "k_con_talkedto" as the Conditional and "k_act_talktrue" as the Script.

 

Now, here is a sample script that you can use as a template for your Conditional Scripts for the dlg files to make certain dialog only appear at certain points in the quest:

 

 

int StartingConditional(){ // And DO NOT leave the < > marks. // == means equal // <= means number on the left is less than or equal to // < means number on the left is less than // >= means number on the left is greater than or equal to // > means number on the left is greater than if(GetJournalEntry("<tag of the quest in the global.jrl file>") == ##) { return TRUE; } else { return FALSE; }}
Besides this, I'd say to use KotOR Tool's Text Editor for scripting, and be sure to select KotOR 1 in the Script menu to see all the functions you can use (the empty text line above the list can be used to search for functions).

 

Thanks! Would this also work to make it so you can't activate the quest more than once? How could I have a third first entry after using k_con_talkedto and k_act_talkedtrue once the quest is active?

 

 


 

About the conversation with more than one NPC: You'll need the Speaker and Listener part in your dialog lines.
As FS described, Speaker determines who is speaking. Keep it blank for any PC responses (as it's always your PC in this case) and you can also keep it blank when the NPC you started the conversation with is talking. Otherwise add the tag of the character you want to be speaking. Just make sure that all NPCs are close to your PC or you might run into some trouble.
Listener determines who the Speaker is talking to, that is which character the Speaker is facing. When blank it'll default to the PC in Entry lines and the NPC you started the conversation with in Response lines. If you want to change that, once again, add the tag of the NPC.

 

And about your custom loot: Do you want to add an entirely new item or just have the character drop a certain item already existing in the game?

 

Thanks. My idea was for the second NPC to have some kind of bodyguard who would join in the conversation, I'm glad I could do this fairly easily.

 

And yes I want to add a new item - a datapad or something similar.

Share this post


Link to post
Share on other sites

I'm pretty sure stores cannot hold items that aren't specified in the .bifs, they were the cause of issues on various TSL stores after all. You might try to add it by script rather than the store, but no promises it wont lead to the same issues.

Share this post


Link to post
Share on other sites

I'm pretty sure stores cannot hold items that aren't specified in the .bifs, they were the cause of issues on various TSL stores after all. You might try to add it by script rather than the store, but no promises it wont lead to the same issues.

Hmm...

 

While working on K1R, I saw that custom items from the override and in the module's own files worked on placeables and creatures, so I should think it'd work on stores, too...

Share this post


Link to post
Share on other sites

The Nar Shaddaa stores where supposed to sell Swoop-bike parts (for the one in the Refugee sector). Instead they were

 

1) Not appearing

2) Duplicating other items in the store

3) Causing a CTD if only they were left

 

So we took them out. I can take a look at seeing if adding them by script works properly though.

Share this post


Link to post
Share on other sites

Thanks for your help everyone. The last things I need to do is change the merchant's dialog to ask if the PC has found the item and not start the quest again (Would I use the same conditional script?), and if the PC has the item to give it back to him, then give the player a reward.

 

Okay, got that done mostly. His opening dialog will now change if the quest is active.

 

I just need to add scripts to give the PC Credits and for the merchant to leave.

Share this post


Link to post
Share on other sites

Good news; the mod's very nearly finished. I've tested it out and it works fine, so I just need to edit a few things I had ideas for. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.