scn FOOKAPDRSCPT; Credit for the base goes to Kanob: http://www.fallout3nexus.com/modules/members/index.php?id=1455440; FOSE is needed for this Script: http://fose.silverlock.org/ref PCWeapon ;# Ref of Playerweaponfloat PCWeaponDamage ;# Damage of Playerweapon at 100% conditionshort PCWeaponType ;# Type of equiped weaponfloat PCWeaponSkill ;# Playerskill with weapontypefloat PCWeaponCondPenalty ;# Penalty of having less than 100% weapon conditionfloat PCSkillBonus ;# Damage adjustment depending on PC skillfloat MeleeArmConditionPenalty ;# Penalty for crippled arms in Meleefloat PCMeleeDamageAV ;# Extra Melee Damage actor value (ie from Little Leaguer Cap, etc)float PCUnarmedDamageAV ;# As above, but for Unarmed, ie Iron Fist Perk. float GameSettingGunCondBase ;# GMST for calculating minimum gun damage at 1 condition (0.6)float GameSettingGunCondMult ;# GMST for calculating range of gun damage between 1-100 condition (0.4)float GameSettingMeleeWeapCondBase ;# GMST for calculating minimum melee weapon damage at 1 condition (0.5)float GameSettingMeleeWeapCondMult ;# GMST for calculating range of melee weapon damage between 1-100 condfloat GameSettingSkillBase ;# GMST for calculating minimum weapon damage at 1 skill (0.5)float GameSettingSkillMult ;# GMST for calculating range of weapon damage between 1-100 skill (0.5)float ArmorPiercingDamage ;# Damage to be done by ArmorPiercingfloat GameSettingArmConditionBase ;# GMST for calculating melee weapon damage with both arms crippled (0.2)float GameSettingArmConditionMult ;# GMST for calculating melee weapon damage with 1 or no arms crippled (0.8)float RightArmStatus ;# 1 if arm is healthyfloat LeftArmStatus ;# As abovefloat APDRxDamageVar ;# Damage the player does with his weapon.ref rTargetshort vHealthBegin ScriptEffectStart Player If FOSE Else Return EndIf set rTarget to GetSelf set vHealth to rTarget.GetAV Health set PCWeapon to player.GetEquippedObject 5 set PCWeaponDamage to GetAttackDamage PCWeapon set PCWeaponType to GetWeaponSkill PCWeapon set GameSettingGunCondBase to GetGS fDamageGunWeapCondBase set GameSettingGunCondMult to GetGS fDamageGunWeapCondMult set GameSettingSkillBase to GetGS fDamageSkillBase set GameSettingSkillMult to GetGS fDamageSkillMult set GameSettingMeleeWeapCondBase to GetGS fDamageMeleeWeapCondBase set GameSettingMeleeWeapCondMult to GetGS fDamageMeleeWeapCondMult set GameSettingArmConditionBase to GetGS fDamageArmConditionBase set GameSettingArmConditionMult to GetGS fDamageArmConditionMult set PCMeleeDamageAV to player.getav MeleeDamage set PCUnarmedDamageAV to player.getav UnarmedDamage if PCWeaponType == 33 ; Big Guns set PCWeaponSkill to player.getav bigguns elseif PCWeaponType == 34 ; Energy Weapons set PCWeaponSkill to player.getav energyweapons elseif PCWeaponType == 41 ; Small Guns set PCWeaponSkill to player.getav smallguns elseif PCWeaponType == 38 ; Melee Weapons set PCWeaponSkill to player.getav meleeweapons elseif PCWeaponType == 45 ; Unarmed set PCWeaponSkill to player.getav unarmed endif if PCWeaponSkill > 100.0 set PCWeaponSkill to 100.0 endif set PCSkillBonus to GameSettingSkillBase+(GameSettingSkillMult*(((PCWeaponSkill))/100)) if PCWeapontype == 41 || PCWeapontype == 34 || PCWeapontype == 33 set PCWeaponCondPenalty to GameSettingGunCondBase+(GameSettingGunCondMult*(player.GetWeaponHealthPerc/100)) set APDRxDamageVar to (PCWeaponDamage*PCSkillBonus*PCWeaponCondPenalty) ;# damagevar * targetDR / 100.0 = APdamage elseif PCweaponType == 38 || PCWeapontype == 45 set PCWeaponCondPenalty to GameSettingMeleeWeapCondBase+(GameSettingMeleeWeapCondMult*(player.GetWeaponHealthPerc/100)) set RightArmStatus to (player.getav RightAttackCondition) if RightArmStatus set RightArmStatus to 1 endif set LeftArmStatus to (player.getav LeftAttackCondition) if LeftArmStatus set LeftArmStatus to 1 endif ; set MeleeArmConditionPenalty to (PCWeaponDamage*((GameSettingArmConditionBase)-1)+(GameSettingArmConditionMult*((RightArmStatus+LeftArmStatus)/2))) if PCWeaponType == 38 set APDRxDamageVar to ((PCWeaponDamage*PCSkillBonus*PCWeaponCondPenalty)+(PCMeleeDamageAV)) ;+(MeleeArmConditionPenalty)) elseif PCWeaponType == 45 set APDRxDamageVar to ((PCWeaponDamage*PCSkillBonus*PCWeaponCondPenalty)+(PCUnarmedDamageAV)) ;+(MeleeArmConditionPenalty)) endif endif set ArmorPiercingDamage to (((APDRxDamageVar)/2)*(getav damageresist/100.0)) ;I'm reliably informed by GECKWiki that Critical Hit damage ignores armour anyway, so there is no Critical/Sneak check. ;The reason its APDR/2 is because during my testing it appeared that body shots do half the listed damage and head shots the ;listed damage (not what GECKwiki says, however). I decided not to give the player benefit of the doubt. DamageActorValue Health ArmorPiercingDamage ;## Finally! Do the AP-Damage!End
Currently the biggest problem is generating a version that works for NPCs - as I don't know how to call the firer/user of the object script (if there even is currently a way), I had to make all the checks against a fixed ref, ie the player, which obviously means that no matter what AP weapon an NPC uses it'll be the same as the PC's weapon, which can turn out weird. The only thing I could thing of that is really rudimentary would be to use an equip script on the weapon to check if the user is the player, and if the user is the player, use the FOSE command to add the object effect in, and vice versa if the user is an NPC, but thats crude. Even just a simple way of making sure the script never runs when an NPC fires an AP weapon would do I guess, but if it could work for NPCs that would be beyond awesome.
Secondly, the reason the bit about MeleeArmConditionPenalty is commented out in the formula is because I can't devise a suitable check as to the number of crippled arms the player has; the bit about rightarmstatus/leftarmstatus doesn't seem to work (I had it as a global for testing initially, but it always displayed 0 no matter what I did), even though player.getav RightAttackCondition works in the console (but its out of 100). Basically what I want is if the condition of the limb is 0 or below, set the Right/LeftArmStatus to 0, and if it is above 0 (ie, the limb is not crippled) set it to 1... Or another, simpler, IsCrippled check would be great, but I couldn't find one on GECKWiki.
Thirdly, I can't remember if the UnarmedDamage/MeleeDamage bit works.. I remember having problems with it and I might have fixed them, but I've been sitting on this for far too long to remember, so I thought I'd throw it in if anyone sees anything obviously wrong with it.