Here are a couple of scripts for leveling up henchmen.
I level them up to the same level as the PC. If you want them to be 2 levels lower
OnPCLevelUp then change: while( hlvl < mlvl && hlvl!=0 )
to be: while( hlvl < mlvl - 2 && hlvl!=0 )
in the second script. All henchmen must start out as level 1.
When you add them they level up to match the PC. You can set a local string on the NPC to a class package id and that will be used for leveling the henchman instead of the default if you want.
void main()
{
object pc = GetPCLevellingUp();
int mxHench = GetMaxHenchmen();
int i;
object hench;
int lvl=0;
for( i=0; i<mxHench; i++ )
{
hench = GetHenchman( pc, i+1 );
//look for a levelclass id on the henchman if it has been set
//it will be a package name for leveling
int cls = GetLocalInt( oHenchman, "levelclass");
//if it wasn't set then we just use the invalid which uses default class
if( cls == 0 )
{
cls = class_TYPE_INVALID;
}
if( hench != OBJECT_INVALID )
{
lvl = LevelUpHenchman( hench, cls );
//you can put tests here to make sure the henchman leveled up.
}
}
}
Below is the add henchman script that I used for actions taken when you take on a henchman.
It goes in the conversation as the ActionsTaken script
#include "NW_I0_GENERIC"
#include "x0_i0_assoc"
void main()
{
object oSpeaker = GetPCSpeaker();
object oHenchman = OBJECT_SELF;
AddHenchman(oSpeaker, oHenchman);
//flag to remember that this NPC was once a henchman
string hname = GetTag( OBJECT_SELF ) + "washench";
SetLocalInt( oSpeaker, hname, 1 );
//set the desired NPC behaviors
SetAssociateState(NW_ASC_DISTANCE_2_METERS, TRUE);
SetAssociateState(NW_ASC_DISTANCE_4_METERS, FALSE);
SetAssociateState(NW_ASC_DISTANCE_6_METERS, FALSE);
SetAssociateState(NW_ASC_MODE_DEFEND_MASTER);
//level up the henchman
int i;
int mlvl=0;
int nlvl = 0;
mlvl = GetHitDice(oSpeaker);
nlvl = GetHitDice(oHenchman);
int hlvl= GetHitDice(oHenchman);
//look for a levelclass id on the henchman if it has been set it will be a package name for leveling
int cls = GetLocalInt( oHenchman, "levelclass");
//if it wasn't set then we just use the invalid which goes to the default class
if( cls == 0 )
{
cls = class_TYPE_INVALID;
}
//now level up the henchman in the specified class
while( hlvl < mlvl && hlvl!=0 )
{
hlvl = LevelUpHenchman( oHenchman, cls );
}
}
Modifié par Mudeye, 09 octobre 2010 - 05:58 .