Bound Arrow Enchantment

Post » Thu Mar 06, 2014 2:27 pm

I wanted to create a quick script associated to an enchantment I created. The goal here is to have the script check if the equipped weapon is a bow on weapon draw and to then check if the associated enchantment is present on the weapon. If so, it should add and equip Bound Arrows to the actor/player. I'm an amateur when it comes to scripting and papyrus, so any help is greatly appreciated:

Scriptname ApolloArrowEffectScript extends ActiveMagicEffect Ammo Property boundArrow AutoMagicEffect Property BoundArrowFFSelf Auto EVENT OnWeaponDraw(Actor Target, Actor Caster)if (Game.GetActor().GetEquippedWeapon().IsBow()  if(Game.GetActor().WeaponProperty.GetEnchantment().IsEnchApolloArrow()    caster.additem(boundArrow,100,TRUE)    caster.equipitem(boundArrow,TRUE,TRUE)    endEvent  else  endEVENTelseendEVENT EVENT OnWeaponSheathe(Actor Target, Actor Caster)caster.removeitem(boundArrow,caster.getItemCount(boundArrow),TRUE)endEVENT
I'm pulling those event functions out of my ass as I didn't know the correct method of calling for them. Am I handling this correctly or am I butchering it? I spliced this together by looking at a couple other mods and the skse creation kit wiki page, so I apologize if there are any obvious errors.
User avatar
how solid
 
Posts: 3434
Joined: Mon Apr 23, 2007 5:27 am

Post » Thu Mar 06, 2014 6:36 am

You could use http://www.creationkit.com/OnActorAction_-_Form after you call http://www.creationkit.com/RegisterForActorAction_-_Form to listen for bow draw events.

User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Thu Mar 06, 2014 7:19 am

Something along these lines?

Scriptname ApolloArrowEffectScript extends ActiveMagivEffect Ammo Property boundArrow AutoMagicEffect Property BoundArrowFFSelf Auto Event OnInit()        RegisterforActorAction(7) // Can I even do both of these within the same Event?        RegisterforActorAction(9)EndEvent Event OnActorAction(7, player) //No idea what to put in for source or slot in this case.                if (Game.GetPlayer().GetEquippedWeapon().IsBow()                       (Game.GetPlayer().WeaponProperty.GetEnchantment() //Is this enchantment detection even correct?                                if WeaponProperty.GetEnchantment() = !EnchApolloArrow //Couldn't find any documentation that reads the output                                    player.additem(boundArrow,100,TRUE)                                    player.equipitem(boundArrow,TRUE,TRUE)                                Else                                EndIf                       Else                       EndIf                 Else                 EndIf endEvent Event OnActorAction(9, player)        if (Game.GetPlayer().GetEquippedWeapon().IsBow()               player.removeitem(boundArrow,caster.getItemCount(boundArrow),TRUE)        Else        EndIfendEvent
User avatar
latrina
 
Posts: 3440
Joined: Mon Aug 20, 2007 4:31 pm


Return to V - Skyrim