Jump to content

using applyhavokimpulse on a form type


erratichippo

Recommended Posts

Hello, I am having a little trouble with the script I am writing. The purpose of the script so far is to deflect an arrow that is hitting the caster of the effect. The problem I am having when calling the onHit function is that the projectile variable is of type projectile and I believe I need to use a variable of type ObjectReference when using the havokimpulse function. If anyone could help me get this thing working you would make my day. You would also earn yourself a cookie, that you will go out and buy yourself.

 

Scriptname zWardshield_Improved extends activemagiceffect

 

{Improves the ward shield by allowing it to block arrows.

Also reduces the constant spell cost.}

 

float hitAngle

actor selfRef

Projectile Property Arrow auto

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

selfRef = akCaster

Debug.Notification("Caster reference successful.")

EndEvent

 

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

hitAngle = selfRef.GetHeadingAngle(akAggressor)

Arrow = akProjectile as ObjectReference // I get error message saying cannot cast type projectile to objectreference

if hitAngle >= -90.0 && hitAngle <= 90.0

Debug.Notification("Hit was in front of caster.")

Arrow.ApplyHavokImpulse(1.0, 0.0, 0.0, 50)

endif

Debug.Notification("Hit was not in front of caster.")

EndEvent

Edited by erratichippo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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