I've been working on a set of quests that scale to the level of the PC. However, I ran into a problem with the "boss" NPC which is a wizard. At lower levels he works just fine but once he gets up into the higher levels he stops attacking.
The reason for this is the Invisibility spell. Apparently the default AI won't attack if it has the Indivisibility effect on it because that would make the Invisibility wear off. Unfortunately this means that you can pound on him all day and he will never attack, especially at level 40 where Invisibility lasts for 40 minutes.
The fix for this is to simply put this bit of code in the NPC's heartbeat.
void main()
{
effect eEffect = GetFirstEffect(OBJECT_SELF);
while(GetIsEffectValid(eEffect))
{
if(GetEffectType(eEffect) == 56)
{
RemoveEffect(OBJECT_SELF, eEffect);
}
eEffect=GetNextEffect(OBJECT_SELF);
}
}
After banging my head on this for a week and I can finally get back to finishing up the quests.
-420