Jump to content

FeedbackSpell


mgb519

Recommended Posts

I was looking into skyrim modding, and I thought it would be cool if there was a sort of spell that dealt damage to enemies based on their own magicka usage.

As I lack experience, it didn't work and resulted in a CTD.

I was implementing it as a concentration spell, so that as long as the player kept casting it the npc would continue to take damage.

So I set up an active magic effect as follows:

Scriptname ManaBurnEffect extends activemagiceffect Hidden 

Float lastMagickaValue
Event OnEffectStart(Actor akTarget, Actor akCaster)
	lastMagickaValue = akTarget.GetActorValue("Magicka")
EndEvent

Event OnUpdate()
	GetTargetActor().DamageAV("Magicka", (lastMagickaValue - GetTargetActor().GetActorValue("Magicka")))
	GetTargetActor().DamageAV("Health",   (lastMagickaValue - GetTargetActor().GetActorValue("Magicka"))*100)
	lastMagickaValue = GetTargetActor().GetActorValue("Magicka")
EndEvent

Does anything seem suspect here, or should I look elsewhere for the problem?

Edited by mgb519
Link to comment
Share on other sites

I don't know how to mess with concentration spells, so I can't help you there... but I did create and test a Feedback spell. My spell was targeted, and caused the hit target to cast another spell that actually had the effect that caused them to take damage when they cast spells (this was just the way my mind went to straight away after reading your post, could probably be done easier/differently). Here's the scripts I came up with:

 

  Reveal hidden contents

DarkxEffectFeedbackScript was on the targeted spell, DarkxEffectManaBurnScript on the spell that applies the damaging effect. I did things this way so I could test things easier (I added the ManaBurn spell and the Feedback spell to my spellbook, then cast each to test their effects).

EDIT: I included comments in the scripts to explain what they were doing, hopefully ensuring you understood them properly and could use them as reference for what to do with your own.

Edited by Darkxenoth
Link to comment
Share on other sites

 

  Reveal hidden contents

Taking another look at your initial post, I wanted to give my thoughts...

One thing to note: as posted, your script doesn't actually cause the target to take damage when they cast a spell necessarily... you have it scripted to cause damage to their magicka, then damage their health based on the difference between their current magicka and the amount they had when you first started hitting them with your spell, thus it causes damage to them regardless of whether they cast a spell or not because you're already damaging their magicka. In other words, if you only wanted it to cause damage to them if THEY cast a spell you would need to remove the line that causes damage to their magicka to ensure it only changes when they, themselves, cast a spell.

Oh, and if you leave it multiplying the difference between their initial magicka and current magicka by 100 then it is going to do RIDICULOUS amounts of damage. Even if they only cast a spell that costs 5, that's already 1000 damage as you have it; seeming as you have it scripted to cause damage to their magicka equal to the difference in their initial magicka and current magicka (which, in theory, should basically amount to making their magicka be used twice for any spell they cast) - 5 magicka cost spell = 10 magicka difference during the line that damages health, thus 1000 damage.

Edited by Darkxenoth
Link to comment
Share on other sites

Try this:

 

  Quote

 

Float lastmagickavalue

Actor Victim

 

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

 

lastmagickavalue .....................

 

Victim = akTarget

RegisterForSingleUpdate(1.0)

EndEvent

 

 

Event OnUpdate()

 

Victim.DamageAV ..............................

Victim.DamageAV .............................

 

RegisterForSingleUpdate(1.0)

 

EndEvent

Link to comment
Share on other sites

Well, that worked. As implemented now:

 

  Reveal hidden contents

 

Out of curiosity, what's the update rate for a vanilla concentration spell?

Link to comment
Share on other sites

I figured it had to be smaller than that since the health bar drains pretty continuously when you're using flames. Setting the update rate to 1 second didn't seem to work the same.
In other news, would it be possible to make a concentration spell that is a ritual spell (2 hands) and casts over a radius the way firestorm does, but is still a concentration spell that you have to keep channeling?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...