Magic Effects

From the Oblivion ConstructionSet Wiki
Revision as of 09:30, 14 November 2011 by imported>JRoush (→‎Using Magic Effects in Scripts: rewrote effect code calculation for clarity)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview[edit | edit source]

Magic effects are a bundle of game effects and visual effects. The are used in spells, powers, abilities, potions & poisons, diseases, and enchantments.

All standard spells incorporate a single magic effect. The player can create custom spells that incorporate multiple effects. A number of the effects are not available as spells, but are used for other game purposes.


  • Editor ID: The ID is hardcoded by the game. You cannot add or remove any of the magic effects.
  • Name: The display name for the effect.
  • School: The skill used to cast this effect.
  • Base Cost: The value used to calculate the casting cost. It is combined with the magnitute, duration, area effect, and type (target vs. touch/self) to determine the cost.
  • Resist value: The effect used to resist the effect. Resist magic always applies to touch and target spells after this resistance effect has been handled.
  • Assoc. Item: For bound item spells and summoning spells, this is the associated item. In the case of actors, the actor must be marked as summonable to appear in this list.
  • Effect Icon: The icon displayed on the HUD and in the user's inventory.
  • Flags: The majority of these are hardcoded and presented on this screen for your information only. A few are editable.
    • 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.
    • 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: 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.
    • 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.
    • FX Persist: If checked, the visual effect on the target persists for the entire duration. Otherwise it only plays once.
    • Self: Is this effect available to be cast on the caster.
    • Touch: Is this effect available to be cast by touch.
    • Target: Is this effect available to be cast at range.
    • No Duration: Is the duration field available in the editor or the spellmaker. For example, Open has no duration option.
    • No Magnitude: Is the magnitude field available in the editor or the spellmaker. For example, Cure Disease has no magnitude option.
    • No Area: Is the area field available in the editor or the spellmaker. For example, the Telekinesis effect has no area option.
    • No Ingredient: Not available in the editor for ingredients.
    • Use Weapon: Set on the bound weapons to indicate that the user's current weapon must be unequipped and the item associated with this effect becomes equipped.
    • Use Armor: Set on the bound armor to indicate that the user's current armor must be unequipped and the item associated with this effect becomes equipped in that slot.
    • Use Creature: Set for the summon effects to indicate that an actor must be placed near the caster and forced to have packages and disposition allegiances so that it will fight for the caster.
    • Use Skill: Allows the editor to display the skill pull down to associate a skill with that use of the effect.
    • Use Attribute: Allows the editor to display the attribute pull down to associate an attribute with that use of the effect.
    • No Recast: Not used.
    • No Hit Effect: No visual effect is played on the target of this effect.
  • Sounds: The sound associated with this effect. Only one sound will play if there is more than one effect in the spell.
    • Casting Sound: The sound played at the caster when he initiates the spell.
    • 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.
    • 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) + fMagicCEEnchantMagOffset (5 by default)

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)

  • 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 ?)
  • Visual effects: If the spell has multiple effects, only the visual effect for the most expensive effect is played.
    • Effects NIF: The file name of the graphic effect played on the caster.
    • Effect shader: Shader used on spell target.
    • Enchantment Effect: The effect played on the item if the effect is an enchament on a weapon or piece of armor.
    • Projectile type: The shape of the projectile for target effects.
    • Projectile speed: A multiplier of the base speed for the projectile.
    • Light: The light object that is carried with the projectile as it moves through the world.
  • Description: Not used.

Using Magic Effects in Scripts[edit | edit source]

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