johncomnenus 0 Posted November 14, 2019 (edited) Hi all, I'd like to make my first-ever mod: My goal is to turn off henchman AI in combat for KOTOR 2. I was inspired by this gentleman's file, "k_ai_master.ncs," for KOTOR 1, which I used when I played through that game and found to work perfectly. I was hoping to reverse-engineer it and implement something similar for KOTOR 2's k_ai_master file. (very basic) Question 1: Am I correct in thinking I'll need to use the KOTOR Scripting Tool to open the KOTOR 1 k_ai_master file up, find the changes that were made, and make similar ones for KOTOR 2's k_ai_master file? I ask because I haven't been able to get KOTOR Scripting Tool to work on my Mac even with a CrossOver install, and I'd like to know for sure before I borrow a PC and do it there. Question 2: KOTOR 2 has a bunch of different AI scripts. Would the easiest approach be to futz with one of these - the "Stationary" script, say, since it's already pretty close to what I want - and limit myself to that? Thanks very much for your help! Edited November 14, 2019 by johncomnenus Quote Share this post Link to post Share on other sites
DarthVarkor 384 Posted November 14, 2019 To open and read ncs files, you'll be needing DeNCS. It de-compiles scripts them back to nss format which is readable and editable. Then, you can use either KOTOR Scripting Tool or the "TXT" button within the menu of KOTOR Tool to open them. Once you've written your own script, make sure you export/compile it as an ncs otherwise the game can't read it. Afraid I can't be of any help with your AI scripts specific questions, but I hope that helps get the ball rolling. 1 Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted November 14, 2019 You don't need to decompile most global scripts (like k_ai_master) as their official source can be found in scripts.bif (in KTool BIFs -> scripts.bif -> Script, Source). 2 Quote Share this post Link to post Share on other sites
johncomnenus 0 Posted November 15, 2019 (edited) Thank you very much! I've gotten DeNCS and Kotor Tool to work on my Mac, after some serious annoyances. Sadly, the decompiled .nss version of the GOG user's k_ai_master.ncs file is hard for me to make sense of, and very dissimilar to the default k_ai_master as extracted from KOTOR 1's files to boot. I hope I'll be able to figure it out. Edited November 15, 2019 by johncomnenus Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted November 16, 2019 Yes, a decompiled NCS will never exactly match the original source. That's impossible. The more extensive and complex the code, the greater the difference will be. What you will also be seeing is a heap of stuff from the includes that are only referenced in the source, but have to be pulled in for the binary script. A single function in the original source like GN_DetermineCombatRound(); will probably result in several hundred lines of added code in the decompiled source. Giving the 3rd party script a cursory once-over, it looks like he has completely removed events KOTOR_HENCH_EVENT_ON_PERCEPTION (2002), KOTOR_HENCH_EVENT_ON_COMBAT_ROUND_END (2003), KOTOR_HENCH_EVENT_ON_ATTACKED (2005), and KOTOR_HENCH_EVENT_ON_DAMAGE (2006). 1 Quote Share this post Link to post Share on other sites
johncomnenus 0 Posted November 16, 2019 7 hours ago, DarthParametric said: Yes, a decompiled NCS will never exactly match the original source. That's impossible. The more extensive and complex the code, the greater the difference will be. What you will also be seeing is a heap of stuff from the includes that are only referenced in the source, but have to be pulled in for the binary script. A single function in the original source like GN_DetermineCombatRound(); will probably result in several hundred lines of added code in the decompiled source. Giving the 3rd party script a cursory once-over, it looks like he has completely removed events KOTOR_HENCH_EVENT_ON_PERCEPTION (2002), KOTOR_HENCH_EVENT_ON_COMBAT_ROUND_END (2003), KOTOR_HENCH_EVENT_ON_ATTACKED (2005), and KOTOR_HENCH_EVENT_ON_DAMAGE (2006). Awesome! I'll try and make the same changes to K2's file, then. I really appreciate your taking a look. By the way, am I right in thinking that the third-party script also removes events 2013 and 2014? Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted November 16, 2019 No. If you look at the vanilla file, they are commented out, so there was nothing there to begin with. TSL's is the same. Edit: I would advise that you install Notepad++ and grab JCarter's NSS language definitions. That will make reading and editing scripts a whole lot easier. Quote Share this post Link to post Share on other sites
johncomnenus 0 Posted November 16, 2019 39 minutes ago, DarthParametric said: No. If you look at the vanilla file, they are commented out, so there was nothing there to begin with. TSL's is the same. Gotcha, thanks. Well, I made the changes and got the file to compile! Will test it out and report back. Quote Share this post Link to post Share on other sites