Weapon Script Activate on Strike

Post » Mon Jun 18, 2012 11:31 am

I'm having a bit of trouble figuring this one out. I'm trying to get a script on a weapon to activate when you hit an enemy with it, but I can't find any functions to actually do that. After poking around some of the weapons found in-game, I've discovered that Mehrunes' Razor does so via its enchantment triggering the script, but I'd like the weapon to still be enchantable. I haven't found anything that seems to cover this in either the wiki or by looking through the scripts. Would it be a semi-undocumented variation of the OnHit trigger, or does something like this simply not exist?
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Mon Jun 18, 2012 4:03 pm

If you want to do it without having an enchantment on your weapon, the only way I can see is to add a script to all actors with an OnHit event and if the weapon used is this one, apply the effect
There's hopefully a much better way, but if there is it is not obvious in the slightest
User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Mon Jun 18, 2012 1:32 pm

Ya im also having a tough one on this. as mentioned as above the only solution i found as well is the Active effect scripting + enchantment
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Mon Jun 18, 2012 2:39 pm

The only alternative I've found, having created rings this way, is to have a script attached to the weapon which adds a perk to the player when it's equipped that applies a combat hit spell that references your real effect that you want to happen. From what I've heard, however, if multiple combat hit perks are applied to the player, only one will work.

However, in lieu of that... Check out http://www.gamesas.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/page__p__20348030__hl__detect%20player%20hit__fromsearch__1thread for dynamically attaching scripts to npcs that are close by. If you get that working you could then have the script use the NPCs OnHit event.

-MM
User avatar
Yonah
 
Posts: 3462
Joined: Thu Aug 02, 2007 4:42 am


Return to V - Skyrim