Roth9 14 Posted October 13, 2017 I want to request a mod that in the moment Atton, Bao-dur, Disciple, Handmaiden and Mira became jedi they get a short lightsaber. Thanks. Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted October 22, 2017 Very simple request, all you need to do is add a script to run when the dialog conditionals are met. Simple giveitem script. I am not your guy, but this is an easy one you could do yourself with minimal work. The script itself would be a cut-n-paste for each Padawan, with perhaps a change to the item given so it could be a unique color. The script itself is a one or two line affair between the brackets consisting of giveitem, which requires the parameters (who to give to, and what item to give that NPC). If you want them to equip the item, that's a second line with the function to equip an item (can't remember the syntax atm) with the same parameters as the giveitem function. Very simple to do. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted October 23, 2017 You will want to edit the "a_makejedi.nss" file (which can be found in the "scripts.bif" file or I believe in the 003EBO.mod with TSLRCM; both can be accessed using KotOR Tool). This file is the one that actually assigns the classes to the NPCs, so it's already split up into running code for each one. From there, you should be able to use Qui-Gon Glenn's advice. Quote Share this post Link to post Share on other sites
Roth9 14 Posted October 26, 2017 Very simple request, all you need to do is add a script to run when the dialog conditionals are met. Simple giveitem script. I am not your guy, but this is an easy one you could do yourself with minimal work. The script itself would be a cut-n-paste for each Padawan, with perhaps a change to the item given so it could be a unique color. The script itself is a one or two line affair between the brackets consisting of giveitem, which requires the parameters (who to give to, and what item to give that NPC). If you want them to equip the item, that's a second line with the function to equip an item (can't remember the syntax atm) with the same parameters as the giveitem function. Very simple to do. You will want to edit the "a_makejedi.nss" file (which can be found in the "scripts.bif" file or I believe in the 003EBO.mod with TSLRCM; both can be accessed using KotOR Tool). This file is the one that actually assigns the classes to the NPCs, so it's already split up into running code for each one. From there, you should be able to use Qui-Gon Glenn's advice. Can you guys give me an example of the line I need to make? Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted October 26, 2017 This will not compile, as it is crude and leaves out lots of things. It is just from memory. You need to have the script create the item in your new Jedi's inventory. To do that, the script needs to know who you are talking to, so it can then put the object you want in that person's inventory. Also, the script should be a one-stop shop, in that it should handle all cases for your various Padawans, meaning the script should assign the appropriate lightsaber of your choice to that individuals inventory slot. So, the guts of it are this: void main() object oPadawan = GetTagOfPersonIBeTalkingWith(GetFirstPC()); // this function does not exist. Something like it may if oPadawan == "Mira" CreateItemOnObject("item_template", oPadawan, 1); if oPadawan == "Bao Dur" CreateItemOnObject("item_template", oPadawan, 1); // Repeat this for each trainable party member, where "item_template" is replaced with the tag of the lightsaber you wish to bestow ;There are several more elegant ways to do this, especially the conditional part of the code, but I am at work and have no access to my notes. Of course, now that I have posted this much, I bet someone fixes my garbage and gives you the whole thing Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted October 27, 2017 You will want to edit the "a_makejedi.nss" file (which can be found in the "scripts.bif" file or I believe in the 003EBO.mod with TSLRCM; both can be accessed using KotOR Tool). This file is the one that actually assigns the classes to the NPCs, so it's already split up into running code for each one. From there, you should be able to use Qui-Gon Glenn's advice. Would you just drop the edited script into the override folder afterwards then? Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted October 27, 2017 Yes. You would modify the a_makejedi to include some version of my code in the above post. Then compile it, and throw it into the override. Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted November 9, 2017 I want to request a mod that in the moment Atton, Bao-dur, Disciple, Handmaiden and Mira became jedi they get a short lightsaber. Thanks. A couple questions- 1- Would you want the sabers to be color coded to match their Jedi class- blue for Guardians, green for Consulars, etc? 2-Why a short saber? To make it seem like it's a training saber for the new Jedi, perhaps? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted November 9, 2017 @Mellowtron: I have been absolutely buried and haven't done crap for modding in a while, but here's what you need: 1. Grab the "a_makejedi.nss" or "a_makejedi.ncs" file from the 003EBO.mod file that came with TSLRCM. You'll find the .mod file in the modules folder and can use either KotOR Tool (look in the ERFs->Modules section) or ERFEdit.2. If the .nss was there, use that. If not, use DeNCS to de-compile the .ncs file.3. What follows is a template: // If Param = 0, then it's Atton. (Trying to make it consistent with the CNPC integers.) if ( nScriptNumber == 0 ) { AddMultiClass (CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Atton") ); // The following lines will add a lightsaber and equip it. You'll find the // lightsaber .uti files in the Templates.bif // "g_w_dblsbr" = Double saber // "g_w_lghtsbr" = Normal saber // "g_w_shortsbr" = Short saber object oSaber = CreateItemOnObject("g_w_dblsbr001", GetObjectByTag("Atton")); AssignCommand(GetObjectByTag("Atton"), ActionEquipItem(oSaber, INVENTORY_SLOT_RIGHT_WEAPON)); } 1 Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted November 10, 2017 @Mellowtron: I have been absolutely buried and haven't done crap for modding in a while, but here's what you need: 1. Grab the "a_makejedi.nss" or "a_makejedi.ncs" file from the 003EBO.mod file that came with TSLRCM. You'll find the .mod file in the modules folder and can use either KotOR Tool (look in the ERFs->Modules section) or ERFEdit. 2. If the .nss was there, use that. If not, use DeNCS to de-compile the .ncs file. 3. What follows is a template: // If Param = 0, then it's Atton. (Trying to make it consistent with the CNPC integers.) if ( nScriptNumber == 0 ) { AddMultiClass (CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Atton") ); // The following lines will add a lightsaber and equip it. You'll find the // lightsaber .uti files in the Templates.bif // "g_w_dblsbr" = Double saber // "g_w_lghtsbr" = Normal saber // "g_w_shortsbr" = Short saber object oSaber = CreateItemOnObject("g_w_dblsbr001", GetObjectByTag("Atton")); AssignCommand(GetObjectByTag("Atton"), ActionEquipItem(oSaber, INVENTORY_SLOT_RIGHT_WEAPON)); } Wow.... I wasn't expecting this type of response at all. Thank you very much! One quick question- how to compile the scripts together? Do I need your toolset beta to write the nss files, or should I use the Script editor by Blue? Sorry for the questions, I just have never done any scripting before. Quote Share this post Link to post Share on other sites
Roth9 14 Posted November 10, 2017 A couple questions- 1- Would you want the sabers to be color coded to match their Jedi class- blue for Guardians, green for Consulars, etc? 2-Why a short saber? To make it seem like it's a training saber for the new Jedi, perhaps? 1 - I like to use all the colors when I play, and i give to each one the color I think fits then the best. To Atton I give orange since he worked for the Sith(red + yellow = orange), to Visas I give Yellow and use a mod that gives her the Visas lightsaber, so its red and yellow, to Mira I give the restored bronze since the Kotor comics showed the mandalorian knights with bronze lightsabers, Bao dur I give blue, Handmaiden I give silver since everthing about her is white color, disciple gets green, Kreia gets viridian since its close to green, the exile uses violet if male, cyan if female and red if dark side. 2 - Yes, since they are starting, they need to train first. But before the end of the game they all get normal lightsabers or double. I do this because if not, I would never use the short ones. I also wanted to do this in the first kotor but never found the right mod. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted November 10, 2017 Wow.... I wasn't expecting this type of response at all. Thank you very much! One quick question- how to compile the scripts together? Do I need your toolset beta to write the nss files, or should I use the Script editor by Blue? Sorry for the questions, I just have never done any scripting before. You can use KotOR Tool to both write/edit the .nss files and compile to .ncs files. I've not used Blue's tool and the Toolset Beta is really not ready for that. I've been working on the Toolset when I can, though college eats into that a lot... 1 Quote Share this post Link to post Share on other sites
DarthTyren 103 Posted November 10, 2017 Wow.... I wasn't expecting this type of response at all. Thank you very much! One quick question- how to compile the scripts together? Do I need your toolset beta to write the nss files, or should I use the Script editor by Blue? Sorry for the questions, I just have never done any scripting before. I can personally vouch for Blue's tool, or Notepad++ with a custom language file and auto-finish file. 1 Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted November 10, 2017 You can write a .nss file in any simple text editor. I have always used regular old Notepad since it comes free with Windows and is an easy default program. Notepad ++ is another good option. Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted November 11, 2017 You can use KotOR Tool to both write/edit the .nss files and compile to .ncs files. I've not used Blue's tool and the Toolset Beta is really not ready for that. I've been working on the Toolset when I can, though college eats into that a lot... No problem on the toolset beta, you've already made a lot of progress. Anyone who's been in college can remember busy times during their terms. If using KOTOR tool, do I use the ERF builder to write the script? Every time I double click the a_makeajedi line, there's a dialogue box that says "error launching nwnnsscomp Is it installed in the same directory as the program?" You can write a .nss file in any simple text editor. I have always used regular old Notepad since it comes free with Windows and is an easy default program. Notepad ++ is another good option. Seriously, that's all that's needed? How do I make the file an .nss file then? Notepad++ has an encoding bar, but there's no .nss option. I can copy and paste the script that Fairstrides posted above and edit it accordingly, and then drop it in the override folder, right? Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted November 11, 2017 Yes, that's all that is needed. 1. Open a simple text file with Notepad 2. Enter your code 3. Save as .nss 4. Use compiler to make your .ncs, with command line or KotOR Tool. Yes, nwnnsscomp needs to be in the same folder as your .nss file. Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted November 11, 2017 Yes, that's all that is needed. 1. Open a simple text file with Notepad 2. Enter your code 3. Save as .nss 4. Use compiler to make your .ncs, with command line or KotOR Tool. Yes, nwnnsscomp needs to be in the same folder as your .nss file. And I would use what to compile the script? Sorry for all the questions, I've just never done any scripting before. Thanks for your help! Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted November 11, 2017 Ah, that's ok! KotOR Tool has a compiler and editor built in - but it is the same compiler that you mentioned earlier - nwnnsscomp.exe. Using KTool, or Blue's editor (haven't used it, but it looks legit), you have access to the function library, which is helpful in reminding you variables that need to passed, etc. It has been a minute, and I haven't compiled a script in quite a while, but it is a very simple process. The compiler will either find errors in your code and specify where the error is, or it will compile. Not all scripts that happily compile actually do anything, or what they were intended to do, so of course it needs to be tested in-game. Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted November 11, 2017 Ah, that's ok! KotOR Tool has a compiler built in - but it is the same compiler that you mentioned earlier - nwnnsscomp.exe. It has been a minute, and I haven't compiled a script in quite a while, but it is a very simple process. The compiler will either find errors in your code and specify where the error is, or it will compile. Not all scripts that happily compile actually do anything, or what they were intended to do, so of course it needs to be tested in-game. Thanks for understanding! I tried saving Fair Strides' code above in a notepad document by adding the nss tag at the end and it saved fine. Although every time I double click the nwnnsscomp from the KOTOR tool program files x86 folder, a pop up box quickly opens and then closes. That's not supposed to happen, is it? As for testing, I'm guessing that you need to load a save before your character turns certain NPCs into a Jedi? Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted November 11, 2017 That is not supposed to happen, but I think the reason is one I remember. Where is KotOR Tool looking for your file? Wherever your script.nss file is, copy nwnnsscomp.exe from your override or from the KotOR Tool program folder, and paste it next to your .nss. Then it will work I think. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted November 11, 2017 The issue is you're trying to use nwnnsscomp.exe directly. And you can't use just what I wrote above. That's just a sample of what you'd need in "a_makejedi.nss"; you'll want to use that as a base and open it. What you want to do: 0. If you don't already have it, grab the "nwscript.nss" from the "scripts.bif" of both games and put the file in the games' respective Override folder. 1. Open KotOR Tool's Text Editor. (either use the button below the menu or the menu itself) 2. Open the .nss file you want to edit or copy-paste in. 3. Edit the code however you want, then when you go to save it, make sure it has ".nss" at the end. 4. Go to the menu in the Text Editor, the option on the far right, and hit "Compile" after you set whether the script is for KotOR 1 or KotOR 2. 1 Quote Share this post Link to post Share on other sites
Mellowtron11 180 Posted November 13, 2017 The issue is you're trying to use nwnnsscomp.exe directly. And you can't use just what I wrote above. That's just a sample of what you'd need in "a_makejedi.nss"; you'll want to use that as a base and open it. What you want to do: 0. If you don't already have it, grab the "nwscript.nss" from the "scripts.bif" of both games and put the file in the games' respective Override folder. 1. Open KotOR Tool's Text Editor. (either use the button below the menu or the menu itself) 2. Open the .nss file you want to edit or copy-paste in. 3. Edit the code however you want, then when you go to save it, make sure it has ".nss" at the end. 4. Go to the menu in the Text Editor, the option on the far right, and hit "Compile" after you set whether the script is for KotOR 1 or KotOR 2. Thanks, I'll give it a shot soon. Kind of busy at the moment moving and packing though. I'll let you know how the scripting goes. Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted November 19, 2017 The issue is you're trying to use nwnnsscomp.exe directly. And you can't use just what I wrote above. That's just a sample of what you'd need in "a_makejedi.nss"; you'll want to use that as a base and open it. What you want to do: 0. If you don't already have it, grab the "nwscript.nss" from the "scripts.bif" of both games and put the file in the games' respective Override folder. 1. Open KotOR Tool's Text Editor. (either use the button below the menu or the menu itself) 2. Open the .nss file you want to edit or copy-paste in. 3. Edit the code however you want, then when you go to save it, make sure it has ".nss" at the end. 4. Go to the menu in the Text Editor, the option on the far right, and hit "Compile" after you set whether the script is for KotOR 1 or KotOR 2. I'll add something to this, that may be helpful or can be thrown away. After learning the basics of scripting, and understanding the normal syntax, I found it to be somewhat a PITA to write all of my scripts inside the KotOR Tool editor. What I do now takes extra steps and for some may be a waste of time... I write my scripts in Notepad. When I feel like I'm close to compiling, I then load that text file into the editor. I check with the editor to see that all of my parameters are in place, then I use KTool to save the file again, even if I didn't alter it. This loads the filename into the Text Editor window, and allows you to compile following step 4 of FS' instructions. This can be considered double work, so it is not for everyone Quote Share this post Link to post Share on other sites
Roth9 14 Posted January 3, 2018 Managed this one. Thanks to everyone for the tips. Quote Share this post Link to post Share on other sites