Author Topic: Conditional henchmen count in convo?  (Read 321 times)

Legacy_Grymlorde

  • Sr. Member
  • ****
  • Posts: 362
  • Karma: +0/-0
Conditional henchmen count in convo?
« on: February 11, 2014, 11:47:57 pm »


               I want a potential henchman to decline the PC's offer of employment if the PC has the maximum amount of henchmen allowed by their charisma.

However I want to have the maximum number of henchmen set for each PC based on their charisma rather than module-wide (just like in AD&D).

In the OnClientEnter script, I added a section that sets a local integer, MAX_HENCH based on the PC's charisma (3 modified by Charisma).

What I can't figure out is how to write the conditional Text Appears When script that counts the number of henchmen the PC has and compares it to their MAX_HENCH local integer.

Here is as far as I get:

int StartingConditional()
{
object oPC = GetPCSpeaker();
GetLocalInt (oPC, "MAX_HENCH");
}

Any help is greatly appreciated!
               
               

               


                     Modifié par Grymlorde, 11 février 2014 - 11:49 .
                     
                  


            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Conditional henchmen count in convo?
« Reply #1 on: February 12, 2014, 12:30:30 am »


               The lexicon page for GetHenchman has a routine for counting the number of hechpeople on the PC:

http://www.nwnlexico...tle=GetHenchman

Then something like this in your starting conditional (assuming you want this to return TRUE if the PC is
at the limit and not the other way around):

int nMax = GetLocalInt(oPC, "MAX_HENCH");
if (GetNumHenchmen(oPC) >= nMax))
                   return TRUE;

return FALSE;


Cheers,
meaglyn
               
               

               
            

Legacy_Grymlorde

  • Sr. Member
  • ****
  • Posts: 362
  • Karma: +0/-0
Conditional henchmen count in convo?
« Reply #2 on: February 12, 2014, 08:51:48 pm »


               

meaglyn wrote...

The lexicon page for GetHenchman has a routine for counting the number of hechpeople on the PC:

http://www.nwnlexico...tle=GetHenchman

Then something like this in your starting conditional (assuming you want this to return TRUE if the PC is
at the limit and not the other way around):

int nMax = GetLocalInt(oPC, "MAX_HENCH");
if (GetNumHenchmen(oPC) >= nMax))
                   return TRUE;

return FALSE;


Cheers,
meaglyn


Thanks a lot Meaglyn! I knew it was something simple but I got hung up on counting the henchmen. I couldn't get the GetNumHenchmen function to work so instead I used X2_GetNumberOfHenchmen and it worked fine:

//::///////////////////////////////////////////////
//:: hen_party_full
//::///////////////////////////////////////////////
/*
    Returns true if there is no room in the party
    for another based on the HenchMax local integer
*/
//:://////////////////////////////////////////////
//:: Created By: Grymlorde
//:: Created On: February 11, 2014
//::
//:: Assisted By: Meaglyn
//:: Modified On: February 12, 2014
//:://////////////////////////////////////////////
 
#include  "x0_i0_henchman"
int StartingConditional()
{
    object oPC = GetPCSpeaker();
    int nMax = GetLocalInt(oPC, "MAX_HENCH");
 
    if ((X2_GetNumberOfHenchmen(oPC) >= nMax))
 
        return TRUE;
 
  return FALSE;
}

               
               

               


                     Modifié par Grymlorde, 12 février 2014 - 08:52 .