Script Variable and Calling Help

Post » Mon Jul 29, 2013 10:02 am

I'm working on a new weapon that transfers "size" between the wielder and the target with every hit. I've written the following so far:

Scriptname spgEssenceShift extends activemagiceffect {A transfer of essence between target and caster occurs. Making the caster to grow larger, causing the target minor pain in the process}Actor Property Wielder Autofloat CurrentScaleWfloat CurrentScaleTfloat NewScaleWfloat NewScaleTfloat DefaultScaleEvent OnEffectStart(Actor akTarget, Actor akCaster)Wielder = akCaster ;now we know who is wielding the Staff ;Debug.Notification("Wielder is" + akCaster)Enemy = akTarget ;pretty self explanatory ;Debug.Notification("Enemy is" + akTarget)CurrentScaleW = Wielder.GetScale()CurrentScaleT = Enemy.GetScale()EndEventEvent OnHit(ObjectReference akTarget, Form akSpell, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)  CurrentScaleW = Wielder.GetScale() CurrentScaleT = Enemy.GetScale()                         If (CurrentScaleW < 10.0)  NewScaleW = CurrentScale + 0.01   ;rate of growth/hit   Wielder.SetScale(NewScaleW)   ;Debug.Notification(akCaster + "Absorbed essence.")     EndIf     If (CurrentScaleT > 0.01)  NewScaleT = CurrentScaleT - 0.01  ;rate of growth/hit   Enemy.SetScale(NewScaleT)   ;Debug.Notification(akCaster + "Essence drained.") EndIf EndEvent

However I am unable to compile it because for some reason apparently Enemy is undefined. I'm not sure why as I have defined it as per the script.

I have a feeling it has something to do with the parameters for OnHit being used as I've never used it before and so am unfamiliar with the parameters. However I'm still not experienced enough to know forsure.

Any help would be appreciated because this is the last thing I need to do before I can finish my mod. Thank you in advance.

User avatar
Calum Campbell
 
Posts: 3574
Joined: Tue Jul 10, 2007 7:55 am

Post » Mon Jul 29, 2013 12:03 pm

Use Actor Enemy, or Actor property Enemy.

Because this isn't going to be a specific enemy, Actor Enemy is the way to go.

User avatar
sarah simon-rogaume
 
Posts: 3383
Joined: Thu Mar 15, 2007 4:41 am


Return to V - Skyrim