Any easy way to cast vanilla spells with custom caster level?

Is there an easy way to do it? I’m doing a custom melee/ranged attack script and i have managed to simulate most of the item properties of the weapon/projectile, i can get the spell id, the caster level and the DC if the item property haves one, the problem comes when i need to cast the spell, i’m using ActionCastSpellAtObject and the domain level does nothing.

The easy way that i was thinking was the following:
//oDefender is the Target of the spell
object oPoint = CreateObject(OBJECT_TYPE_CREATURE, “c_invisiblenode” , GetLocation(oDefender));
int nLevelup;
int i;
while(i<=nLvL)//nLvL is the Caster level that i’m retrieving from the itemproperty
nLevelup = LevelUpHenchman(oPoint,CLASS_TYPE_WIZARD);
//nSpellID is retrieved from the itemproperty as well

The problem with this is that it seems that Scripthidden objects can’t cast spell, they can move with the actions functions so i don’t know why the actioncastspell doesn’t works.

The other option that i was thinking was by using a local var that gets deleted after the spell is successfully casted but i would need to edit every single spell script which is something that i want to avoid. Maybe i’m going to go for this option since i’m going to edit almost all of the spells anyway since i’m making a custom class that has some abilities that affect them.


nDomainLevel does nada

so any spells that you want to cast at a particular power, including bCheat spells etc, would have to be custom-scripted …