Difference between revisions of "Magic Effects"
Jump to navigation
Jump to search
Added section on usage in scripts
imported>Draghi001 |
imported>JRoush (Added section on usage in scripts) |
||
Line 1: | Line 1: | ||
== Overview == | |||
Magic effects are a bundle of game effects and visual effects. The are used in spells, powers, abilities, potions & poisons, diseases, and enchantments. | Magic effects are a bundle of game effects and visual effects. The are used in spells, powers, abilities, potions & poisons, diseases, and enchantments. | ||
Line 41: | Line 42: | ||
or | or | ||
Constant Effect Enchantment Factor = (Power - 5) / SoulGemNumber / Base Cost | |||
(SoulGemNumber: 1 for Petty, 2 for Lesser, 3 for Commmon, 4 for Greater and 5 for Grand) | (SoulGemNumber: 1 for Petty, 2 for Lesser, 3 for Commmon, 4 for Greater and 5 for Grand) | ||
Line 53: | Line 54: | ||
**'''Light:''' The light object that is carried with the projectile as it moves through the world. | **'''Light:''' The light object that is carried with the projectile as it moves through the world. | ||
*'''Description:''' Not used. | *'''Description:''' Not used. | ||
== Using Magic Effects in Scripts == | |||
Magic Effects are forms, and like all other forms they have an editorID. This is the string you see listed in the left column of the EffectSetting dialog ("FIDG","SEFF",etc.). | |||
You can assign it to a ref variable and manipulate it just like any other form: | |||
let refvar := FIDG | |||
SetName "New Fire Damage Name", refvar | |||
Many (most?) commands expect magic effects by form reference. You can pass the '''unquoted''' editorID, or assign it to a ref variable and pass that instead: | |||
HasMagicEffect FIDG | |||
;; these two methods are identical | |||
let refvar := FIDG | |||
HasMagicEffect refvar | |||
Any time you see "effect:chars" or "effect:ref" in an OBSE command description, it is asking for a form reference. For most magic effect commands, this is the version that doesn't end in "C". | |||
Now, for the caveat. Magic Effects are hard-coded into the engine, but are not given hard-coded formIDs. '''The formID of a magic effect is set by the first plugin to modify it'''. Most magic effects are given formIDs in Oblivion.esm, but not all of them. And if you don't use Oblivion.esm as a master, then the formID of an effect is undefined. | |||
Magic Effects have their own set of integer "effect codes". This code is '''not shown anywhere''' in the CS. Unlike formIDs, effect codes can reliably identify an effect regardless of what master plugins you are using. Any time you see "effect:int" in an OBSE command description, it is asking for a literal integer or long variable containing the effect code. | |||
Many OBSE magic effect commands have secondary forms that accept the effect code rather than a form reference, these are the versions that end in "C". | |||
Now, the confusing part. The effect code for vanilla effects isn't just an arbitrary integer. It is the ASCII representation of the first four characters of the editorID, interpreted as an integer. For example: | |||
editorID = "FIDG" | |||
effect code = 70 + (73 * 256) + (68 * 256^2) + (71 * 256^3) = 1,195,657,542 ;; "F" = 70, "I" = 73, "D" = 68, "G" = 71 | |||
The devs probably did this for readability while debugging. It's handy, because it means that you can easily get the (vanilla) effect codes from their editorID strings. In fact, since the codes are not shown in the CS, this is the ''only'' way to get the effect code. OBSE provides commands to do this automatically: | |||
let longvar := MagicEffectCodeFromChars "FIDG" ;; returns 1,195,657,542 | |||
let refvar := MagicEffectFromChars "FIDG" ;; *reliably* returns a form reference to fire damage effect | |||
Any time you see "effect:String" in an OBSE command description, it is asking for a 4 character ASCII string representing the effect code. For vanilla effects, this just the editorID in quotes. | |||
== See Also == | == See Also == |