Jump to content

[LE] Blood Magic....where does the Spell end casting.


AslanKebab

Recommended Posts

Hello, Everyone

 

So, I´m making a spell that temporarily rewires all spell´s consumption to the player´s health. Now the script works for the Fire and Forget spells. However, OnSpellCast() is unable to track Concentration spells as it only fires once when the spell starts.

criptname BloodCommutation extends activemagiceffect 

Actor Property PlayerREF Auto
float preCastMP

Event OnEffectStart(Actor akActor, Actor akCaster)
	RegisterForUpdate(0.1)

    preCastMP = PlayerRef.GetActorValue("Magicka")
	EndEvent

Event OnSpellCast(Form Spell)
	HPtoMPConversion()
EndEvent

Event OnUpdate()

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	  UnregisterForUpdate()
EndEvent


Function HPtoMPConversion()
	Float currentMP = PlayerREF.GetActorValue("Magicka");
	Float MPDiff = preCastMP - currentMP;

	PlayerREF.DamageActorValue("Health", MPDiff);
	PlayerREF.RestoreActorValue("Magicka", MPDiff);

	EndFunction

I know that I could potentially make use of OnUpdate() for this, but how do I track when the spell casting stops?

 

Is there any way to detect when Magicka consumption starts and stops while converting it to health consumption at once for example?

 

I´ve seen the suggestion Keywording every Concentration spell...which would not be optimal.

 

Also, SKSE is not being used for this spell mod.

 

I appreciate any suggestions.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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