idioticidiot Posted November 9, 2016 Share Posted November 9, 2016 Hello, My aim was to force a follower to summon another character when her health had dropped below 20% during combat. But now it has 2 problems:1) it does not play the shout animation;2) every time she is hit, she summons the character over and over again. Is there any way to 1) force the shout animation playing; and 2) stop recasting the spell when the spell is active (say the spell is effective for 50 seconds. During that 50 seconds, the spell won't be recasted every time the follower is hit)? Thank you in advance. Scriptname _DBsummon extends ActiveMagicEffect ;-- Properties --------------------------------------spell property Voicecallsofia autoFloat property PercentHealth = 100.000 autoOBJECTREFERENCE PROPERTY caster AUTOFLOAT PROPERTY waitTimer AUTO ;-- Variables --------------------------------------- ;-- Functions --------------------------------------- function OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) PercentHealth = self.GetTargetActor().GetAVPercentage("Health") if PercentHealth < 0.200000 Debug.SendAnimationEvent (Caster as ObjectReference, "Shout Start") voicecallsofia.Cast(self.GetTargetActor() as ObjectReference, none) utility.wait(waitTimer)endIfendFunction ; Skipped compiler generated GotoState ; Skipped compiler generated GetState Link to comment Share on other sites More sharing options...
thesniperdevil Posted November 9, 2016 Share Posted November 9, 2016 I may be a bit scrappy wth my scripting knowhow- but shouldnt the OnHit be an Event? Event OnHit(.......) do the stuff you mentionedendEvent From what you are showing there, I see no reason why the spell would keep casting, unless the function is being called lots of times.. which may also be breaking the animation. Link to comment Share on other sites More sharing options...
irswat Posted November 9, 2016 Share Posted November 9, 2016 OnHit is an event. Look at the wispmothersuperior script for an example of this. Link to comment Share on other sites More sharing options...
idioticidiot Posted November 10, 2016 Author Share Posted November 10, 2016 Thanks for the help, but still, every time the follower is hit, the follower automatically summons the character again and again. What have I missed? Link to comment Share on other sites More sharing options...
Akreontage Posted November 10, 2016 Share Posted November 10, 2016 ;-- Properties --------------------------------------bool b Event OnInit()b = trueEndEvent ............................Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) PercentHealth = self.GetTargetActor().GetAVPercentage("Health")if (PercentHealth < 0.200000 && b) Debug.SendAnimationEvent (Caster as ObjectReference, "Shout Start") voicecallsofia.Cast(self.GetTargetActor() as ObjectReference, none) b = falseendIfEndEvent Use something like that and change boolean b to true again for example when health reaches 100%. Link to comment Share on other sites More sharing options...
dvkkha Posted November 10, 2016 Share Posted November 10, 2016 (edited) Are you sure that the bool doesn't get dropped on the next OnHit event? What you could do is: Create a dummy magic effect named mgef_spellalreadycastCreate a dummy spell named spell_spellalreadycast with your mgef_spellalreadycast with a duration of 50seconds. OnHit, if the follower has no mgef_spellalreadycast effect active you let the follower cast its summoning spell and the spell_spellalreadycast on self. Edited November 10, 2016 by dvkkha Link to comment Share on other sites More sharing options...
idioticidiot Posted November 10, 2016 Author Share Posted November 10, 2016 Scriptname _DBsummon extends ActiveMagicEffect ;-- Properties --------------------------------------spell property Voicecallsofia autospell property Voicecallsofiadummy automagiceffect property voicecalleffectcastalready autoFloat property PercentHealth = 100.000 autoOBJECTREFERENCE PROPERTY caster AUTOFLOAT PROPERTY waitTimer AUTO ;-- Variables --------------------------------------- ;-- Functions --------------------------------------- Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) if !caster.HasMagicEffect(voicecalleffectcastalready) PercentHealth = self.GetTargetActor().GetAVPercentage("Health") if PercentHealth < 0.200000 Debug.SendAnimationEvent (Caster as ObjectReference, "Shout Start") voicecallsofia.Cast(self.GetTargetActor() as ObjectReference, none) utility.wait(waitTimer) endIf endifendEvent ; Skipped compiler generated GotoState ; Skipped compiler generated GetState Sorry for my ignorance. Now the script returns the following error: "HasMagicEffect is not a function or does not exist". What have I missed? Event oneffectstart ? Link to comment Share on other sites More sharing options...
NexusComa Posted November 10, 2016 Share Posted November 10, 2016 (edited) Bool Cast = true Event OnInit() Cast = true EndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) PercentHealth = self.GetTargetActor().GetAVPercentage("Health") if (PercentHealth < 0.200000) if(Cast == true) Debug.SendAnimationEvent (Caster as ObjectReference, "Shout Start") voicecallsofia.Cast(self.GetTargetActor() as ObjectReference, none) Cast = false endif else Cast = true endIf EndEvent Edited November 10, 2016 by NexusComa Link to comment Share on other sites More sharing options...
idioticidiot Posted November 10, 2016 Author Share Posted November 10, 2016 Bool Cast = true Event OnInit() Cast = trueEndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) PercentHealth = self.GetTargetActor().GetAVPercentage("Health") if (PercentHealth < 0.200000) if(Cast == true) Debug.SendAnimationEvent (Caster as ObjectReference, "Shout Start") voicecallsofia.Cast(self.GetTargetActor() as ObjectReference, none) Cast = false endif else Cast = true endIf EndEvent Do I need to use wait utility.wait to force a cool down time? Link to comment Share on other sites More sharing options...
dvkkha Posted November 10, 2016 Share Posted November 10, 2016 Scriptname _DBsummon extends ActiveMagicEffect ;-- Properties --------------------------------------spell property Voicecallsofia autospell property Voicecallsofiadummy automagiceffect property voicecalleffectcastalready autoFloat property PercentHealth = 100.000 autoOBJECTREFERENCE PROPERTY caster AUTOFLOAT PROPERTY waitTimer AUTO ;-- Variables --------------------------------------- ;-- Functions --------------------------------------- Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) if !caster.HasMagicEffect(voicecalleffectcastalready) PercentHealth = self.GetTargetActor().GetAVPercentage("Health") if PercentHealth < 0.200000 Debug.SendAnimationEvent (Caster as ObjectReference, "Shout Start") voicecallsofia.Cast(self.GetTargetActor() as ObjectReference, none) utility.wait(waitTimer) endIf endifendEvent ; Skipped compiler generated GotoState ; Skipped compiler generated GetState Sorry for my ignorance. Now the script returns the following error: "HasMagicEffect is not a function or does not exist". What have I missed? Event oneffectstart ? I'm not totally sure but you're trying to use .HasMagicEffect() on caster wich is defined as objectreference. You need to use an Actor like Game.GetPlayer() or in this case self.GetTargetActor() if I'm not mistaken.https://www.creationkit.com/index.php?title=HasMagicEffect_-_Actor Try: if !(self.GetTargetActor().HasMagicEffect(voicecalleffectcastalready))And don't forget to deploy the magiceffect on your follower after the shout. Link to comment Share on other sites More sharing options...
Recommended Posts