Huntsman - Guide To Henchmen: One Liners And Interjections

This is part of a series of tutorials on how to set up and modify the behaviour of the new henchmen brought in with the SoU and HoTU expansions. Other tutorials cover topics such as setting up a basic henchperson, multiple henchmen, henchmen with more than one class and how to carry henchmen from one module to another.


This tutorial will be somewhat easier to follow if you already have the conversation file used in the 'Henchmen - SoU / HoTU Style' tutorial. If you don't have it, you can download the file from here. Alternatively you could download a demo module showing how the different types of trigger are used. Download the module here.


Introduction


A one liner, when it comes to a henchman, is when the henchman says something short requiring no response from the player. This usually occurs when the henchman crosses a trigger that you have laid down. Interjections are similar except that the henchman will actually start a conversation with the PC, rather than waiting for you to want to talk to him. It allows for a little more interaction from your henchmen companions.


One Liners - Non-Random.


In the conversation file you imported you will see a lot of single line NPC conversation lines, such as "We should be wary I think, all manner of nasties could hide in the shadows in here.", these are the one liners.


1) To get these to work you need to lay down one of the XP2 One_Liner, Non-Random triggers.


2) Open the properties of the trigger and go to the 'Advanced' tab. Change the 'keytag' to the number of the popup line that is to appear. So if it's the first line you want to appear put 1 in the 'keytag' line.


3) In the conversation file you need to add a script to the 'Text Appears When' tab of each Non-Random popup line. The script for line one is 'x0_d2_hen_line1' and for PopUp2 it needs 'x0_d2_hen_line2' and so on. Note: the scripts only run up to 'x0_d2_hen_line52' though you could add more if you needed to.


4) Each one liner should have 'x0_d1_hen_noline' in the 'Actions Taken' script box to clear the one liner.


One Liners - Random


Random One Liners work in a similar way to the non-random ones, but you don't need to change anything on the keytag of the trigger and you use different scripts in the conversation. Before you can do any random oneliners or interjections though you will need to make a change to your henchmans 'OnSpawn' script. If you look at their 'OnSpawn' script you will see code that looks something like this.


else
if (sMyTag == "henchmans_tag")
{
    SetNumberOfRandom("X2_L_RANDOMONELINERS", OBJECT_SELF, 5);
    SetNumberOfRandom("X2_L_RANDOM_INTERJECTIONS", OBJECT_SELF, 2);
}

All you need to do is add in your own section of code like that and then place your henchmans tag where it says to in the above code. Change the numbers 5 and 2 to match the numbers of random oneliners and interjections in the conversation file of that henchman.


Now here is how to do the random oneliners.


1) Lay down an XP2 One-Liner, Random trigger.


2) In your conversation editor write your random one-liners and then use 'x2_d2_hen_rln001' script in the text appears when of the first line and then 'x2_d2_hen_rln002' for the second and so on. Note: the scripts only run up to 'x2_d2_hen_rln100' though you could add more if needed.


That's all there is to the random one-liners.


Interjections - Non-Random.


Interjections work in pretty much the same way as the non-random popups above.


1) Lay down one of the XP2 Interjection, Non-Random triggers where you want the interjection to happen.


2) As with PopUps change the keytag to match the Interjection line number you’re using.


3) Whichever line of conversation you want to be used when the player walks over the trigger should have the script 'x0_d2_hen_inter' placed in the 'Text Appears When...' script box for the line. In the conversation file imported earlier this line is the one that goes "Wait , I would have a word with you if I may."


4) If the player chooses to continue the example conversation, the henchman has several possible conversation lines he might say. Each line has a script on the 'Text Appears When...' and 'Actions Taken' tab. The scripts on 'Text Appears When...' are in order and look like 'x0_d2_hen_inter1' or 'x0_d2_hen_inter2' etc and the script in 'Actions Taken' is always 'x0_d1_hen_inter0' so as to reset the interjection and make sure it doesn’t do it more than once. Note the script numbering runs up to 'x0_d2_hen_inter9' and then 'x0_d2_hen_inte10' to 'x0_d2_hen_inte50'.


Interjections - Random.


