Author Topic: Help with Henchman  (Read 2072 times)

Legacy_Xovian

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Help with Henchman
« Reply #15 on: February 07, 2011, 05:52:04 pm »


               

HugoLuman wrote...
The problem is, he won't level up. He is using all the SOU henchman scripts, which the tutorial says should work. Help?

I know this post is a little old, but it gets asked fairly often and thought a full responce would be useful for all.
Like 420 I always run my codes in the OnHeartbeat, though originally I used
the LevelHecnhmanUpTo function as it gave a bit more control, though it
would sometimes use the Commoner package because of the usual
PACKAGE_INVALID. Really wished they had made a PACKAGE _RANDOM function,
but I have found the next best thing. I will post the  Include file Source . Followed by two scripts which I use for Henchman and then regular NPC's repectivly, in the OnHeartBeat of course. I changed the include file some, raised the level before a prestige class is taken (3rd slot), removed harper scout, and made Fighter the default class for invalid (int of -1) instead of the barbarian.

For henchman:


// Level up script for the Henchman's
    // This only works on Henchman of Level 1
    // This level up script fires only once.
int iLevel = GetLocalInt(OBJECT_SELF, "Levelup");//Int that stops the script from fireing more then once
    object oPC = GetMaster();//The Player
   
 if(GetIsObjectValid(oPC) && (iLevel==0))//Check that the player
 is a valid player and that the int is a certain number
      {
       if(GetHitDice(OBJECT_SELF) < GetHitDice(GetMaster()))//HD of henchman compared to master/player
         {
          object oObject = OBJECT_SELF;
          int nHD = GetHitDice(GetMaster()) - GetHitDice(OBJECT_SELF);//HD of master/player compared to henchman
          SetLocalInt(oObject, "nclass1Min", 1);//class minimum for primary class
          SetLocalInt(oObject, "nclass2Min", 0);//Random non-Prestige class.
         
 SetLocalInt(oObject, "nclass3Min", 0);//Random prestige class if
available, normal class chosen if HD/Level is above 24 [u][i][b](source code is 15)[/b][/i][/u][i][/i]
          SetLocalInt(oObject, "nclass1Max", 24);// Max level of primary class
          SetLocalInt(oObject, "nclass2Max", 20);// Max level of secondary class
          SetLocalInt(oObject, "nclass3Max", 16);// Max level of prestige/normal class, provided prestige was available
          SetLocalInt(oObject, "nclass1Prob", 34);//34% probability to level in primary class
          SetLocalInt(oObject, "nclass2Prob", 33);//33% probability to level in alternate class
          SetLocalInt(oObject, "nLevelMax", nHD);//Level max is based on the character who hired them
          while(nHD > 0) // main level loop start
           {
            LevelUp(OBJECT_SELF); //Main level up function
            nHD = nHD-1; //Sets the henchman 1 level below the player, results in Error: "Too Many Instructions" if altered
            break; //Required to prevent "Error: Too Many Instructions"
           }
       }
      ForceRest(OBJECT_SELF); //Causes the Henchman to "instant rest" thus giiving all abilities/spells per day at the ready
      SetLocalInt(OBJECT_SELF, "Levelup", 1);//Stop the script from firing again
      return; //Exit the main script this is held in, namely as part of the onheartbeat so it can restart it's function checks
    }

And last but not least, that for just regular NPC's, also put on the ONHeartBeat script:


