Aydaptic Posted August 28, 2018 Share Posted August 28, 2018 (edited) [sOLVED BY FRANKFAMILY] I finally swallowed my stubbornness and admitted that I need help. Hi there. I'm making my very first (somewhat advanced) follower mod that I'll be publishing on NexusMods -- and I'm basically finished -- but there's one thing I can't seem to figure out. When certain NPCs are "assaulted" (OnHit) by the Dragonborn with either a weapon, spell or unarmed, a quest will trigger where my follower leaves the Dragonborn's service. It works great. Thing is, my follower will even leave the Dragonborn's service if they cast Heal Other or Healing Hands. I don't want that. I only want him to leave if the spells cast on those NPCs are offensive. There HAS to be an easier way than making a property for each offensive spell. The question: How can I avoid the "pTLOC_LeaveService" quest from triggering if the player uses Heal Other or Healing Hands? Is there a way to say "trigger quest on each spell except Heal Other and Healing Hands" in the script? Here's my full "assault" script - if it helps, it's attached directly to each Actor affected by it: Scriptname TLOC_AssaultScript extends ObjectReference Bool Property abBashAttack Auto Bool Property abHitBlocked Auto Bool Property abPowerAttack Auto Bool Property abSneakAttack Auto WEAPON Property pUnarmed Auto Quest Property pTLOC_LeaveService 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 pTLOC_LeaveService.Start() endif endif if akAggressor == Game.GetPlayer() if akSource == pUnarmed pTLOC_LeaveService.Start() endif endif if akAggressor == Game.GetPlayer() if akSource as Spell pTLOC_LeaveService.Start() endif endif EndEvent PS: I'm new to scripting, so I'd appreciate if you go easy on me. Any help is greatly cherished. Thanks in advance. Your assistance will be credited on the mod page once it's out (unless you don't want to be.) EDIT: Just a couple typos. Edited August 29, 2018 by Aydaptic Link to comment Share on other sites More sharing options...
FrankFamily Posted August 28, 2018 Share Posted August 28, 2018 (edited) There's this function https://www.creationkit.com/index.php?title=IsHostile_-_Spell. I suppose you'd do this and it should work: if (akSource as Spell) && akSource.IsHostile()For the future, this is where you can find all the functions: https://www.creationkit.com/index.php?title=Category:Papyrus Edited August 28, 2018 by FrankFamily Link to comment Share on other sites More sharing options...
Aydaptic Posted August 28, 2018 Author Share Posted August 28, 2018 Hi, FrankFamily -- thanks for the quick response. I tried this earlier, but I might be doing something wrong. Here's the error I got: Starting 1 compile threads for 1 files...Compiling "TLOC_AssaultScript"...D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TLOC_AssaultScript.psc(28,37): IsHostile is not a function or does not existNo output generated for TLOC_AssaultScript, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on TLOC_AssaultScript There's this function https://www.creationkit.com/index.php?title=IsHostile_-_Spell. I suppose you'd do this and it should work: if (akSource as Spell) && akSource.IsHostile()For the future, this is where you can find all the functions: https://www.creationkit.com/index.php?title=Category:Papyrus Link to comment Share on other sites More sharing options...
FrankFamily Posted August 29, 2018 Share Posted August 29, 2018 (edited) Oh, my bad, it should be: (aksource as Spell).IsHostile()It needs to be of type spell not form. You could also make it like so: Spell MySpell = (aksource as Spell) If MySpell && MySpell.IsHostile() do stuff Edited August 29, 2018 by FrankFamily Link to comment Share on other sites More sharing options...
Aydaptic Posted August 29, 2018 Author Share Posted August 29, 2018 It works! Thank you so much, FrankFamily. You're a lifesaver. I've been stuck on this for days and now I can finally proceed :happy: Oh, my bad, it should be: (aksource as Spell).IsHostile()It needs to be of type spell not form. You could also make it like so: Spell MySpell = (aksource as Spell) If MySpell && MySpell.IsHostile() do stuff Link to comment Share on other sites More sharing options...
Recommended Posts