dennisj Posted June 3, 2020 Share Posted June 3, 2020 Im trying to learn how to make a custom weapon in Skyrim that will fire off a spell when you power attack depending on the direction. Power attack forward casts fireball side casts chain lightning ect. From what ive looked up I just can't get my head around doing this but from what ive seen its almost always done using a custom script. Does anyone know how to do this in a script? Link to comment Share on other sites More sharing options...
lin25000 Posted June 3, 2020 Share Posted June 3, 2020 https://forums.nexusmods.com/index.php?/topic/5897262-cast-spell-on-power-attack/ Link to comment Share on other sites More sharing options...
dennisj Posted June 4, 2020 Author Share Posted June 4, 2020 (edited) https://forums.nexusmods.com/index.php?/topic/5897262-cast-spell-on-power-attack/ I don't get what im doing wrong. Ive set up the weapon and replaced all the place holder stuff but its not firing Scriptname AceCastOnPowerAttackScript extends activemagiceffect Spell Property AAAFire AutoWeapon Property AAA1 AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)RegisterForSingleUpdate(0.5)akCaster.DrawWeapon()akCaster.EquipItem(AAA1, True, True)EndEventEvent OnUpdate()bool PowerAttack = Game.GetPlayer().GetAnimationVariableBool("bAllowRotation")RegisterForSingleUpdate(0.5)If PowerAttack == True UnRegisterForUpdate() Utility.Wait(0.4) AAAFire.cast(Game.GetPlayer())EndIfEndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)UnRegisterForUpdate()akCaster.UnEquipItem(AAA1, False, True)akCaster.RemoveItem(AAA1, 1, True)EndEvent Edited June 4, 2020 by dennisj Link to comment Share on other sites More sharing options...
dylbill Posted June 5, 2020 Share Posted June 5, 2020 To do this, I would make a new spell ability and put the condition IsPowerAttacking == 1 on it's magic effect so that the effect starts whenever you power attack. On the magic effect put this script: Scriptname PowerAttackSpellScript extends ActiveMagicEffect ;Put the condition IsPowerAttacking == 1 on this spell abilities magic effect Spell Property MyPowerAttackSpell Auto Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect start when power attacking MyPowerAttackSpell.Cast(akTarget) ;casts the spell from the actor who is power attacking EndEvent Put this script on your weapon: Scriptname PowerAttackAddAbilityScript extends ObjectReference Spell Property PowerAttackTrigger Auto ;this is the spell ability you made above that detects power attacking Event OnEquipped(Actor akActor) akActor.AddSpell(PowerAttackTrigger) EndEvent Event OnUnequipped(Actor akActor) akActor.RemoveSpell(PowerAttackTrigger) EndEvent Name the scripts something more unique and don't forget to fill properties in the creation kit after compiling. Link to comment Share on other sites More sharing options...
werksmith Posted June 9, 2020 Share Posted June 9, 2020 Im trying to learn how to make a custom weapon in Skyrim that will fire off a spell when you power attack depending on the direction. Power attack forward casts fireball side casts chain lightning ect. From what ive looked up I just can't get my head around doing this but from what ive seen its almost always done using a custom script. Does anyone know how to do this in a script? This mod applies dragonrend upon a power attack, maybe this would help you? I don't know the answer to your question just that I use a mod that does this. It's called DragonBlade.Good luck!https://www.nexusmods.com/skyrimspecialedition/mods/29341 Link to comment Share on other sites More sharing options...
Recommended Posts