Jump to content

[LE] Script to read player damage output?


Rizalgar

Recommended Posts

Okay, thanks for checking out my topic :smile:

 

I need to create a script that reads the players damage output. So, let's say I shoot a bow at an enemy. I need to be able to read that damage so that I can have my script change a global variable. Any ideas on how to accomplish this? I know there's a 'flaoting numbers' mod out there. I'll take a peek into it in the mean time. As long as it doesn't use an ini file, I think I can maybe figure it out. Otherwise, I'm heavily relying on you guys to help me with this one :tongue:

 

--- Edit, checked out the floating numbers mod. It DOES use an Ini file instead of a plugin with scripts. RIP

 

--- Edit2, I'm sure I could use the GetBaseDamage function attach it to the weapon and apply my script that way using a static multiplier, but I'm trying to use the actual damage instead of a static.

 

--- Edit3, Would perhaps an OnHit function work? Have an OnHit check for Max/Current AV? It's a thought. I'll be giving that a go in the meantime.

Edited by Rizalgar
Link to comment
Share on other sites

This is a very hard undertaking that many have attempted in the past, and some were not able to pull it off. Floating Numbers took an advanced programming route.

 

To do this the painstakenly papyrus route, you'll obviously need:

The base damage of the weapon. (SKSE required)

 

You may need also need:

The perks the player has which modifies the base damage.

The enchantments the player has which modifies the base damage.

 

That last one will probably be the most difficult? Lots SKSE will be involved with that, especially for custom(player made) enchantments.

 

Skyrim rounds everything down (87.9 is 87).

 

I'm not sure if NPCs physical resistance needs to be accounted for, but to be on the safe side, should probably account for it:

https://en.uesp.net/wiki/Skyrim:Armor#Armor_Rating

 

A complete understanding of how damage works in the game:

https://en.uesp.net/wiki/Skyrim:Damage

 

How weapon damage works when being blocked:

https://en.uesp.net/wiki/Skyrim:Block

 

To make that far less scary than it looks, you don't need to know the formulas, etc. Just what will modify the final damage for ANY reason, to ensure you're able to print the damage as accurate as possible.

Edited by Rasikko
Link to comment
Share on other sites

I thank you for your reply! I'm curious to get it how to work though. I've tried using an OnHit script with a bow and on the arrows to do a simple debug but it never prints out. So I'm no quite sure where to even begin.

 

Edit -- I think the Elemental Arrows mod uses some scripts. I'm going to check it out see how he does it. If it's even relatable to what I'm trying to achieve, that is.

Edited by Rizalgar
Link to comment
Share on other sites

To do it the simple way(you're wanting a proof of concept), you need to calculate the difference of the NPC's HP loss from the its HP max.

 

Something like:

Int damageDone = (thisNPC.GetBaseActorValue("health") - thisNPC.GetActorValue("health")) as int

 

That's for just one hit though. It's gets trickier for successive hits, then it'll be a matter of comparing lost health from the previous value, rather than the base value.

Edited by Rasikko
Link to comment
Share on other sites

Yeah I see how doing it consecutively can be an issue for getting the current vs the last. That'll be a task all on its own. I have a script on an ME, attached to an Enchantment, attached to an Explosion, attached to a Projectile. Any idea why a simple debug like this won't print?

Event OnEffectStart(Actor akTarget, Actor akCaster)

   Debug.MessageBox("Hit")

EndEvent

Whenever CK finishes loading I'll send screens of the Effects

 

Edit -- For anyone trying to achieve a similar thing, make your Magic Effect as a Fire & Forget Contact, make your Enchantment the same, do not choose Constant Effect. Attach the script to the ME, attack the EN to the weapon, and voila, you got your script reading in game. Don't forget to set the EN charge to at least 1 with a cost of 0. Or that's what I needed in my case, anyway.

Edited by Rizalgar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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