Jump to content

Inverse of OnHit event?

Recommended Posts

I don't see one. Bear in mind that I know almost nothing about how events work, but these are my thoughts...


You could try with onanimationevent() and listen for specific combat animations, but that's a hell of a lot of work and probably hit or miss whether you'd get something.


Oneffectstart or finish could work if you force the player to use a specific enchanted weapon and then listen for that particular enchantment, but again there's no guarantee the player would use that weapon (or staff, whatever).


Ondeath or ondying and listen for everybody but the actor, but that only happens if the player is winning, obviously. Onenterbleedout, same.


Onstoryincreaseskill *might* work, if you assume that your player is going to be increasing their skill in combat. But I don't know if it uses ints or floats... floats is workable, maybe, but ints probably not.
Onstoryinfection might work if I understand what it does correctly... you could make a disease, then apply a 100% chance to infect when encountered, give the infection possibility to the player so that whenever he melee hits an actor they get infected with the disease and you can listen for it...
Onpackagestart? Add an AI package to everyone in the area with a condition for taking damage, and then check for that? I dunno...
There are a lot of things that are close to what you want, that could maybe be worked either in combination with other events or with various script tricks to work. Onequipped (check for equipped weapon), onhit, onstoryassaultactor...

May I ask... what are you attempting? Knowing might help come up with some workaround. 

Link to comment

May I ask... what are you attempting? Knowing might help come up with some workaround. 


I want damage done to/by the player to be partially attributed via scripting. This is part of an effort to normalize Skyrim's combat into being consistently challenging, instead of fluctuating between 'cakewalk' and 'impossibly difficult' depending on what enemy the player is fighting at the time. I know I could go through every single race and actor form in the CK to set their health/damage values closer to each other, but that'd take an eternity, hence scripts.


I have already implemented damage to player, thanks to OnHit(). Every time the player gets hit, the script identifies the damage source and type, and if applicable, applies some variable damage to the player, while accounting for their armor, elemental resistances, etc. This allows weaker enemies like wolves to be a threat in groups, while not affecting already hard-hitting enemies like giants.


Now I'm left with the other side of the problem: some enemies have a ridiculous amount of health, and I want those to take extra damage via script whenever the player hits them. Having read the suggestions, I think my best bet would be to give the player a cloak that casts a magic effect on enemies in the area, hooking a script with OnHit() onto them. But I need a script that extends ObjectReference, which ActiveMagicEffect doesn't. If there's a way to attach a new Actor script onto an actor, from the ActiveMagicEffect's OnEffectStart call, then I could pull this off, but I'm not sure if that's possible without resorting to quest aliases, which is messy at best, given the arbitrary number of enemies that may be fighting the player at a given time.

Link to comment

Check this http://www.creationkit.com/ActiveMagicEffect_Script


Under notes:

ActiveMagicEffects will also receive events from the Actor they are attached to.

It means you can make OnHit event with ActiveMagicEffect.


Oh, missed that! Well that solves that problem, thanks.



I think this whole idea is bad and will overload script engine easily, better to think of another solution that doesn't use scripts.


If it turns out to affect Papyrus performance noticeably when more actors have the script, then I'll scrap it, but given the current processing for the player's OnHit takes a very short amount of time, I think I'd need to have hundreds of OnHit calls per second for backlog to start piling up, which just isn't a realistic scenario. My one concern is the use of the cloak effect, I have no idea how taxing that is on performance.

Link to comment


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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