Current Player Damage?

Post » Mon Nov 08, 2010 1:34 pm

All,

I want to work on a personal mod that does some fiddling around based on the player's current weapon damage. I'm hoping there is a quick and easy function in the CS scripting language to retrieve the player's damage.

If not, I am prepared to calculate it myself, or something approximating it. According to the UESP wiki for weapon damage, this formula applies:

BaseWeaponDamage * 0.5 *
( 0.75 + Strength * 0.005 ) *
( 0.2 + ModifiedSkill * 0.015 ) *
( WeaponHealth/MaxWeaponHealth + 1 )/2

(where ModifiedSkill is a value based on the weapon skill modified by the Luck stat)

I am hopeful that if the player's current damage isn't trivially/easily obtainable by function or global variable, then hopefully all the components of this formula are. I just havent researched it yet. That is my project for tomorrow night.

Thanks!
User avatar
marie breen
 
Posts: 3388
Joined: Thu Aug 03, 2006 4:50 am

Post » Mon Nov 08, 2010 7:04 am

Don't think there is a function that returns the current player damage including all modifiers. But you can calculate it yourself with OBSE. Translated into game settings and functions the formula would look like this:

getattackdamage WeaponRef * fDamageWeaponMult *
(fDamageStrengthBase + player.getav strength (or agility for bows) * fDamageStrengthMult) *
(fDamageSkillBase + player.getav blade (or blunt or marksman) * fDamageSkillMult) *
((player.getequippedcurrenthealth 16 / getobjecthealth WeaponRef) * fDamageWeaponConditionMult + fDamageWeaponConditionBase)

To get the game setting values use getgamesetting. To get WeaponRef (base object ID) you need to use player.getequippedobject 16. Then you can use getweapontype WeaponRef to specify whether it's a blunt weapon, blade weapon or bow. Put the result into a variable and you have the modified weapon damage.

There are other things that can modify the damage like enchantments or power attacks, but you can check for them as well.
User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm

Post » Mon Nov 08, 2010 5:35 am

Wow. It looks like you've done half the work for me. Thanks!

I do see 3 issues with your formula that I have questions about.

1) The formula I posted had a division by 2 on the end of it, but I dont see that in yours. Was that an oversight?

2) On the last line of my formula I have WeaponHealth/MaxWeaponHealth and you seem to do that, but I dont understand why you multiplied by fDamageWeaponConditionMult. I mean I would think, by its name, that fDamageWeaponConditionMult itself is the same as WeaponHealth/MaxWeaponHealth.

3) I saw online the stuff about creating a reference and getting the current weapon as a pointer reference and then getting a bunch of stuff from it. But, I dont know what you mean by game setting values. Is that the stuff like fDamageStrengthMult and fDamageWeaponConditionMult?

Thanks again!
User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Post » Mon Nov 08, 2010 2:56 pm

1. No, but the UESP Wiki simplifies formulas by using default values. The real formula is the one I posted, which is the same as the one on the Wiki when you use default values (0.5 for both settings). But if you use the actual game settings it only works with the formula I posted.

2. It's weapon health percentage (ranging from 0 to 1) * fDamageWeaponConditionMult (default 0.5) plus fDamageWeaponConditionBase (also 0.5 by default). A weapon with 100% health will multiply damage by 1 (= weapon will do full damage), a weapon with 0 health will multiply damage by 0.5 (= weapon will do half damage only).

3. Game settings are a large number of settings you can find in the CS (Gameplay>settings). They're basically hardcoded gameplay mechanics with values that are not hardcoded. You can for example change the sneak attack damage weapons do, the magicka return rate and a huge amount of other things by altering these settings. And yes, the fDamageXX stuff are settings as well.
User avatar
Tina Tupou
 
Posts: 3487
Joined: Fri Mar 09, 2007 4:37 pm

Post » Mon Nov 08, 2010 3:43 pm

3. Game settings are a large number of settings you can find in the CS (Gameplay>settings). They're basically hardcoded gameplay mechanics with values that are not hardcoded. You can for example change the sneak attack damage weapons do, the magicka return rate and a huge amount of other things by altering these settings. And yes, the fDamageXX stuff are settings as well.


Since you bring it up, I'll go into what I'm actually after. I found a couple of mods that add sneak attack damage to 2-handed weapons. They do it by monitoring player state (regarding weapon type, sneaking state, etc) and they add and subtract damage bonuses. I was going to make my own version that did the same thing conceptually, but the bonus damage they added was kinda all over the place. I wanted to actually use x2 damage, x3 damage, etc, so I wanted to be able to calculate the actual real damage so that I could have an accurate damage bonus to simulate the real multiplier.

But your comment makes me wonder .... is there a value I can change so that two-handed weapons do sneak attack damage? I would LOVE if the game notification would say x3 sneak attack damage and do it. By tracking player state and adding bonus damage, even if I make my math more accurate, the game will still SAY x1 damage done, even if it is more.

Is it possible to alter the sneak attack damage multipliers for 2-handed axes and swords? Or did they hard code that down to x1 only? I'm assuming its hard coded or else the mods I saw would have done it in the more straightforward way.

Thanks much for all the help!
User avatar
Shelby McDonald
 
Posts: 3497
Joined: Sat Jan 13, 2007 2:29 pm

Post » Mon Nov 08, 2010 1:46 pm

Well rats. It looks like I can change FDamageSneakAttackMult but that isn't what I want. I don't see any way to directly affect sneak attack damage for Two Handed weapons only. So, I'll proceed with a script method using the formula we discussed.

Well, unless anyone knows a way I can magically make Sneak Attack damage more with 2-handed weapons without a script. :)

Thanks!
User avatar
Jeff Turner
 
Posts: 3458
Joined: Tue Sep 04, 2007 5:35 pm

Post » Mon Nov 08, 2010 6:27 am

Oops. I just realized I dont want to have to use OOBE. I think that pretty much kills me trying to calculate or determine what the player's actual current damage is. I see that the construction set does recognize all the stuff like fDamageWeaponMult, but I guess I'll be unable to snag the other stuff. I see now why the original mod simply calculated a damage value that was independent of the player's weapon but based instead on his skills.

So, with Strength 100 and skill 100 and max weapon durability, what actual numbers are we looking at for player damage with the top-end gear? what about for typical starting strength and skill with newbie gear?

I just want to get some sanity check ranges for how much bonus damage I will add to 2-handed sneak attacks. The mod I looked at would cap out bonus damage at 440, but that seems disgustingly excessive. :) However is formula was based on the player's strength, sneak skill, blade skill, and blunt skill being all at 100, and it scaled down to almost no bonus with low skills. The ORIGINAL mod that guy based his on scaled a damage bonus based on the player's sneak and personal level, which I think I favor.

Anyway, can anyone give me a range of realistic lowbie and max damage numbers? Lowbie with a steel claymore vs endgame char with max stats using a top-end ebony or better 2h sword or mace?

Thanks!
User avatar
sam smith
 
Posts: 3386
Joined: Sun Aug 05, 2007 3:55 am


Return to IV - Oblivion