adb3nj Posted July 28, 2022 Share Posted July 28, 2022 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 EndEventHowever 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 EndEventAgain 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 More sharing options...
DlinnyLag Posted July 28, 2022 Share Posted July 28, 2022 However I'm told by the compiler that GetActorValue doesn't exist. You need GetValue Link to comment Share on other sites More sharing options...
adb3nj Posted July 28, 2022 Author Share Posted July 28, 2022 However I'm told by the compiler that GetActorValue doesn't exist. You need GetValue Oh, haha. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts