GetSpellMasteryLevel

Revision as of 02:27, 8 July 2008 by imported>Wrye (Getting value for autocalculated spells.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A command for Oblivion Script Extender

Syntax:

(masteryLevel:short) GetSpellMasteryLevel spell:ref

Returns the mastery level of the spell.

Spell Mastery Level:
 0:    Novice
 1:    Apprentice
 2:    Journeyman
 3:    Expert
 4:    Master

Auto Calculated SpellsEdit

The function returns the statically assigned spell mastery level -- which may not be accurate for autocalculated spells. (And in particular, it is very likely to be wrong for player created spells.) To get the correct mastery level for any given spell, you'll need to check the cost against the spell mastery settings.

   set cost to getSpellMagickaCost rSpell
   if isMagicItemAutoCalc rSpell == 0
       set level to getSpellMasteryLevel rSpell
   elseif cost < fMinApprentice
       set level to 0
   elseif cost < fMinJourney
       set level to 1
   elseif cost < fMinExpert
       set level to 2
   elseif cost < fMinMaster
       set level to 3
   else
       set level to 4
   endif

Where fMinApprentice etc. are set from FMagicSpellLevelMasterMin game settings. Be sure to use getGS to get the settings, since mods may change from the default values.

See AlsoEdit