Jump to content

Exchange magicka costs to health costs.


JulianXD

Recommended Posts

Unfortunately im not good enough to make it myself, so while im reading into papyrus ill still make this request.

 

The Mod:
The idea is very simple; spellcosts are exchanged completely to health costs. E.g. Flames cost 8 Magicka per second, now cost 8 health per second.

That is all.

Im not sure how the game handels it, but it might be possible to reduce the spell costs just like in vanilla. That would be great too. It also makes every spell potentially kill yourself. Which I think is a nice little twist.

 

PS: The question is not why I would want this mod, since it is somehow retardet, I just want it.

-"But you could use equilibi- stop right there. NO.

 

Thank you for constructive feedback and your time.

 

Event OnEffectStart

akCaster.DamageAV("Health", SpellCost)

End Event

Edited by JulianXD
Link to comment
Share on other sites

There's an OnSpellCast event that gives you the spell being cast which you can hook while your mod's effect is active. From there you can use SKSE to get the effective magicka cost. Using that information, just restore magicka by that amount and damage health by the same amount. I'm sure there will be nuances to really flesh out the process (since the spell given to you could be an enchantment or potion as well), but that's the core mechanic I'd set up for a first draft.

 

p.s. Don't use the short version of methods (eg. DamageAV instead of DamageActorValue). Method calls are slow, and the short forms do nothing more than call the long form. So a single call invokes two methods when it's completely unnecessary. Using the long forms exclusively is a key script optimization technique.

Link to comment
Share on other sites

You can play around with spell cost reductions using a perk. You can do that with the spell magnitude as well. Generally, one should attempt to do what they want with what the CK can offer first before relying on scripting. In your case though, the scripting method would be easier, as the CK offers no native way to get spell magnitudes and spell cost(or even duration.). Note for spells like Flames, OnSpellCast will fire only once.

 

I don't have a lot of time, so this is a quick untested code:

Event OnSpellCast(Form akSpell)
Spell thisSpell = akSpell as Spell

; bail if for some weird reason the spell is none
if thisSpell

    ; get the magnitude of this spell. Requires SKSE. 
    Float fMagnitude = thisSpell.GetNthEffectMagnitude(0)
 
    ; spell may or may not have a magnitude
    if fMagnitude != 0.0
        (GetReference() as Actor).RestoreActorValue("health", fMagnitude)
    endif

endif

EndEvent

Btw, OnSpellCast needs to be attached to the player via quest alias.

 

Note: There's a possibility, GetNthEffectMagnitude might not be viable for all spells, if their main effect for damage is not the first effect. This is hard to account for blindly and would take researching all the spells.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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