Attaching spellsscripts to items or ammo

Post » Sun Jun 17, 2012 11:52 pm

I see a way to attach a script to a weapon, and most 'spell effects' can probably be done with scripting or with enchanting an item.
I would like to attach a script to an ammo type? Or at least have a certain event happen when hit with a specific ammo type.
User avatar
Bitter End
 
Posts: 3418
Joined: Fri Sep 08, 2006 11:40 am

Post » Sun Jun 17, 2012 3:09 pm

Have you tried attaching the desired effect to the bow?

You'd then have to check what ammo the user of the bow is using.
User avatar
Richard Dixon
 
Posts: 3461
Joined: Thu Jun 07, 2007 1:29 pm

Post » Mon Jun 18, 2012 12:24 am

I thought of that, but it appears in order for that to work I'd need to attach that effect to every single bow. This ammo is supposed to work with any bow you have.
User avatar
Sheila Reyes
 
Posts: 3386
Joined: Thu Dec 28, 2006 7:40 am

Post » Sun Jun 17, 2012 4:13 pm

Or maybe there is a script that runs every time any bow is shot I could hook into?
User avatar
Rachyroo
 
Posts: 3415
Joined: Tue Jun 20, 2006 11:23 pm

Post » Sun Jun 17, 2012 11:06 pm

Doesn't seem like I can find any event that happens every time any weapon is fired. I guess it's time to make a custom bow for my project. We'll see how that goes.
User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Sun Jun 17, 2012 3:35 pm

what ive found is adding a enchantment to a specific item you wish to use, then editing the Magical Effect properties of the Enchantment and attaching a script

Scriptname AA_BoundArcaneBowCastSpell extends ActiveMagicEffect  Spell property AASpell autoEvent OnEffectStart(Actor akTarget, Actor akCaster)AASpell.Cast(akCaster, None)EndEVENT

Now this seems quick and dirty, but it works. If you attach it to a bow the Arrow fire's first and once the Arrow hits the target it will then cast the spell. What i would love to try to find out is how to watch for Combat States? see when a Bow is being fired directly instead of waiting for the Arrow to hit the target to cast the spell, upon release of the bow string
User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Sun Jun 17, 2012 4:20 pm

I will look into this, thank you.
User avatar
GPMG
 
Posts: 3507
Joined: Sat Sep 15, 2007 10:55 am

Post » Sun Jun 17, 2012 3:25 pm

what ive found is adding a enchantment to a specific item you wish to use, then editing the Magical Effect properties of the Enchantment and attaching a script

Scriptname AA_BoundArcaneBowCastSpell extends ActiveMagicEffect  Spell property AASpell autoEvent OnEffectStart(Actor akTarget, Actor akCaster)AASpell.Cast(akCaster, None)EndEVENT

Now this seems quick and dirty, but it works. If you attach it to a bow the Arrow fire's first and once the Arrow hits the target it will then cast the spell. What i would love to try to find out is how to watch for Combat States? see when a Bow is being fired directly instead of waiting for the Arrow to hit the target to cast the spell, upon release of the bow string

Why not something more event based like
Scriptname AA_BoundArcaneBowCastSpell extends ObjectReferenceEvent OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)	 if akProjectile == YOUR_PROJECTILE		 ;do something	 endifEndEvent

That way it doesnt matter the weapon.

Edit: Mispells
User avatar
Emmie Cate
 
Posts: 3372
Joined: Sun Mar 11, 2007 12:01 am


Return to V - Skyrim