scriptName SwordsMagicScript extends activemagiceffect
actor property selfref auto hidden
spell property OneHandedSpellForward auto
spell property OneHandedSpellStand auto
spell property OneHandedSpellSide auto
spell property OneHandedSpellBack auto
spell property OneHandedSpellForwardLeft auto
spell property OneHandedSpellStandLeft auto
spell property OneHandedSpellSideLeft auto
spell property OneHandedSpellBackLeft auto
spell property SpellForward auto
spell property SpellStand auto
spell property SpellSide auto
spell property SpellBack auto
spell property AxeSpellForward auto
spell property AxeSpellStand auto
spell property AxeSpellSide auto
spell property AxeSpellBack auto
spell property UnarmedSpellForward auto
spell property UnarmedSpellStand auto
spell property UnarmedSpellSide auto
spell property UnarmedSpellBack auto
spell property SpellBash auto
Float property Direction auto
Float property Speed auto
function OnEffectStart(actor akTarget, actor akCaster)
selfref = akCaster
self.registerForAnimationEvent(akCaster as objectreference, "PowerAttack_Start_End")
self.registerForAnimationEvent(akCaster as objectreference, "AttackPowerStanding_FXStart")
self.registerForAnimationEvent(akCaster as objectreference, "AttackPowerRight_FXStart")
self.registerForAnimationEvent(akCaster as objectreference, "AttackPowerLeft_FXStart")
self.registerForAnimationEvent(akCaster as objectreference, "AttackPowerBackward_FXStart")
self.registerForAnimationEvent(akCaster as objectreference, "AttackPowerForward_FXStart")
self.registerForAnimationEvent(akCaster as objectreference, "bashRelease")
self.registerForAnimationEvent(akCaster as objectreference, "WeaponSwing")
self.registerForAnimationEvent(akCaster as objectreference, "WeaponLeftSwing")
endFunction
function OnAnimationEvent(objectreference akSource, String EventName)
if EventName == "bashRelease"
SpellBash.Cast(selfref as objectreference, none)
elseIf EventName == "AttackPowerStanding_FXStart"
SpellStand.Cast(selfref as objectreference, none)
elseIf EventName == "AttackPowerForward_FXStart"
if selfref.IsSprinting()
SpellForward.Cast(selfref as objectreference, none)
endIf
elseIf EventName == "AttackPowerRight_FXStart" || EventName == "AttackPowerLeft_FXStart"
SpellSide.Cast(selfref as objectreference, none)
elseIf EventName == "AttackPowerBackward_FXStart"
SpellBack.Cast(selfref as objectreference, none)
elseIf EventName == "WeaponSwing"
Direction = selfref.GetAnimationVariableFloat("Direction")
Speed = selfref.GetAnimationVariableFloat("Speed")
Bool PowerAttack = selfref.GetAnimationVariableBool("bAllowRotation")
if PowerAttack
if selfref.GetEquippedItemType(0) == 6
if Speed == 0.000000
AxeSpellStand.Cast(selfref as objectreference, none)
elseIf Speed > 0.000000
if Direction == 1.00000 || Direction == 0.000000
if selfref.IsSprinting() == 0
AxeSpellForward.Cast(selfref as objectreference, none)
endIf
elseIf Direction == 0.250000
AxeSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.750000
AxeSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.500000
AxeSpellBack.Cast(selfref as objectreference, none)
endIf
endIf
elseIf selfref.GetEquippedItemType(1) == 1 || selfref.GetEquippedItemType(1) == 2 || selfref.GetEquippedItemType(1) == 3 || selfref.GetEquippedItemType(1) == 4
if Speed == 0.000000
OneHandedSpellStand.Cast(selfref as objectreference, none)
elseIf Speed > 0.000000
if Direction == 1.00000 || Direction == 0.000000
if selfref.IsSprinting() == 0
OneHandedSpellForward.Cast(selfref as objectreference, none)
endIf
elseIf Direction == 0.250000
OneHandedSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.750000
OneHandedSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.500000
OneHandedSpellBack.Cast(selfref as objectreference, none)
endIf
endIf
elseIf selfref.GetEquippedItemType(1) == 0
if Speed == 0.000000
UnarmedSpellStand.Cast(selfref as objectreference, none)
elseIf Speed > 0.000000
if Direction == 1.00000 || Direction == 0.000000
UnarmedSpellForward.Cast(selfref as objectreference, none)
elseIf Direction == 0.250000
UnarmedSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.750000
UnarmedSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.500000
UnarmedSpellBack.Cast(selfref as objectreference, none)
endIf
endIf
endIf
endIf
elseIf EventName == "WeaponLeftSwing"
Direction = selfref.GetAnimationVariableFloat("Direction")
Speed = selfref.GetAnimationVariableFloat("Speed")
Bool PowerAttack = selfref.GetAnimationVariableBool("bAllowRotation")
if PowerAttack
if selfref.GetEquippedItemType(0) == 6
if Speed == 0.000000
AxeSpellStand.Cast(selfref as objectreference, none)
elseIf Speed > 0.000000
if Direction == 1.00000 || Direction == 0.000000
if selfref.IsSprinting() == 0
AxeSpellForward.Cast(selfref as objectreference, none)
endIf
elseIf Direction == 0.250000
AxeSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.750000
AxeSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.500000
AxeSpellBack.Cast(selfref as objectreference, none)
endIf
endIf
elseIf selfref.GetEquippedItemType(1) == 1 || selfref.GetEquippedItemType(1) == 2 || selfref.GetEquippedItemType(1) == 3 || selfref.GetEquippedItemType(1) == 4
if Speed == 0.000000
OneHandedSpellStandLeft.Cast(selfref as objectreference, none)
elseIf Speed > 0.000000
if Direction == 1.00000 || Direction == 0.000000
if selfref.IsSprinting() == 0
OneHandedSpellForwardLeft.Cast(selfref as objectreference, none)
endIf
elseIf Direction == 0.250000
OneHandedSpellSideLeft.Cast(selfref as objectreference, none)
elseIf Direction == 0.750000
OneHandedSpellSideLeft.Cast(selfref as objectreference, none)
elseIf Direction == 0.500000
OneHandedSpellBackLeft.Cast(selfref as objectreference, none)
endIf
endIf
elseIf selfref.GetEquippedItemType(1) == 0
if Speed == 0.000000
UnarmedSpellStand.Cast(selfref as objectreference, none)
elseIf Speed > 0.000000
if Direction == 1.00000 || Direction == 0.000000
UnarmedSpellForward.Cast(selfref as objectreference, none)
elseIf Direction == 0.250000
UnarmedSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.750000
UnarmedSpellSide.Cast(selfref as objectreference, none)
elseIf Direction == 0.500000
UnarmedSpellBack.Cast(selfref as objectreference, none)
endIf
endIf
endIf
endIf
endIf
endFunction
function OnEffectFinish(actor akTarget, actor akCaster)
self.unregisterForAnimationEvent(akCaster as objectreference, "PowerAttack_Start_End")
self.unregisterForAnimationEvent(akCaster as objectreference, "AttackPowerStanding_FXStart")
self.unregisterForAnimationEvent(akCaster as objectreference, "AttackPowerRight_FXStart")
self.unregisterForAnimationEvent(akCaster as objectreference, "AttackPowerLeft_FXStart")
self.unregisterForAnimationEvent(akCaster as objectreference, "AttackPowerBackward_FXStart")
self.unregisterForAnimationEvent(akCaster as objectreference, "AttackPowerForward_FXStart")
self.unregisterForAnimationEvent(akCaster as objectreference, "bashRelease")
self.unregisterForAnimationEvent(akCaster as objectreference, "WeaponSwing")
self.unregisterForAnimationEvent(akCaster as objectreference, "WeaponLeftSwing")
endFunction