Jump to content

Casting spell on self on hit


Recommended Posts

I made a small mod about a year and a half ago to make it so if someone with a bow equipped it struck, they are staggered to interrupt their shot. (I really wanted it to do it when the bowstring was drawn, but couldn't figure out how and felt the bow being equipped was sufficient at the time.)


Anyway, now I'm trying to port it over to SE and realized three things:


  1. I don't have the files I originally used
  2. I was dumb and didn't upload the scripts to Nexus Mods along with the ESP (No wonder nobody else could get it to work... derp)
  3. I must have got lucky to get it to work in the first place because I can't figure it out now

I verified the setup for dynamically attaching scripts described here http://forums.bethsoft.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/.


On each Reference Alias I have the following script



Scriptname Interrupt_Archers_Stagger_OnHit extends ReferenceAlias

Spell Property Interrupt_Archers_Stagger Auto

EVENT OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

Actor thisActor = Self.GetActorReference()

if (thisActor.GetEquippedItemType(0) == 7) ; 7 is a bow
Interrupt_Archers_Stagger.Cast(thisActor)
endif

ENDEVENT

Here's the spell and the associated effect:


Spell: http://i.imgur.com/ta1MJb0.png


Effect: http://i.imgur.com/BYkBmZU.png



The script on the Effect was an attempt at displaying a message upon its activation, but it just never happens. If I replace the 'Cast' line with 'Debug.Notification("Hit!")' I get the message. So I know at least that much is working.


I'm not sure what I'm missing. I've tried adding the spell to the actor before casting it and removing it after, but that didn't seem to help and I don't recall doing that previously.


Any help would be greatly appreciated.


Link to comment
Share on other sites

  • Recently Browsing   0 members

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