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 .