jdietz Posted November 10, 2012 Share Posted November 10, 2012 (edited) Remember in oblivion, with Vahtacen Ruins and the cool turning door? I'm trying to write a similar script that will cause an pillar to play a set of three animations on being hit by certain order of spells until a door opens at the bottom. IsSpellTarget would be a great function to use, except all i can figure out how to use is actor.isSpellTarget. can it target objects? Edited November 10, 2012 by jdietz Link to comment Share on other sites More sharing options...
KingsGambit Posted November 10, 2012 Share Posted November 10, 2012 It may well be easier than that. There is an event OnHit which can be attached to the object. It returns the value of the source so you can evaluate the incoming spells and do different things for each. For example: GlobalVariable Property FirstSpell auto GlobalVariable Property SecondSpell auto Door Property MyDoor auto Spell Property SpellToCheck1 auto Spell Property SpellToCheck2 auto Spell Property SpellToCheck3 auto Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) int Source = akSource.GetFormID() if(Source == SpellToCheck1.GetFormID() && FirstSpell.GetValue() == 0) FirstSpell.SetValue(1) Debug.Notification("First spell successfully cast") ; Run first animation ; elseif(Source != SpellToCheck2.GetFormID() && FirstSpell.GetValue() == 1) ; FirstSpell.SetValue(0) ; Debug.Notification("Second spell wrong - Sequence Reset") ; Stop/reset first animation elseif(Source == SpellToCheck2.GetFormID() && FirstSpell.GetValue() == 1) SecondSpell.SetValue(1) Debug.Notification("Second spell successfully cast") ; Run second animation ; elseif(Source != SpellToCheck3.GetFormID() && SecondSpell.GetValue() == 1) ; Debug.Notification("Third Spell Wrong - Sequence Reset") ; FirstSpell.SetValue(0) ; Remove this to only go back one step, instead of back to the start ; SecondSpell.SetValue(0) ; Stop/reset second animation elseif(Source == SpellToCheck3.GetFormID() && SecondSpell.GetValue() == 1) Debug.Notification("Third spell successfully cast") ; Open MyDoor else Debug.Notification("First spell wrong") endif EndEventThis will detect the incoming source and evaluate whether it's the correct spell, in the correct sequence. There are commented-out conditions to "reset" the sequence if an incorrect spell is cast. It requires two custom Global Variables be created with an initial value of 0. Link to comment Share on other sites More sharing options...
jdietz Posted November 11, 2012 Author Share Posted November 11, 2012 thanks a ton. Link to comment Share on other sites More sharing options...
jdietz Posted November 11, 2012 Author Share Posted November 11, 2012 I'm guessing if i adjust my properties i can get the object to respond to projectile and melee attacks too? Link to comment Share on other sites More sharing options...
KingsGambit Posted November 11, 2012 Share Posted November 11, 2012 Yes, weapon and projectiles can also be returned. From the wiki page: akSource: The Weapon, Spell, Explosion, Ingredient, Potion, or Enchantment that hit this reference.akProjectile: The Projectile that hit this reference. The source will return the weapon or spell. The projectile is returned as akProjectile, not akSource. Link to comment Share on other sites More sharing options...
jdietz Posted November 13, 2012 Author Share Posted November 13, 2012 I have another quick question. Do i need to set a third global variable for my third spell? Link to comment Share on other sites More sharing options...
Recommended Posts