Fully scripted spell - Problem with Wards

Post » Wed Jun 20, 2012 6:54 am

Just purely as a concept i wanted to try and create a spell which increased damage based on player level and skill.

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
User avatar
Toby Green
 
Posts: 3365
Joined: Sun May 27, 2007 5:27 pm

Post » Wed Jun 20, 2012 6:13 am

Well the reason why this does not work on wards is because wards "accumulate magnitude", and the scripted spell has no magnitude and therefore does not damage the ward.

I can't think of a way tieing the event to the fireball spell being cast would work, purely because there is no way the script running on the caster of the fireball would know what the caster is hitting.
You could try giving your fireball another magic effect, one that is not "hostile". Presumably, that should bypass the ward. You can then let that effect check whether a ward is active.
I have no idea if there is any way to "damage" the ward though. From what I know of the CK, it's very likely that what you are trying to do is impossible...
User avatar
Rachel Cafferty
 
Posts: 3442
Joined: Thu Jun 22, 2006 1:48 am

Post » Wed Jun 20, 2012 6:27 pm

Thanks Cronos, i'll give that a try
User avatar
K J S
 
Posts: 3326
Joined: Thu Apr 05, 2007 11:50 am


Return to V - Skyrim