I’m also going to add the alternative method, this one has less issues, however it requires more work on your part to implement. Instead of creating the shadow copy that will cast the spell for you whenever you use the item, this method will simply use a different function to retrieve the caster level inside the spell script.
Keep in mind that this method is not compatible with the one I posted above, so if you try this route instead, remember to delete the files of the previous method.
You must add the following piece of code at the very bottom of the “x2_inc_spellhook” and SAVE the script.
// Get the level at which this creature cast it's last spell (or spell-like ability)
// Return value on error, or if oCreature has not yet cast a spell: 0;
// This differs from GetCasterLevel, as it will upgrade the caster level of spells cast from items
// to the caster level of the owner, if the spell is known in their spellbook.
// To work properly this requires that the owner stores the caster level in a local variable
// whenever he casts a spell from his spellbook (the spellscript must use this function
// and NOT the standard GetCasterLevel.
// On singleplayer this generally needed only once on multiplayer it might be needed on every relog.
// Do not use outside spell script.
int GetCasterLevelUpgraded(object oCreature)
int nLEVEL = GetCasterLevel(oCreature);
object oITEM = GetSpellCastItem();
if (oITEM == OBJECT_INVALID) SetLocalInt(oCreature, "CASTER_LEVEL", nLEVEL);
int nTYPE = GetBaseItemType(oITEM);
if (nTYPE == BASE_ITEM_POTIONS) return nLEVEL;
else if (nTYPE == BASE_ITEM_ENCHANTED_POTION) return nLEVEL;
if (GetSpellKnown(oCreature, GetSpellId()) == TRUE)
int nTRUE = GetLocalInt(oCreature, "CASTER_LEVEL");
if (nTRUE > nLEVEL)
SendMessageToPC(oCreature, "Caster level upgraded from " + IntToString(nLEVEL) + " to " + IntToString(nTRUE));
nLEVEL = nTRUE;
You now must implement this function by replacing the standard GetCasterLevel, for example, for the magic missile spell the script is “nw_s0_magmiss” at line 52, it needs to be changed to:
int nCasterLvl = GetCasterLevelUpgraded(OBJECT_SELF);
When you’ve done so SAVE and COMPILE the script (if it gives a compilation error, it means you haven’t done properly the first step).
This step has to be repeated for every spellscript you intend to make use of this enhanced caster level when cast from item.
Third Step (In-game):
Now to make this is actually work, you’re gonna have to cast any spell that uses the above function at least once to store a local variable to retrieve the value of your caster level. You will have to recast it when your caster level changes (because you level up, or because you cast a spell from a different class with a lower caster level) or whenever the local variable is erased (for example in multiplayer when you log out).
When you’ve done so, you can now use the item (for example the wand of magic missile) and you should get a message that your casrter level was upgraded if it’s higher than the item caster level.
Potions are still excluded.