The debugging results are:
Class: 255
Caster level: 0
Upon further testing with lower level spellcasters it seems the same results are occuring. They get the highest level summon and its always the mummy regardless of class or level.
I've reverted to my old script using your initial suggestion to count the palemaster levels and it works perfectly. I also was able to use what I saw in your script to make my Dragon Knight spell add half of the palemaster levels as well! So at least I have them functional if not elegant.
This suggests that your epic spells are being cast through items. Nothing wrong with that, you just need to delete the item cast lines I provided.
if(GetIsObjectValid(oItem))
{
nCasterLevel = GetCasterLevel(OBJECT_SELF);
nClass = CLASS_TYPE_INVALID;
}
Also if 005 is your highest summon, and not a default for being cast from an unknown source then I would suggest the following revision
#include "prc_alterations"
#include "x2_inc_spellhook"
#include "inc_epicspells"
void main()
{
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_NECROMANCY);
/*
Spellcast Hook Code
Added 2003-06-20 by Georg
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more
*/
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
if (GetCanCastSpell(OBJECT_SELF, MUMDUST_DC, MUMDUST_S, MUMDUST_XP))
{
//Declare major variables
int nDuration = 24;
//effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
effect eSummon;
//NC:EDIT
// Add check for druid for different summon
//KA: EDIT
// Add summon scaling every five levels and allowed ALL Palemaster levels
// to be counted towards caster level for the spell.
int nClass = GetLastSpellCastClass();
int nCasterLevel = GetLevelByClass(nClass);
object oItem = GetSpellCastItem();
string sSummon = "s_morglord_001";
switch (nClass)
{
case CLASS_TYPE_WIZARD:
case CLASS_TYPE_SORCERER:
case CLASS_TYPE_BARD:
nCasterLevel += GetLevelByClass(CLASS_TYPE_PALEMASTER);
break;
case CLASS_TYPE_PALEMASTER:
if(GetLevelByClass(CLASS_TYPE_WIZARD) > GetLevelByClass(CLASS_TYPE_SORCERER))
nCasterLevel += GetLevelByClass(CLASS_TYPE_WIZARD);
else
nCasterLevel += GetLevelByClass(CLASS_TYPE_SORCERER);
break;
}
int iEpicIndex = (nCasterLevel - 15)/5;
if(iEpicIndex > 5)
iEpicIndex = 5;
if(iEpicIndex < 1)
iEpicIndex =1;
switch(nClass)
{
case CLASS_TYPE_WIZARD:
case CLASS_TYPE_SORCERER:
case CLASS_TYPE_CLERIC:
case CLASS_TYPE_PALEMASTER:
sSummon = "s_morglord_00" + IntToString(iEpicIndex);
break;
case CLASS_TYPE_DRUID:
sSummon = "s_treant_00" + IntToString(iEpicIndex);
break;
}
//NC:EDIT
//Summon the appropriate creature based on the summoner level
//Warrior Mummy
//NC:EDIT
//Treant Druid only
eSummon = EffectSummonCreature(sSummon,496,1.0f);
//NC:EDIT
eSummon = ExtraordinaryEffect(eSummon);
//Apply the summon visual and summon the undead.
//ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetSpellTargetLocation());
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, GetSpellTargetLocation(), HoursToSeconds(nDuration));
}
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
// Getting rid of the local integer storing the spellschool name
}