3aq Posted May 29, 2019 Share Posted May 29, 2019 (edited) Been working on this for the better part of 3 days now.. and I seem to be going no where fast. That said, I was wondering if people with brighter minds than I may indulge me with their insight. These are the two scripts: scriptName _OnHitBlockCast extends activemagiceffect {Template script that casts spell on self on block, requires external keyword.} actor property ActorRef auto spell property SpellRef auto keyword property KeyRef auto Event OnEffectStart (Actor akTarget, Actor akCaster) ActorRef = akTarget ActorRef.AddSpell(SpellRef, true) endEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) If ActorRef.GetAnimationVariableBool("IsBlocking") == true && math.abs(ActorRef.GetHeadingAngle(akAggressor)) < 60.0000 if (akSource as Weapon).HasKeyword(KeyRef) if(abHitBlocked) SpellRef.Cast(ActorRef, none) endIf endIf endIf endevent scriptName _OnEffectMovementSpeedMult extends activemagiceffect {Template script, revised speed mult.} float property n auto Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.ModActorValue("SpeedMult", n) akTarget.ModActorValue("CarryWeight", 0.0001) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.ModActorValue("SpeedMult", -n) akTarget.ModActorValue("CarryWeight", -0.0001) EndEvent Scriptname _OnEffectTempPerk extends ActiveMagicEffect {Template script for adding temp perk to an actor via magic effect} perk property PerkRef auto event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.AddPerk(PerkRef) endEvent event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.RemovePerk(PerkRef) endEvent === What I am trying to achieve: While equipping a specific weapon, on successfully blocking an incoming attack, will cast a specific spell to self (in this specific example, script #2, it casts a spell that increases movement speed by n amount). This should work for anyone that wears the weapon not just the PC. In a new esp, I made the following: Weapon, Perk, Keyword, 2x Magic Effect, 2x Spell Effect. { Spell Effect (ability/self) --> Magic Effect (scripted/none, constant/self) } <-- attached to Perk via Ability.{ Spell Effect (spell/self) --> Magic Effect (scripted/none, fire forget/self) } <-- referenced by script #1 that should cast onto the PC/NPC that is blocking with said weapon. Weapon uses script #3 to temporary grant the wearer the Perk on equip and removes it when it is unequipped.Weapon uses the Keyword to prevent other weapons (and possibly shields) from using the effects === Unfortunately, what I am trying to achieve has yet to happen, it I've even changed the self to targeted actors, as well as inversing constant with fire forget. Nothing works. I am completely out of ideas, those with more experience help cue me in? :psyduck: Thanks in advance, Edited May 30, 2019 by 3aq Link to comment Share on other sites More sharing options...
Evangela Posted May 30, 2019 Share Posted May 30, 2019 (edited) Nevermind, missread. Edit: Run a test on OnHit's Animationbool statement to see if that is actually working as expected. Do not include the heading angle code though, just test the animation bool. If that works as expected, then you can test the heading angle. I never used that function because I don't understand angles in that way. Edited May 30, 2019 by Rasikko Link to comment Share on other sites More sharing options...
3aq Posted May 30, 2019 Author Share Posted May 30, 2019 removing the angle did not do the trick, I will continue testing different possibilities.. Link to comment Share on other sites More sharing options...
3aq Posted May 30, 2019 Author Share Posted May 30, 2019 So after multiple testing I figure out the issue. 1. OnEffect for temp perks was not ideal as game failed to register it; this is resolved by OnEquip.The downside to using OnEquip though is that sometimes, seldomly it will fail to apply whatever thing you want to apply, this is why I've always opted for OnEffect. But it seems for weapons in particular, OnEquip is what you want. 2. Keyword, and this has stumped me. It seems the inclusion of keywords have prevented the following if hitblock to run. If that is the case I am unsure how to properly utilize Keywords. Would anyone more experienced cue me in on the usage of Keywords? On that note, yes my keyword does properly references the keyword in esp (as is everything else). Link to comment Share on other sites More sharing options...
Jebbalon Posted May 31, 2019 Share Posted May 31, 2019 Papyrus AddPerk() only works for the player. Quote from that page " This does nothing for NPCs. "So, only use that on player.I think there is a way to use the spell or Magic effect to add the perk to npc (not through script) - would have to look at it again. It is convoluted. Link to comment Share on other sites More sharing options...
3aq Posted May 31, 2019 Author Share Posted May 31, 2019 Thanks for the heads up, I figured out how to get around that issue. Simply bypass Perks and AddPerks altogether and just use Spells and AddSpells. On initial testing it seems to work, unsure if there may be complications later, but from what I can tell I encountered no problems so far. Seems Perks is as meaningless as Keywords for this type of script. Link to comment Share on other sites More sharing options...
Recommended Posts