How to SetMaxHenchmen?

Hello, I’m trying to figure out how to set the Max Henchman limit in my module. I’ve been trying everything, but nothing anyone suggests ever works. Like for example they say to add SetMaxHenchmen(3); in the OnModuleLoad Script, but this does not compile and does not work. Also they say to change the x0_i0_Henchmen script on line 481 but that doesn’t work either! Can someone please help me? I need to know exactly what those scripts should look like because I guess i’m typing them in wrong or something. I would be very grateful. I really want to change the max henchmen limit in my module cause it will help make an awesome game. Thank you.

1 Like

Hi. :smiley:

Where’ve you been adding SetMaxHenchmen, inside the OnModuleLoad script? If it’s throwing a compiler error, you’ve probably just got it in the wrong place.

Try it just below void main:

void main()

The specific compiler error should be mentioned in the log just below the code, if you’re scripting in the toolset. Googling it’ll lead you to the Lexicon page on compiler errors, which can usually explain what the problem is.

I’ve taken a brief look at the script, and it looks like line 481 (edit: Correcting self, that’s on 486 :thinking:) refers to the constant X2_NUMBER_HENCHMEN, which is further up on line 75. I think if you increase the number there from 2 to whatever you want it to be, it ought to work just the same. :thinking: Maybe better, since it won’t just be surpassing the limit check in HireHenchman(), in case the hench limit is being checked anywhere else.

Thank you for your help. I finally got the OnModuleLoad script to compile. Now I just have to get the x0_i0_henchman script to compile. i changed the number from 2 to 3 on line 75 like you said, however, I altered line 481 in my previous attempts, and I don’t remember what it looked like before I altered it lol so now I just wanna get it back to normal so it’ll compile. Do you know what it’s supposed to be?

1 Like

Got a trick for ya:

You can delete the edited script. It’s currently a duplicate of the original file, saved under the same name as the original script. The original is being overridden by the same-named duplicate, but it’s still there. If you delete the duplicate, you can reload the original again.

Right-click the script in the list, hit Remove, and Yes. Then - important! - hit NO when it asks you whether you’d want to remove the references to the script. Otherwise, if the script is attached to anything anywhere (won’t be the case with this one, since this is a library, but still), that thing will stop trying to use this script and you’d have to reattach it manually, which can be a huge hassle.

Oh wow… Ok so I did that and managed to load the original x0_i0_henchman script up. Good as new just like before I tampered with it. But it still won’t compile?! I don’t understand, how did the original script ever work in the first place if it never compiled? This scripting stuff is crazy man lol.

1 Like


Oh, hold up. I think I’ve got it. That one isn’t actually supposed to compile by itself. It’s just a library, there’s no starting point.

Try hitting Build -> Build Module, up in the top row in the toolset, and tick Compile -> Scripts active, then hit Build. That should do the trick, compiling all scripts, including all that’re making use of this one. Those scripts’ll all throw compiler errors then, if there’s something wrong with the functions in the included library.

Ok so I believe i’m making progress. It no longer says “You may only have one henchman at a time”
But, it still fires the first henchman when I hire the second lol. Oh the joys of computers lol. Actually, I really do love this stuff. The nwn toolset is one of the funnest things i’ve ever discovered. I work on my module all the time. I want to make it really good and memorable so i’m learning as much as I can about scripting and what not. They say this is a good place to hang out. I’m really inspired by old school stuff like ‘Pool of Radiance’.

1 Like

:smiley: Yeah, far as hobbies go, NWN modding is a pretty great one. I think the applying-logic-to-everything that comes with the programming, plus the “If you want something to exist, you’ve got to figure out how to make it exist” from the building things, plus the “To each their own” from all the different art style preferences, are just plain good for people. Not so much room for ‘RARGH! WE ARE NOT IDENTICAL IN EVERY WAY, THEREFORE WE ARE ENEMIES!’ when everyone’s busy building stuff, maybe.

Check out Tarot’s scripting primers sometime, they clear up a lot of confusion:

I’ll go dig into the henchmen thing, see if I can figure out how to add them reliably. 'm gonna need to know this stuff, too. Fingers crossed; maybe some of the other folks know the answer already.

I think I might have found something. The scripts in the basegame henchman dialogues include firing the existing henchman on hire. I’ve got a test module here with Daelan and Boddyknock placed directly from the blueprints list, and they’re firing eachother when I try to hire them both.

The HotU henchmen don’t use the same scripts in their dialogues, they use the HireHenchman() function from x0_i0_henchman, that’s affected by the int constant being increased.

Try checking your henchman dialogue, specifically the line where they get hired. Does the script under Actions Taken use the HireHenchman() function? Is the script “nw_ch_action_13” - kicking the old henchman out before hiring the new one?

edit: Confirming - Switching henchman dialogue to use HireHenchman() function instead hires both of them. Also gives an AI Update Time Overflow message while in debug mode, though. o_ô Wonder what’s up with that.

I figured it out! Just had to remove the line of script that fires the former henchmen lol. Now I effectively have 2 henchmen running behind me and being badass in combat lol thank you all so much! Now to make a truly epic game… :slight_smile:

Ok so I got a link to some really badass henchmen AI upgrades for leveling up multiclass henchmen and having henchmen level up in general. But I can’t seem to find my way back to them cause it was a bit ago and i’ve lost em lol so does anyone know any awesome henchmen scripts? Btw I did not like the Henchmen AI and battle mod that you can subscribe to on steam. It sucked. Anything helpful that has to do with leveling up henchmen or henchmen AI upgrades would be appreciated thank you.