Do script on Attack hitting an enemy

Post » Wed Jun 20, 2012 10:32 pm

Basically I'm trying to create a lesser power which if used adds a buff to the player which acts as a "passive" weapon enchantment-script, meaning it executes something when the player hits a target with a weapon. (without actually being an actual enchantment on the weapon)

Now i managed to create my custom power which adds a temporary effect to the player (took me a while to figure out that it's a fire and forget effect, not constant effect :/), however, i have no idea how to get a script running when the player hits a target

Things i have tried / thought of:

-add a script to the temporary effect, but i couldnt find a "onAttack" event or anything similar to it on the wiki
-add a magic "on contact" effect with my script attached - got some weird behavior, basically my script would only fire if I activated the power while directly running into an enemy (adding a duration didn't help)
-dynamically adding onHit scripts to all nearby actors... sounds way too complicated for what im trying to do
-register my script to receive updates and check if i am attacking.. but how would i find out if i actually hit something?

im just looking for a simple way that lets me execute a script when i hit something with a weapon
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Wed Jun 20, 2012 1:31 pm

How about using a perk with the perk entry point 'Apply Combat Hit Spell'? It doesn't work if you're unarmed though, and I'm not sure if it'll be compatible if another mod uses the same entry point.
User avatar
Naomi Ward
 
Posts: 3450
Joined: Fri Jul 14, 2006 8:37 pm

Post » Wed Jun 20, 2012 10:03 pm

At this time the only way to trigger an effect when you hit an enemy is using enchantments or a perk with the "on combat hit" condition.

:dry:
User avatar
Dalley hussain
 
Posts: 3480
Joined: Sun Jun 18, 2006 2:45 am

Post » Wed Jun 20, 2012 7:11 pm

Alright, thanks, definitely gonna check out the perk option.

is it possible to dynamically add / remove enchantments via a script?
User avatar
Chase McAbee
 
Posts: 3315
Joined: Sat Sep 08, 2007 5:59 am


Return to V - Skyrim