klorch 0 Posted March 8, 2017 So I'm new to scripting and dialogue but I'm having a little trouble... The first thing I'm trying to do is have a short (newly written) conversation, triggered by a script called m_alpha.nss m_alpha.nss: void main() { ActionStartConversation(GetFirstPC(), "m_alpha") } This script replaces the onConversation script associated with the mercenary.utc file. However, the script fails to fire. Am I supposed to replace the onConversation script or not? How else do I associate m_alpha.dlg with the mercenary creature file? I'd like it to initiate that conversation every time I speak to a mercenary (replacing, for example, the generic "[The mercenary just grumbles at you]" on Dantooine) Within m_alpha, there is a line that should trigger a script called t_500.nss, a test script which takes 500 credits from the player. Since m_alpha won't fire, however, I added a line in mandalore.dlg associated with t_500. The line displays properly in the conversation, but when I choose it, the script doesn't fire. t_500.nss: void main() { TakeGoldFromCreature(500,GetFirstPC(), FALSE) } Both scripts compile correctly. Clearly there is a problem with the linking of scripts to dialog. Am I supposed to include the .nss or .ncs extension when I put the script in the dialog editor? Do I just need to start with a clean savegame? I'm sorry to ask so many questions, but of all the scripting tutorials out there, none of them really specify how to make scripts happen in game. Quote Share this post Link to post Share on other sites
jc2 581 Posted March 8, 2017 Some basic advice that may be helpful. If you edit the UTC, then you must load a save prior to entering that module. The game remembers based on saved games, so if you were to edit the UTC, then load a save where you had previously gone to that module, it would not show your changes. Therefore, be sure to load a save game prior to going to that module, to be on the safe side load a save from before you went to that planet. Also, you will not want to include .nss or .ncs in your dialogue editing. Be sure you have the .ncs in your override too. Not to mention, if you are starting a conversation, I believe you want to use > int StartingConditional() < not > void main () > That's all I know, I'm learning scripting and dialogue editing as well (for k1, not tsl). Hopefully, someone wiser will come by and help you out, if not try posting this on FairStrides Script Shack. He's a great guy and will most likely help you out. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 8, 2017 jc2 is mostly spot-on. You CAN use void main(), and probably should. Also, to clarify something he said, you asked if you needed the extension and the answer is no. If you were editing the mercenary.utc file, you'd put exactly the following, minus the quotes: "m_alpha". Also, as an extra insurance, I recommend changing the following line: ActionStartConversation(GetFirstPC(), "m_alpha") to the following: AssignCommand(OBJECT_SELF, ActionStartConversation(GetFirstPC(), "m_alpha")); 1 Quote Share this post Link to post Share on other sites
Kexikus 994 Posted March 8, 2017 There's no need to edit the OnConversation script if all you want to do is to start the conversation. Actually I would even say that using the OnConversation script here simply won't work. You can simply add the name of the dialog file in the Conversation box of the .utc (assuming you use KotOR Tool to edit it. If you use a gff-editor: There should be a field called "Conversation" somewhere. Put the name of your .dlg file without extension there.) The OnConversation script is used to trigger additional effects when starting a conversation. I don't know why your second script isn't working though. Make sure you have the compiled script and your edited .dlg in the Override, but I assume you did so. The only reason I could think of is that maybe you put the script in the Conditional script slot instead of the fire when spoken slot. And finally a clarification on what jc said about using int StartingConditional(): int StartingConditional() is ONLY used for conditional scripts that enable certain lines in dialog. Every script fired in a dialog uses void main() and as Fair Strides said you should use void main() in your case. 2 Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 8, 2017 I don't know why your second script isn't working though. Make sure you have the compiled script and your edited .dlg in the Override, but I assume you did so. The only reason I could think of is that maybe you put the script in the Conditional script slot instead of the fire when spoken slot. The second script is fired from inside the dialog, which is accessed through the script that wasn't firing. Quote Share this post Link to post Share on other sites
Kexikus 994 Posted March 8, 2017 The second script is fired from inside the dialog, which is accessed through the script that wasn't firing. According to his first post that's not true: Since m_alpha won't fire, however, I added a line in mandalore.dlg associated with t_500. The line displays properly in the conversation, but when I choose it, the script doesn't fire. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 8, 2017 In that case, I'd again check for whether the ".ncs" or ".nss" was put in. Quote Share this post Link to post Share on other sites
klorch 0 Posted March 8, 2017 Update: I managed to get the t_500.nss script working. Something - likely an earlier mistake of mine - was preventing the t_500.nss from compiling properly. Renaming it to t_500g.nss allowed it to compile properly, and then simply changing the script links in the dlg file worked. However, I still can't get the original script to trigger properly. I'm thinking this may be because of the nature of the mercenary creature - since there are so many different mercenaries across the game (i.e. those on Telos are different from those on Dantooine) it may not be possible to have the same conversation with all of them. Still, I would think that if they all share the name mercenary, they would all share the mercenary.utc file. Also - I can't find the mercenary.utc except by searching for it with Kotor Tool... perhaps the one that I am editing is exclusive to Kotor and not TSL. I'll continue looking in the TSL utc branch but I can't imagine that it'd be saved under something different in TSL. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 8, 2017 In that case, a question: What exactly are you wanting and trying to do? Quote Share this post Link to post Share on other sites
klorch 0 Posted March 8, 2017 I'm trying to create a dialog file so that the player could go up to any given mercenary and start that dialog (and they'd all say the same thing, all the mercenaries with the nametag "Mercenary"). That dialog could eventually lead to some kind of quest but for right now, I'm just trying to figure out the low-level details of initiating a conversation with them. Something else occurred to me - Take for example a named npc such as Col. Tobin, with whom you can initiate conversation aboard the ravager. There isn't a dlg file specific to this conversation, just as there isn't a dlg file specific to the mercenaries' comments. In theory, the method for triggering the conversation should be the same between the two, only I don't know how to edit either dialog. I'd hoped to use it as a template. But basically, my goal is to replace those generic comments by the mercenaries with a specific conversation shared across all of them. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 8, 2017 I should warn you of several things: 1. Any file in the templates.bif could be re-used and customized on a per-level basis and stored in that specific level. Editing any such copy of a file and putting it in the Override folder would overwrite every single use of that file, which often includes custom stuff. 2. In KotOR 1, the .dlg files were stored in the templates.bif and in each level. In KotOR 2, some .dlg files are in the templates.bif, but the .dlg files for a specific level are in the ERFs section of KotOR 2 in KotOR Tool. Each level has it's own file, which is named after the level like so: "_dlg.erf" without the marks. 3. You can edit and create dialogs with the DLG Editor in the Downloads section, under Modding Tools. This is the usual method, and required for KotOR 2, since KotOR Tool doesn't support aspects of the .dlg format that were added in KotOR 2. 4. As has been mentioned, if this is to be the default conversation, then enter this as the .utc file's Conversation in KotOR Tool or K-GFF or whatever. Then you can use the default script "k_def_dialogue01". Alternatively, if you've entered the dialog as the .utc file's Conversation, you just need code that says this: void main() { BeginConversation(); } Quote Share this post Link to post Share on other sites
klorch 0 Posted March 9, 2017 So I've found the ERF dlg files that you've mentioned, but I tried setting m_alpha as the utc's conversation, but it still isn't showing up in-game. If I set m_alpha as the conversation, do I need a script/where would I trigger the script? Again, the goal is that the generic comments in the dlgs (which are specific to each module) would be overridden by the m_alpha dlg, if that is possible Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 9, 2017 You would open the .utc file in KotOR Tool, set the Conversation to "m_alpha" without the quotes, then save the file to the Override folder. Nothing else is changed. The "m_alpha.nss" shouldn't be required at all. Your .dlg file would be called "m_alpha.dlg" without the quotes and also in the Override folder. Nothing else is done. That should work just fine. If you don't already, use Google and follow the steps to make sure you have file extensions being shown when you look at your Override folder. If you see "m_alpha.dlg.dlg" or "mercenary.utc.utc", you'd need to remove one of the ".dlg" or ".utc" from the filename, respectively. Quote Share this post Link to post Share on other sites
klorch 0 Posted March 9, 2017 So I'm still not able to get the dlg to trigger using the conversation field of the utc, so I may have to manually edit the erf dlg files. It may turn out to be a better idea anyway, as it'll help me get more experience with dialog & scripting, and will help pinpoint any dialogs that shouldn't be replaced Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted March 9, 2017 Before you do that, please post all the files we've been talking about so far. If there's an issue with them, it can be found and fixed before anything else might be damaged. Quote Share this post Link to post Share on other sites
Kexikus 994 Posted March 9, 2017 Also make sure that you load a savegame where you have NEVER entered the area that contains your edited character before. If you don't, the .utc changes won't load. Quote Share this post Link to post Share on other sites