Jump to content

[LE] Need help with a magic effect script


eb113

Recommended Posts

Hello guys, i recently started with papyrus scripting and i really need help with a script that won't work. What i'm trying to do right now is casting a heal on my character every time he swings with a weapon. I'mputting the script here so if anyone can tell me what i'm doing wrong it will be very helpful

ScriptName MyScript Extends ActiveMagicEffect
Spell property HealingRightHand Auto
Actor SelfRef
Event OnEffectStart(Actor akTarget, Actor akCaster)
	SelfRef = akCaster
  	RegisterForAnimationEvent(SelfRef, "weaponSwing")
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
EndEvent

Event OnAnimationEvent(ObjectReference akSource, string EventName)
	If (eventName == "weaponSwing")
		HealingRightHand.cast(SelfRef, SelfRef)
	EndIf
EndEvent
Edited by eb113
Link to comment
Share on other sites

- Where is the script added?, this should be added to an "Ability Spell".

- Is the actor carrying the 'Ability Spell'?.

- Have you fill in all its properties?.

Edited by maxarturo
Link to comment
Share on other sites

The script is for a magic effect that is then linked to an enchant for the weapon that should fire the spell once swinged, could it be a problem with the flags?

 

EDIT: i checked the properties and everything is fine, the one thing that i don't understand is how attach this effect even to my character, since is something that should be tied only to the weapon

Edited by eb113
Link to comment
Share on other sites

What you need to do is put a script on the weapon, that adds the ability to your character when you equip the weapon, and removes the ability when you unequip the weapon. Alternatively, you can cast the healing spell with OnEffectStart in the enchant's magic effect script, and this will heal your character whenever you hit another actor with the weapon.

 

Put a script like this on the weapon:

Scriptname TM_WeapSwingHealScript extends ObjectReference 

Spell Property WeaponSwingHealAbility Auto 

Event OnEquipped(Actor akActor) 
    akActor.AddSpell(WeaponSwingHealAbility)
EndEvent 

Event OnUnEquipped(Actor akActor) 
    akActor.RemoveSpell(WeaponSwingHealAbility)
EndEvent

If you're going to do it that way, change the SelfRef to the Target rather than the Caster.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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