GetEffectiveArmorAR
Revision as of 10:47, 31 May 2010 by imported>Low Post (New page: __NOTOC__ A User Function for use with Oblivion Script Extender '''Syntax:''' (effectiveArmorAR:short) reference.Call GetEffectiveArmorAR Armo...)
A User Function for use with Oblivion Script Extender
Syntax:
(effectiveArmorAR:short) reference.Call GetEffectiveArmorAR Armor:ref CurrentHealth:float
Returns the effective armor rating, adjusted by the effective skill of the calling actor.
Notes
- This function must be called on a reference (Ref.call <function>)
- CurrentHealth is the value returned by GetCurrentHealth and/or GetEquippedCurrentHealth. If you want the armor rating of an undamaged armor, just use 1 as the second parameter.
- This function requires the User Function GetEffectiveSkill
- If the ref passed as the first argument is not an armor, or this function is not called on a NPC reference, this function returns -1.
Code
scn GetEffectiveArmorAR int ActorValueCode int EffectiveAR int Skill float CurrentHealth float value float value2 ref Armor Begin Function { Armor, CurrentHealth } if Eval ( !IsActor ) || ( GetIsCreature ) || ( !IsArmor Armor ) SetFunctionValue -1 Return endif if ( GetArmorType Armor ) let ActorValueCode := 1 endif let Skill := ( Call GetEffectiveSkill ActorValueCode ) let value := ( gstiSkill / 100 ) let value *= ( GetGameSetting fArmorRatingMax ) - ( GetGameSetting fArmorRatingBase ) let value += ( GetGameSetting fArmorRatingBase ) let CurrentHealth /= ( GetObjectHealth Armor ) let value2 := ( ( GetGameSetting fArmorRatingConditionMult ) * CurrentHealth ) let value *= ( value2 + ( GetGameSetting fArmorRatingConditionBase ) ) let value *= ( GetArmorAR Armor ) let EffectiveAR := ( Floor value ) let EffectiveAR += !EffectiveAR SetFunctionValue EffectiveAR End