You are here

Creating a Henchman - Basic Henchman Conversation and Scripting

Author: 
Wydraz

You should be somewhat familiar with the Conversation Editor in the Neverwinter Nights Aurora Toolset before following this tutorial .If you aren't yet, I strongly suggest Iskander's HowTo Article that introduces the concepts that will help you in this tutorial - especially the tutorial section called "Starting The Conversation".

At a minimum you want a PC to speak with your NPC henchman and have the NPC join the PC, or leave if the PC dismisses the henchman. Payment for services is also a good idea. You also (usually) want the henchman to remain loyal, and prevent him from being hired by a different PC before being dismissed!

This means your henchman should have a dialog structure that looks something like this in the Conversation Editor:

Root

'- • [OWNER] - Yes, <master/mistress>?


'- • [OWNER] - Sorry, I'm already hired.

'- • [OWNER] - Hello. You can hire me for 100gp.

   '- • I cannot afford you.

   '- • I'll hire you.

      '- • [OWNER] - Glad to hear it

The henchman's first line only appears if the PC has hired him, and will offer a conversation branch that allows the PC to set up some options with the henchman (such as dismissing him). To do this, select the [Text Appears When] tab and select 'nw_ch_tactics2' as the script for that line.

The henchman's second line only appears if the henchman is hired, but not necessarily by the PC. This allows the speaker to know that the henchman is hired by someone else, and should prevent him from hiring the henchman away from the first master. To do this, select the [Text Appears When] tab and select 'nw_ch_tactics' as the script for that line.

If the first and second line do not appear, then that means the henchman is not hired, so the third line appears, allowing the PC to hire him. The PC's options should include choosing not to hire the henchman, and (if he has enough money) to hire him. If we want the henchman to cost 100gp, we can create this script in the [Text Appears When] tab of the "I'll hire you" line to check if the PC has enough gold:

// * script: can_pay100

// * Does the PC have 100 gp?

// Use in [Text Appears When] tab of PC hiring dialog line.



#include "NW_I0_PLOT"



int StartingConditional()

{

return (HasGold(100,GetPCSpeaker()));

}

Then, to actually pay for the henchman, this script goes in the [Actions Taken] tab of the same dialog line:

// * script: pay100

// * Removes 100 gp from PC.

// Use in [Actions Taken] tab of PC hiring dialog line.



void main()

{

TakeGoldFromCreature(100, GetPCSpeaker(), TRUE);

}

Now, to get the henchman to join the PC, add this script to the [Actions Taken] tab of the line where the henchamn accepts:

// * script: henchman_joins

// * NPC Henchman joins PC, replacing other henchman if necessary.

// Use in [Actions Taken] tab of henchman's joining dialog line.



#include "nw_i0_henchman"



void main()

{

if (GetIsObjectValid(GetHenchman(GetPCSpeaker())) == TRUE)

{ SetFormerMaster(GetPCSpeaker(), GetHenchman(GetPCSpeaker()));

object oHench = GetHenchman(GetPCSpeaker());

RemoveHenchman(GetPCSpeaker(), GetHenchman(GetPCSpeaker()));

AssignCommand(oHench, ClearAllActions());

}



SetWorkingForPlayer(GetPCSpeaker());

SetBeenHired();



ExecuteScript("NW_CH_JOIN", OBJECT_SELF);

}

Finally, to allow the PC to dismiss the henchman, we'll add the option in the dialog branch where the henchman is already hired.



Root

'- • [OWNER] - Yes, <master/mistress>?


   '- • Great Job. [End Dialog]

   '- • You're fired.


      '- • [OWNER] - I'll be here if you need me again.

We add this script to the [Actions Taken] tab of the line where the henchamn says goodbye:

// * script: henchman_leaves

// * NPC Henchman leaves PC.

// * Use in [Actions Taken] tab of henchman's departing dialog line.



#include "nw_i0_henchman"



void main()

{

SetFormerMaster(GetPCSpeaker(), OBJECT_SELF);

RemoveHenchman(GetPCSpeaker());

ClearAllActions();

}

We now have all we need for the henchman's conversation. To create the henchman itself, all we need to do is create him in the Creature Wizard (or copy another creature already made), and take a few more steps.

Basic tab - Conversation: Use the dialog we just created, and perhaps add some more meat where necessary.

Advanced tab - Sound Set: Be sure to assign a Sound Set that has all of the lines your henchman might speak. These can be any of the official campaign's henchmen, or any sound set the begins with "Male..." or "Female..."

Inventory - A few good healing potions is essential. If you want your henchman to have a weapon not normally useable for their level (like a ranged weapon with unlimited ammo so they don't run out), create that weapon as a creature item (melee weapon), but equip it in the normal weapon slot. In the official campaign, there is also the "henchman properties" creature hide item. It gives them Immunity to Charm Person, Dominate Person, and Mass Charm. Personally I prefer my henchman as less than superhuman, so I don't bother adding these special items.

Scripts tab - reassign these as indicated:

OnBlocked: nw_ch_ace

OnCombatRoundEnd: nw_ch_ac3

OnConversation: nw_ch_ac4

OnDamaged: nw_ch_ac6

OnDeath: nw_ch_ac7

OnDisturbed: nw_ch_ac8

OnHeartbeat: nw_ch_ac1

OnPerception: nw_ch_ac2

OnPhysicalAttacked: nw_ch_ac5

OnRested: nw_ch_aca *

OnSpawn: nw_ch_ac9

OnSpellCastAt: nw_ch_acb

OnUserDefined: nw_ch_acd

* Note: the OnRested script (nw_ch_aca) may be non-exisitent, so it's a good idea to leave it blank, especailly if you plan on exporting your henchman.

Here is a trick to replace the default scripts - highlight the text 'nw_c2_default' in each slot (leaving the final letter or number) and paste 'nw_ch_ac' in its place.

Now we have a basic, no frills henchman. He joins your cause, contributes his skills, listens to commands, leaves when told, and he can be re-hired. He will not level up, and when he dies he doesn't respawn, he stays dead (but may be raised). I actually prefer henchmen to be this way, but if you're a capable scripter you might look into the nw_i0_henchman script, and the henchman's OnDeath script. While the suggested default works, there is code in these scripts that is specific to the official campaign that could be tweaked for your own modules. Also note that to get a henchman to level up, you would have to make a copy of him for each level.

Migrate Wizard: 
First Release: 
  • up
    100%
  • down
    0%
Jimdad55

Just worked my way through this. Very helpful and worked first time ! Thanks. 

  • up
    50%
  • down
    50%