Difference between revisions of "Magic Effects"

3,585 bytes added ,  09:30, 14 November 2011
m
→‎Using Magic Effects in Scripts: rewrote effect code calculation for clarity
imported>Sergelac
(added other formula)
imported>JRoush
m (→‎Using Magic Effects in Scripts: rewrote effect code calculation for clarity)
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__TOC__
== 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 14: Line 16:
**'''Spellmaking:''' Must be checked for the effect to be available in the spellmaker.
**'''Spellmaking:''' Must be checked for the effect to be available in the spellmaker.
**'''Enchanting:''' Must be checked for the effect to be available in the itemmaker.
**'''Enchanting:''' Must be checked for the effect to be available in the itemmaker.
**'''Hostile:''' If checked, placing this effect on another actor is treated the same as hitting him with a weapon. Unless he REALLY likes you, it will start combat.
**'''Hostile:''' If checked, placing this effect on another actor is treated the same as hitting him with a weapon. Unless he REALLY likes you, it will start combat. Potions with all hostile effects are considered poisons (this includes hostile scripted effects).
**'''Detrimental:''' ???
**'''Detrimental:''' Effect is considered detrimental. It is unclear whether this effect has any function in game. It has no bearing on whether a potion is considered a poison.
**'''Recover:''' If checked, when the effect expires the attribute return to their previous state. For example, Drain Attributes has Recover checked, but Damage Attributes does not.
**'''Recover:''' If checked, when the effect expires the attribute return to their previous state. For example, Drain Attributes has Recover checked, but Damage Attributes does not.
**'''Magnitude %:''' The magnitude value is used as a percentage of another value. For example, the Resist effect all have this checked. They reduce damage by a percentage as expressed by this value.
**'''Magnitude %:''' The magnitude value is used as a percentage of another value. For example, the Resist effect all have this checked. They reduce damage by a percentage as expressed by this value.
Line 37: Line 39:
**'''Bolt Sound:''' The sound that travels with the effect object as it moves through the world.
**'''Bolt Sound:''' The sound that travels with the effect object as it moves through the world.
**'''Hit Sound:''' The sound played when the effect hits a target.
**'''Hit Sound:''' The sound played when the effect hits a target.
**'''Area Sound:''' ???
**'''Area Sound:''' ??? possibly the sound played for the 'explosion' for a fireball eg.
*'''Constant Effect Enchantment Factor:''' This value is combined with the base cost and the soul gem size to determine the magnitude of permanent enchantments on armor and clothing. The formula is Power = (SoulGemNumber * Contanst Effect Enchantment Factor * Base Cost) + 5
*'''Constant Effect Enchantment Factor:''' This value is combined with the base cost and the soul gem size to determine the magnitude of permanent enchantments on armor and clothing. The formula is : Power = (SoulGemNumber * Contanst Effect Enchantment Factor * Base Cost) + fMagicCEEnchantMagOffset (5 by default)
or
or
Contanst Effect Enchantment Factor = (Power - 5) / SoulGemNumber / Base Cost
 
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)
*'''Constant Effect Barter Factor:''' This value is used to determine the price of an enchantment on a piece of armor or clothing. The formula is obviously something like GoldCost = Power * CEBarterFactor (* Duration ?)
*'''Constant Effect Barter Factor:''' This value is used to determine the price of an enchantment on a piece of armor or clothing. The formula is obviously something like GoldCost = Power * CEBarterFactor (* Duration ?)
Line 52: Line 56:
*'''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:
1. The editorID of a vanilla effect is "FIDG"
 
2. The ASCII values of the (first) four characters are
      "F" = 70 = 46h
      "I" = 73 = 49h
      "D" = 68 = 44h
      "G" = 71 = 47h
 
3. Re-interpret these values as a 32-bit integer:
      70              46h
    + 73 * 256      + 49h * 100h
    + 68 * 256^2    + 44h * 10000h
    + 71 * 256^3    + 47h * 1000000h
    --------------  ----------------
    1,195,657,542  =    47444946h    =  Effect Code
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 ==
* [[Magic Effects List]]
* [[:Category: Magic Functions - Magic Effect (OBSE)|Magic Effect Functions (OBSE)]]
* [[:Category: Spell Cost|Spell Cost]]


[[Category:Gameplay Menu]]
[[Category:Gameplay Menu]]
[[Category:Magic]]
[[Category:Magic]]
Anonymous user