Toaster2a Posted August 14, 2012 Share Posted August 14, 2012 Ok Folks, I need some help. I've been bound and determined I could work this out. But too many sleepless nights, have proven otherwise.What I am trying to do, is similar to the second part of This Tutorial, except that I am trying to get the event to trigger when hit with a Spell, I can make it work with an Axe, and if I take out the if statements then any hit including a spell will work, so i know that the script runs. But I can't figure out how to write the code so that preferably only one specific custom spell will work. I don't believe I mind what type of property is ultimately used, as long as it can be to a specific spell.MagicEffect, Spell, Keyword. All my attempts have only worked with weapons. Scriptname Myscript extends ReferenceAlias Keyword Property WeapTypeWarAxe Auto Spell Property Firebolt Auto Keyword Property MagicDamageFire Auto Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) if (akAggressor == Game.GetPlayer()) if (akSource.HasKeyword(WeapTypeWarAxe)) ;This works ; if (akSource.HasKeyword(MagicDamageFire)) ;Doesn't work ; if (akSource == Firebolt) ;Doesn't work Debug.Notification( "You Hit Me" ) endif endif EndEvent Any help in the right direction would be greatly appreciated. Thanks for your time. Link to comment Share on other sites More sharing options...
steve40 Posted August 14, 2012 Share Posted August 14, 2012 (edited) Try this. I haven't tested it. Scriptname Myscript extends ReferenceAlias Keyword Property WeapTypeWarAxe Auto Keyword Property MagicDamageFire Auto Spell Property Firebolt Auto Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) If (akAggressor == Game.GetPlayer()) If (akSource as Weapon).HasKeyword(WeapTypeWarAxe) Debug.Notification("[Myscript]You Hit Me with a War Axe") EndIf If (akSource as Spell).HasKeyword(MagicDamageFire) Debug.Notification("[Myscript]You Hit Me with MagicDefenseFire") EndIf If (akSource as Spell) == Firebolt Debug.Notification("[Myscript]You Hit Me with Firebolt") Endif EndIf EndEvent Edited August 14, 2012 by steve40 Link to comment Share on other sites More sharing options...
Toaster2a Posted August 14, 2012 Author Share Posted August 14, 2012 Try this. I haven't tested it. Yes! Thank you. That works quite nicely. I don't know how long it would have taken me to consider trying to cast the object to a new form. Link to comment Share on other sites More sharing options...
steve40 Posted August 18, 2012 Share Posted August 18, 2012 8) Link to comment Share on other sites More sharing options...
Recommended Posts