My starting point for this was a Firebolt Spell. As usual i duplicated the standard FireBolt spell and related magic effect.
I then applied the following script to the magic effect
Spoiler
Scriptname FireBoltLevelledDamageScript extends ActiveMagicEffect{Increases Firebolt damage based on player level and the player's Destruction Skill}Actor Property Player Auto HiddenSpell Property FireBoltLevelled AutoFloat MagResFloat FireResFloat PLevelFloat SkLevelFloat DmgFloat MagCost;EVENTS----------------------------------------------------------------------------EVENT onEffectStart (Actor akTarget, Actor akCaster)MagCost = 40player = akCasterPLevel = Player.GetLevel() ; Players level debug.notification("Level = " +PLevel) FireRes = akTarget.GetActorValue("FireResist") ; Targets Fire resistance debug.notification("Target Fire Res =" +FireRes) MagRes = akTarget.GetActorValue("MagicResist") ; Targets magic resistance debug.notification("Targets MagicResist =" + MagRes) SkLevel = player.GetActorValue("Destruction") ; Players Destruction skill debug.notification("Destruction Level = " + SkLevel) Dmg = ((PLevel*1.25)+(SkLevel*0.5)); Alter these numbers to adjust damage ;Checks to see if the target has Magic Resist and Fire Resistif (MagRes > 0) && (FireRes > 0) akTarget.DamageActorValue("Health", (Dmg*(1-(MagRes/100))*(1-(FireRes/100)))) debug.notification("Damage minus All Resistances " + (Dmg*(1-(MagRes/100))*(1-(FireRes/100)))) ;Checks to see if the target has only Fire Resist elseif (MagRes == 0) && (FireRes > 0) akTarget.DamageActorValue("Health", (Dmg*(1-(FireRes/100)))) debug.notification("Damage minus FireResistance " + (Dmg*(1-(FireRes/100)))) ;Checks to see if the target has only Magic Resist elseif (MagRes > 0) && (FireRes == 0) akTarget.DamageActorValue("Health", (Dmg*(1-(MagRes/100)))) debug.notification("Damage minus MagicResistance " + (Dmg*(1-(MagRes/100)))) ;Target has no resistance to Magic of Fire else akTarget.DamageActorValue("Health", Dmg) debug.notification("Damage =" +Dmg) EndifEndEvent When tested this worked, damage increased based on player level and the destruction skill. Damage decreased accordingly if the target had magic resist and/or fire resist.
The problem that i had occurred when i tested this against a target with a ward spell active.
The issue is the ward spell prevents the effect being applied, therefore preventing any damage to take place.
The problem that i am having is being able to detect if the target is affected by a ward spell.
What i need the spell to do, is when the spell is cast is to check the target for a magic ward effect and and damage the ward accordingly.
I have tried using on an OnSpellCast event
Spoiler
Event OnSpellCast (Form akSpell)akSpell = FireBoltLevelled player.OnSpellcast(FireBoltLevelled) debug.notification("MagCost " + (MagCost-(0.32*SkLevel))) debug.trace("MagCost " + (MagCost-(0.32*SkLevel))) EndEvent This was used purely as a test to see if the Spell cast would "fire", but this doen't work or show any errors in the log. I suspect OnSpellCast doesn't work because it relates to the ObjectReference script. However a script which would extend the ObjectReference can not bind to a magic effect
Any suggestions would be greatly appreciated
