Sign in to follow this  
johncomnenus

Help making my first mod: Turning off henchman AI

Recommended Posts

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 by johncomnenus

Share this post


Link to post
Share on other sites

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.

  • Light Side Points 1

Share this post


Link to post
Share on other sites

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 by johncomnenus

Share this post


Link to post
Share on other sites

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).

  • Light Side Points 1

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

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.

Sign in to follow this