Jump to content

Help getting an aimed magic effect or staff to drain your Magicka on use


link182

Recommended Posts

Note: sorry for cluttering this forum with a second request, I managed to find a way around my last issue and with this I don’t really know where else to turn.

I assumed it would be straightforward to have a staff drain your magicka when you cast a fireball spell, and boy have I learned how wrong I was.

 

It’s become clear that a magic effect that isn’t on self cannot see itself being activated unless you actually hit a target, meaning when you miss you’ll not lose any magicka (or in my case stamina too)

 

I spent 4 hours learning that, and then realised that means it’s even harder to find a solution for staffs to cost Magicka. I’m really not sure what to do here, it’s sort of essential to the mod I’ve been working on for over a month that this fireball spell drains your own stamina and Magicka in massive prepositions on cast, can anyone think of a way to do this from a staff? I’m out of ideas.

 

 

Link to comment
Share on other sites

Are you using SKSE? If so you can use my mod Dylbill's Papyrus Functions which includes DbSkseEvents. https://www.nexusmods.com/skyrimspecialedition/mods/65410?tab=posts&jump_to_comment=147667121 

Something like this: 

Enchantment Property StaffEnchFireball Auto
weapon property StaffFireball auto
 
Event Oninit()
    PlayerRef.AddItem(StaffFireball)
    PlayerRef.EquipItem(StaffFireball)
   
    DbSkseEvents.RegisterFormForGlobalEvent("OnActorSpellFireGlobal", Self, StaffFireball, 1) ;compare StaffFireball with 'Source'. Register for when any actor fires a spell from the StaffFireball.
 
    DbSkseEvents.RegisterFormForGlobalEvent("OnHitGlobal", Self, StaffEnchFireball, 2) ;compare StaffEnchFireball with 'Source'. Register for when anything is hit with a StaffEnchFireball enchantment.
EndEvent
 
Event OnActorSpellFireGlobal(Actor Caster, Form Source, int slot)
    Debug.MessageBox("Caster = " + Caster.getDisplayName() + " " + Caster + "\nSource = " +  Source.GetName() + " " + Source + "\nslot = " + slot)
Endevent
 
Event OnHitGlobal(ObjectReference Attacker, ObjectReference Target, Form Source, Ammo akAmmo, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
    Debug.MessageBox("Attacker = " + Attacker.getDisplayName() + " " + Attacker + "\nTarget = " + Target.GetDisplayName() + " " + Target + "\nSource = " + \
    Source.GetName() + " " + Source + "\nAmmo = " + akAmmo.getName() + " " + akAmmo + "\nProjectile = " + akProjectile.getName() + " " + akProjectile)
EndEvent

 

If you're not using skse, it may be possible to use an animation event.

Link to comment
Share on other sites

4 hours ago, dylbill said:

Are you using SKSE? If so you can use my mod Dylbill's Papyrus Functions which includes DbSkseEvents. https://www.nexusmods.com/skyrimspecialedition/mods/65410?tab=posts&jump_to_comment=147667121 

Something like this: 

Enchantment Property StaffEnchFireball Auto
weapon property StaffFireball auto
 
Event Oninit()
    PlayerRef.AddItem(StaffFireball)
    PlayerRef.EquipItem(StaffFireball)
   
    DbSkseEvents.RegisterFormForGlobalEvent("OnActorSpellFireGlobal", Self, StaffFireball, 1) ;compare StaffFireball with 'Source'. Register for when any actor fires a spell from the StaffFireball.
 
    DbSkseEvents.RegisterFormForGlobalEvent("OnHitGlobal", Self, StaffEnchFireball, 2) ;compare StaffEnchFireball with 'Source'. Register for when anything is hit with a StaffEnchFireball enchantment.
EndEvent
 
Event OnActorSpellFireGlobal(Actor Caster, Form Source, int slot)
    Debug.MessageBox("Caster = " + Caster.getDisplayName() + " " + Caster + "\nSource = " +  Source.GetName() + " " + Source + "\nslot = " + slot)
Endevent
 
Event OnHitGlobal(ObjectReference Attacker, ObjectReference Target, Form Source, Ammo akAmmo, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
    Debug.MessageBox("Attacker = " + Attacker.getDisplayName() + " " + Attacker + "\nTarget = " + Target.GetDisplayName() + " " + Target + "\nSource = " + \
    Source.GetName() + " " + Source + "\nAmmo = " + akAmmo.getName() + " " + akAmmo + "\nProjectile = " + akProjectile.getName() + " " + akProjectile)
EndEvent

 

If you're not using skse, it may be possible to use an animation event.

Sadly I can’t use Skse since I’m also making this for Xbox. I’m not experienced with animation events, how would that work exactly?

Link to comment
Share on other sites

Here is an example for animation events. Listen for when the staff is equipped, find which hand it's equipped in then register for the appropriate animation event. Also unregister for the event when the staff is unequipped. Here's all the animation events fyi. https://ck.uesp.net/wiki/Animation_Events

Event Oninit()
    RegisterForAnimationEvent(PlayerRef, "MRh_SpellFire_Event") ;for right hand
    RegisterForAnimationEvent(PlayerRef, "MLh_SpellFire_Event") ;for left hand
EndEvent
 
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
    Debug.MessageBox("akSource = " + akSource + \
                     "\nEvent = " + asEventName)
EndEvent
Link to comment
Share on other sites

37 minutes ago, dylbill said:

Here is an example for animation events. Listen for when the staff is equipped, find which hand it's equipped in then register for the appropriate animation event. Also unregister for the event when the staff is unequipped. Here's all the animation events fyi. https://ck.uesp.net/wiki/Animation_Events

Event Oninit()
    RegisterForAnimationEvent(PlayerRef, "MRh_SpellFire_Event") ;for right hand
    RegisterForAnimationEvent(PlayerRef, "MLh_SpellFire_Event") ;for left hand
EndEvent
 
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
    Debug.MessageBox("akSource = " + akSource + \
                     "\nEvent = " + asEventName)
EndEvent

Thanks a bunch for this, think I have a good idea which direction to go in now, I’ll be sure to post how it goes.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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