Documentation
Readme
View as plain text
Scriptname NPCActorWeaker extends Actor
event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
bool abBashAttack, bool abHitBlocked)
float enemyMageBaseHealth
float enemyBaseHealth
float enemyLevel
float NPCActorDamageResistance
;Get the Base Health of whichever enemy mage is hitting NPCActor and multiply it by 0.005 , mage enemies only
enemyMageBaseHealth = (akAggressor as Actor).GetBaseAV("Health") * 0.005 ; you can change this value to make magic do more or less damage
;Get the Base Health of whoever is hitting NPCActor with a weapon and multiply it by 0.25
;Example: A bandits health is 110, we multiple 110 by 0.25 and get 27.5
enemyBaseHealth = (akAggressor as Actor).GetBaseAV("Health") * 0.4 ; you can change this .4 value higher or lower if you want your actor to take more or less damage
;Get the Level of whoever is attacking NPCActor and multiple it by 1.3
;Note: Basically whoever attacks NPCActor adds their level as actual damage value multiplied by 1.3
;Example: I'm level 4, so multiple 4 by 1.5 resulting in 6
enemyLevel = (akAggressor as Actor).GetLevel() * 2.5
;Get NPCActor's armor rating by multiplying her damage resist by 0.12, because for each point of damageresist results in 0.12% damage reduction
;Then divide by 100 so we get a damage reduction percentage
;Example: NPCActor's DamageResist is -187 so we multiply that by 0.12 and then divide by 100 resulting in -0.2244 aka 22% damage Reduction
NPCActorDamageResistance = (self.GetAV("DamageResist") * 0.12) / 100
;if NPCActor isn't blocking then perform the damage increase modifier
if (abHitBlocked == 0)
;is the source of damage a weapon?
if (akSource.GetType() == 41)
;Let's take the adjusted values of enemyBaseHealth and enemyLevel to use as a means of causing extra damage to NPCActor
;add them together then subtract damage based on her damage resistance calculated from her armor rating
;Example based upon above values specific in notes above (27.5 + 6) - (-.21 * (27.5 + 6))
DamageActorValue("Health", (enemyBaseHealth + enemyLevel) - (NPCActorDamageResistance * (enemyBaseHealth + enemyLevel)))
endIf
;shout
if (akSource.GetType() == 119)
DamageActorValue("Health", enemyMageBaseHealth)
endIf
;magic
if (akSource.GetType() == 22)
DamageActorValue("Health", enemyMageBaseHealth)
endIf
endIf
endEvent