Difference between revisions of "GetSpellMasteryLevel"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
(MI)
imported>Wrye
(Getting value for autocalculated spells.)
 
(One intermediate revision by one other user not shown)
Line 12: Line 12:
   3:    Expert
   3:    Expert
   4:    Master
   4:    Master
==Auto Calculated Spells==
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 Also==
==See Also==
Line 21: Line 39:
[[Category: Magic Functions (OBSE)]]
[[Category: Magic Functions (OBSE)]]
[[Category: Magic Functions - Magic Item (OBSE)]]
[[Category: Magic Functions - Magic Item (OBSE)]]
[[Category: Record Variable Functions]]
[[Category: Record Variable Functions (OBSE)]]

Latest revision as of 02:27, 8 July 2008

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 Spells[edit | edit source]

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 Also[edit | edit source]