These work pretty much the same as the random popups do in that you don't need to change the keytags of the trigger.


1) Lay down an XP2 Interjection, Random trigger.


2) Add your random interjections below the non-random interjections you did above and then use the script 'x2_d2_hen_int001' for the 'Text Appears When' tab of the first line and 'x2_d2_hen_int002' for line two, and so on for the rest of the random lines you do.


That is about all for the random interjections, but check out the conversation file in the example module for interjections at the bottom of this page to see how it all works in game and in a conversation file if you need to see it in action to help explain it.


Party Banter, or Party random Interjections


This is for when you have two or more henchmen with you and you want them to talk between themselves about something. It's fairly simple to do and similar to the random interjections we have already done, except that you will have to make your own scripts.


1) Lay down an XP2 PARTY Interjection, Random trigger where you want the interjection to happen.


2) Write in one of your henchmans conversation files what you want him to say to one of the other henchmen.


3) Write another OWNER line below the conversation you just wrote with the text "------- This line must be placed at the end of inter-party banter ---------"


4) In the 'Text Appears When' tab of the line you just wrote place the script 'x2_turnoffbanter' and put the script 'x2_hen_try_other' in the 'Actions Taken' script slot.


5) In the 'Text Appears When' of the henchmans interjection you need to write a custom script that checks to see if the other henchman you want this henchman to talk to is in the party as well. An example of the type of script you need is below, just put the tag of the henchman you're checking for where marked.


Also you will see that there is a 1 after the henchman tag place in the script. If you have more than one possible random line for the henchman you are trying a random banter with then that number is what you change. So for line one you use 1 and for the second possible banter you change that to 2.


#include "x2_inc_banter"
int StartingConditional()
{
    if (TryBanterWith("henchman_tag_here", 1 ) == TRUE)
    {
        return TRUE;
    }
    return FALSE;
}

That is all you need for the banter, but if you need to see examples of how it works then download the demo module which has examples of the henchmen doing all the above interjections and popups. So you can see it in action in the module and then look at the conversaton file in your toolset.


Note:


As of version 1.62 there is an error in 'x2_hen_try_other' that prevents the banter being passed from one henchman to another in certain circumstances. Please find the following lines of code:


    // * Henchman 2 can be tried
    if (GetIsObjectValid(oHench1) && oHench1 != oSelf && GetIsFollower(oHench2) == FALSE)
    {
        oBanter = oHench2;
    }
    else
    // * Henchman 3 can be tried
    if (GetIsObjectValid(oHench1) && oHench1 != oSelf && GetIsFollower(oHench3) == FALSE)
    {
        oBanter = oHench3;
    }

And change them to:


    // * Henchman 2 can be tried
    if (GetIsObjectValid(oHench2) && oHench2 != oSelf && GetIsFollower(oHench2) == FALSE)
    {
        oBanter = oHench2;
    }
    else
    // * Henchman 3 can be tried
    if (GetIsObjectValid(oHench3) && oHench3 != oSelf && GetIsFollower(oHench3) == FALSE)
    {
        oBanter = oHench3;
    }

Only firing an interjection or Popup when part of a quest is done etc.


If you only want an interjection to fire if part of a quest has been done, you would need to set a local variable of type int on the module when whatever criteria has been met to allow the pop/interjection to fire.


SetLocalInt(GetModule(), "WHAT_EVER_NAME",1)

Then all you need to do is use something like the below code in the 'OnEnter' script of the XP2 popup/interjection trigger you are using.


void main()
{
    object oEnter = GetEnteringObject();
    if(GetLocalInt(GetModule(), "WHAT_EVER_NAME") == 1 && (GetTag(oEnter) == "HENCH_TAG_HERE"))
    {
        ExecuteScript("x2_evt_trigger", OBJECT_SELF);
    }
}

So what this does is check if a local variable of type int has been set on the module, and if it has then the script will fire when the henchman walks into the trigger and you will get the popup or interjection. If the variable hasn't been set then the script won't fire and no popup will occur.


That should about cover interjections and popups, if you would like to see how they work in a module use the link at the start of the tutorial to download the example module.





 author: Huntsman, editor: Grimlar