HENCHMAN THAT LEVELS UP WITH PC
To make a henchman that levels up with the PC.
You first make a level 1 henchman. It must be level 1. You can give it any feats or anything you want.
In
the conversation where you take the henchman on, you add a little code
to the ActionsTake script where you get the henchman. This will level
up the henchman to your level (or below if you like). The variable
levelsBelowPC is the number of levels below the PC that you want the
henchman to be. The PC level needs to be at least (1+levelsBelowPC).
object pc = GetPCSpeaker();
int pcLev = GetHitDice(pc);
int i;
int levelsBelowPC = 1;
int lev = GetHitDice(OBJECT_SELF);
lev = lev + levelsBelowPC;
for( i=lev; i<pcLev; i++ )
{
LevelUpHenchman( OBJECT_SELF );
}
That will level the henchman up to the level of the PC-1 when you first get them.
Now to keep them leveled up you put some code in the Modules event script for the event OnPlayerLevelUp
object pc = GetPCLevelingUp();
int maxHenchmen = GetMaxHenchmen();
int i;
for( i=1; i<=maxHenchmen; i++ )
{
object hench = GetHenchman(pc, i );
if( GetIsObjectValid(hench) )
{
LevelUpHenchman( hench );
}
}
Every
time the PC levels up any henchmen will also level up. If you drop a
henchman and regain them later the first script will level them up to
the right level and then when you level up again the second script will
keep them at the right level.
Modifié par Mudeye, 24 juin 2011 - 05:40 .