Detecting when a player blocks a hit?

Post » Wed May 22, 2013 8:26 pm

Sounds simple, but I want to be able to detect when a hit is blocked the moment the block happens and have the game apply an effect. Specifically, making it so blocking no longer deals health damage.

The best way for me to do this is if there was a perk conditional that detected when an attacker's hit gets blocked. Is there such a thing? I couldn't find anything that would obviously point to that. I.E. I have a perk entry point applied to the player that mods incoming damage to zero, and under the "attacker" conditional I would ideally apply something along the lines of "HitBlocked == 1".

Currently that's how I have it set up, except I'm detecting instead when the player is blocking. This "works" but it makes it so that whenever the player holds the shield up, the player gets immune to all damage sources no matter where they come from. I ONLY want to block 100% of damage from physical attacks that hit the shield (aka - a hit is blocked, versus a hit hitting the player while they happen to have the shield up).

Scripting doesn't work, because scripts are reactionary. I.E. i can detect when a player is hit and I can detect if that hit was blocked.. but that condition only fires after the damage has already been done.

So, any help? If there was a conditional that was able to detect when an attacker's hits get blocked, or if there was a conditional that was able to detect when a player blocks an attack, that would be perfect. Right now I can only seem to detect when the player is actually in a blocking animation though, which doesn't work out (as it has the "you block 100% of all damage" effect being applied to the player everywhere as long as they hold their shield up, regardless if the hit was actually blocked)

User avatar
Rodney C
 
Posts: 3520
Joined: Sat Aug 18, 2007 12:54 am

Post » Wed May 22, 2013 11:43 am

take a look at this item - http://www.uesp.net/wiki/Skyrim:Auriel%27s_Shield

not quite sure how they have done this, but you can in the CK shift through the spell effect, item ect to se if you can figure it out

User avatar
victoria gillis
 
Posts: 3329
Joined: Wed Jan 10, 2007 7:50 pm

Post » Wed May 22, 2013 2:30 pm

You will want to take a look at DLC1_ReflectShieldSCRIPT.psc its manages the entire blocking mechanism effect

User avatar
CRuzIta LUVz grlz
 
Posts: 3388
Joined: Fri Aug 24, 2007 11:44 am

Post » Wed May 22, 2013 8:04 pm

If all else fails you could use condition functions for heading angle and isblocking.
User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am

Post » Wed May 22, 2013 2:20 pm

The SpellBreaker Shield (it's not a ward, it's a solid shield) have a Ward Effect attached to it, so i imagine that you could attach an invisible Ward to the player shield and use the event "OnWardHit". But is just me, a noob thinking. And it's only for spell hit.

Creationkit Site > OnWardHit_-_ObjectReference > Event called when the object reference is using a ward that is hit by a spell.

User avatar
alyssa ALYSSA
 
Posts: 3382
Joined: Mon Sep 25, 2006 8:36 pm

Post » Wed May 22, 2013 9:04 pm

These are all excellent ideas. Thanks for the help folks :)

User avatar
Vahpie
 
Posts: 3447
Joined: Sat Aug 26, 2006 5:07 pm

Post » Wed May 22, 2013 9:15 pm

Okay so far none of those shields really work for me. I've yet to try the ward idea, though, but I suspect it's much the same (especially since I need this to work without editing default shields in the game I.E. if it involves me manually adding a ward to every shield in the game, then it is NOT an option for me). The problem with the sheilds is that they have a reactionary effect (i.e. a hit against the shield must have already been blocked before it activates the effect) but I need to detect if a block it hit before the hit happens, so I can have modtargetdamage = 0 at the correct time

This seems to be the best solution, since conditionals work passively. Problem is I can't seem to figure out how GetHeadingAngle works.

I've currently got the condition attached to the "attacker" tab (so the "GetHeadingAngle" condition is being checked on the attacker), and the target for the GetHeadingAngle is the PlayerRef.

I've tried setting it so the conditions are "<= 120" (less than or equal to 120deg) to test. The result is that I ALWAYS take damage like normal, no matter what angle I face the attacker at. I've tried setting it so the condition is ">= 120" (greater than or equal to 120deg) and the result is that I NEVER take damage, no matter what angle I am facing the attacker.

It's weird because it's an all-or-nothing thing, and the condition clearly works because it actually activates/deactivates the perk that removes all damage when I block depending on if I've got it set to greater/lesser. I'm assuming I'm just using the numbers and syntax wrong.

Any ideas?

User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm


Return to V - Skyrim