// Level up script for the NPC's
    // This only works on Henchman of Level 1
    // This level up script fires only once.
    int iLevel = GetLocalInt(OBJECT_SELF, "Levelup");//Int that stops the script from fireing more then once
    object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);//The Player
    if(GetIsObjectValid(oPC) && (iLevel==0))//Check that the player is a valid player and that the int is a certain number
      {
       if(GetHitDice(OBJECT_SELF) < GetHitDice(oPC))//HD of the NPC compared to master/player
         {
          object oObject = OBJECT_SELF;
          int nHD = GetHitDice(oPC) - GetHitDice(OBJECT_SELF);//HD of master/player compared to NPC
          SetLocalInt(oObject, "nclass1Min", 1);//class minimum for primary class
          SetLocalInt(oObject, "nclass2Min", 0);//Random non-Prestige class.
          SetLocalInt(oObject, "nclass3Min", 0);//Random prestige class if available, normal class chosen if HD/Level is above 24 [u][i][b](source code is 15)[/b][/i][/u][i][/i]
          SetLocalInt(oObject, "nclass1Max", 24);// Max level of primary class
          SetLocalInt(oObject, "nclass2Max", 20);// Max level of secondary class
          SetLocalInt(oObject, "nclass3Max", 16);// Max level of prestige/normal class, provided prestige was available
          SetLocalInt(oObject, "nclass1Prob", 34);//34% probability to level in primary class
          SetLocalInt(oObject, "nclass2Prob", 33);//33% probability to level in alternate class
          SetLocalInt(oObject, "nLevelMax", nHD);//Level max is based on the character who spawned them
          while(nHD > 0) // main level loop start
           {
            LevelUp(OBJECT_SELF); //Main level up function
            nHD = nHD-1; //Sets the henchman 1 level below the player, results in Error: "Too Many Instructions" if altered
            break; //Required to prevent "Error: Too Many Instructions"
           }
       }
      ForceRest(OBJECT_SELF); //Causes the Henchman to "instant rest" thus giiving all abilities/spells per day at the ready
      SetLocalInt(OBJECT_SELF, "Levelup", 1);//Stop the script from firing again
      return; //Exit the main script this is held in, namely as part of the onheartbeat so it can restart it's function checks
    }


Simply put this is one of the easiest ways to get randomly generated henchman
and npc's that ive run across (and modified) provided they are using a
level 1 monster. Even if the monster isnt and can't level up, it only
fires once, so you wont get any problems because it fires constantly. I
take no credit for the include file above, I simply took a page from
420's above script and made it my own for the scripts that i use for the onheartbeat .

Only bad thing, is that there is no de-level script, if you want them to reset because they have been
fired, and become available to other players, they will stay at their
max level and wont go down. They can go up however, provided the fire
script resets the local int.

Hope this helps everyone, enjoy.
 
               
               

               


                     Modifié par Xovian, 09 février 2011 - 12:28 .
                     
                  


            

Legacy_Omega27

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: +0/-0
Help with Henchman
« Reply #16 on: February 13, 2011, 08:23:42 pm »


               Im sorry to barge in on this topic. I my self am having a little issue with my Henchmen.

Just about everything works fine, it also comes down to leveling up.

I have 5 henchmen each using the "multiple henchmen erf"

Using the (set_xp2_henchmen) scripts



[ResRefs]

OnBlocked=x0_ch_hen_block

OnDamaged=x0_ch_hen_damage

OnDeath=x2_hen_death

OnConversation=x0_ch_hen_conv

OnDisturbed=x0_ch_hen_distrb

OnCombatRoundEnd=x0_ch_hen_combat

OnHeartbeat=x0_ch_hen_heart

OnPhysicalAttacked=x0_ch_hen_attack

OnPerception=x0_ch_hen_percep

OnRested=x0_ch_hen_rest

OnSpawn=x0_ch_hen_spawn

OnSpellCast=x2_hen_spell

OnUserDefined=x0_ch_hen_usrdef



I want to know why? or how i can get rid of:

When they level up i end up with copies of them.

I want remove that and im not sure how
               
               

               
            

Legacy_Xovian

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Help with Henchman
« Reply #17 on: February 14, 2011, 12:47:09 am »


               

I want to know why? or how i can get rid of:
When they level up i end up with copies of them.
I want remove that and im not sure how


Are you using a dialog conversation for this event?

With out knowing the actual scripts used to level the henchman up (as there are so many),  I'd have to see the code from "multiple henchmen erf", as I am not familiar with where you likely got that erf from.
               
               

               


                     Modifié par Xovian, 14 février 2011 - 12:48 .
                     
                  


            

Legacy_Omega27

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: +0/-0
Help with Henchman
« Reply #18 on: February 14, 2011, 07:42:18 am »


               Yes i have all hench under conversation control. and umm not to sure on how to get the multiple hench pack in copy/paste format