Jump to content

[LE] Script for Casting spell on Power Attack


jlryan

Recommended Posts

Hello,

 

I hate to be lazy af but could someone help/create a script that casts a spell on power attack with a specific weapon?

 

- I am trying to make a hammer that when you power attack, it will cast the Fire Storm destruction spell at the cost of 100 stamina.

 

I was able to make a hammer that would cast Fire Storm when bashing, based off of the Dawnguard Rune Hammer script, but that was just too easy spam.

More or less I am just looking for a Power Attack version of the Dawnguard Rune Hammer script.

 

Thank You

Link to comment
Share on other sites

register for "Hitframe" or weaponswing / weaponswingleft. Then on spell condition isPowerattack == 1

 

Think you can modify the dawnguard script, change the register animation to the one above.

Otherwise I can post a working script when I get home from work in 12hours

Link to comment
Share on other sites

register for "Hitframe" or weaponswing / weaponswingleft. Then on spell condition isPowerattack == 1

 

Think you can modify the dawnguard script, change the register animation to the one above.

Otherwise I can post a working script when I get home from work in 12hours

I wanted to alter the dawnguard script to create new one but it wouldn't let me see it like i could the other scripts.

Link to comment
Share on other sites

The below script goes into a magic effect, you can then add into ability, or a spell, or link ability to perk and add perk on equip item or whatever.

 

Sorry for the delay.

 

 

Scriptname YourScriptName extends activemagiceffect

Actor   Property    PlayerRef Auto ;  reference you, the playerSpell   Property    YourSpell Auto ;  reference your spell, dont forget to set property after adding it; -----;Float DelayBetweenAttacksMin ; if you want delays between it;Float DelayBetweenAttacksMax; -----Event OnEffectStart(Actor akTarget, Actor akCaster)        RegisterForAnimationEvent(PlayerRef, "HitFrame") ; register for animation Hitframe or weaponswing / weaponswingleftEndEvent; -----Event OnAnimationEvent(ObjectReference akSource, string asEventName) ; when event occurs    If asEventName == "HitFrame" && akSource == PlayerRef ; change hitframe to weaponswing if u want      ;If  Playerref.IsSneaking() ; condition example if player ref is sneaking                YourSpell.Cast(PlayerRef)     ; Cast your spell when event fired    EndifEndEvent; -----Event OnRaceSwitchComplete()  ; if you transform and revert, this is needed for it to re register for animation event        Utility.Wait(1.0)        RegisterForAnimationEvent(PlayerRef, "HitFrame") ; animation it register forEndEvent 

; -----

 

 

 

Edit: Don't forget to add condition on the ability itself for IsPowerAttacking == 1 or something like it, otherwise it will go off every hit. It's WeaponSwing && WeaponLeftSwing to be correct if you wish to change hitframe to it.

Edited by GSGlobe
Link to comment
Share on other sites

I wanted to alter the dawnguard script to create new one but it wouldn't let me see it like i could the other scripts.

 

FYI - In order for the Creation Kit to see DLC and mod scripts you have to ensure that their source file(s) are located in the main script source folder. Since there is script overlap between base game and DLC, you have to copy them in the same order as your load order. i.e. base game > Dawnguard > Hearthfires > Dragonborn

Link to comment
Share on other sites

 

I wanted to alter the dawnguard script to create new one but it wouldn't let me see it like i could the other scripts.

 

FYI - In order for the Creation Kit to see DLC and mod scripts you have to ensure that their source file(s) are located in the main script source folder. Since there is script overlap between base game and DLC, you have to copy them in the same order as your load order. i.e. base game > Dawnguard > Hearthfires > Dragonborn

 

I can see and edit other dlc scripts, but for some reason this script wont allow me to view source. I searched for it in the file folders and found it, still having trouble adapting it for power attacking. This is the hammer script unedited

Scriptname DLC1testPhilRuneHammerAbilitySCRIPT extends ActiveMagicEffect  

SPELL PROPERTY runeSpell AUTO

EVENT OnEffectStart(Actor target, Actor caster)	
	
	if(caster == game.getPlayer())
		if(RegisterForAnimationEvent(game.getPlayer(), "bashExit") == true)
			debug.trace("bashExit registered")
		endif
	
	endif

ENDEVENT

EVENT OnAnimationEvent(ObjectReference akSource, string asEventName)
  
  	if(asEventName == "bashExit")
  		Debug.trace("the RUNE of me... get it?")

  		; //cast the rune and remove the stamina
  		runeSpell.cast(game.getPlayer())
  		game.getPlayer().damageAv("stamina", 25)

	endIf

ENDEVENT

EVENT OnUnload()
	UnregisterForAnimationEvent(game.getPlayer(), "bashExit")
	
ENDEVENT
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...