erratichippo Posted September 15, 2012 Share Posted September 15, 2012 (edited) 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 hitAngleactor selfRefProjectile 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) endifDebug.Notification("Hit was not in front of caster.")EndEvent Edited September 15, 2012 by erratichippo Link to comment Share on other sites More sharing options...
erratichippo Posted September 15, 2012 Author Share Posted September 15, 2012 (edited) Nevermind figured it out. Edited September 15, 2012 by erratichippo Link to comment Share on other sites More sharing options...
Recommended Posts