Jump to content

Calling GetActorValue while extending ActiveMagicEffect


adb3nj

Recommended Posts

Firstly, I'm a complete novice to scripting and programming generally. I'm trying to write the 'wounding' legendary effect as a script, so it takes account of damage resistance and armour penetration. Currently I have:

 

Scriptname LegendaryOnHitWoundScript extends ActiveMagicEffect Const


ActorValue Property ArmorPenetration const auto
ActorValue Property DamageResist const auto
ActorValue Property Health const auto


Event OnEffectStart(Actor akTarget, Actor akCaster)
debug.trace(self + "OnEffectStart() akTarget:" + akTarget + ", akCaster:" + akCaster)


Float fTargetResistance = akTarget.GetActorValue(DamageResist)
Float fPlayerPenetration = akCaster.GetActorValue(ArmorPenetration)
Float fNetResistance = ((100-fPlayerPenetration)/100)*fTargetResistance


int roll = Utility.RandomInt(1, 300)


debug.trace(self + "Roll: " + roll)


if roll >= fNetResistance
Utility.Wait(1.0)
akTarget.DamageValue(Health, 5.0)
Utility.Wait(1.0)
akTarget.DamageValue(Health, 5.0)
Utility.Wait(1.0)
akTarget.DamageValue(Health, 5.0)
Utility.Wait(1.0)
akTarget.DamageValue(Health, 5.0)
Utility.Wait(1.0)
akTarget.DamageValue(Health, 5.0)
endif


EndEvent

However I'm told by the compiler that GetActorValue doesn't exist. I therefore tried a version extending the Actor script:

 

Scriptname LegendaryOnHitWoundScript extends Actor


ActorValue Property ArmorPenetration auto
ActorValue Property DamageResist auto
ActorValue Property Health auto
Actor Property PlayerRef auto


Event OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect)
debug.trace(self + "OnMagicEffectApply() akCaster: " + akCaster + "; akEffect: " + akEffect)


Actor TargetRef = PlayerRef.GetCombatTarget()


Float fTargetResistance = TargetRef.GetActorValue(DamageResist)
Float fPlayerPenetration = PlayerRef.GetActorValue(ArmorPenetration)
Float fNetResistance = ((100-fPlayerPenetration)/100)*fTargetResistance


int roll = Utility.RandomInt(1, 300)


debug.trace(self + "Roll: " + roll)


if roll >= fNetResistance
Utility.Wait(1.0)
TargetRef.DamageValue(Health, 5.0)
Utility.Wait(1.0)
TargetRef.DamageValue(Health, 5.0)
Utility.Wait(1.0)
TargetRef.DamageValue(Health, 5.0)
Utility.Wait(1.0)
TargetRef.DamageValue(Health, 5.0)
Utility.Wait(1.0)
TargetRef.DamageValue(Health, 5.0)
endif


EndEvent

Again though, GetActorValue apparently doesn't exist (and also 'the parameter types of function onmagiceffectapply in the empty state on script legendaryonhitwoundscript do not match the original script scriptobject'). What am I doing wrong?

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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