Jump to content

Initialising Update on Alias


xrws31

Recommended Posts

I can't seem to register an alias for an update event. Code is below. The first debug trace ("Loaded") just never appears in my logs, which means the Event OnLoad() is never being hooked. I have also tried with OnCellLoad() and OnInit(). The script is attached to an alias reference for the Player. The OnHit event works absolutely fine though, and it's debug trace does appear in my logs, so the alias reference *is* working, and so is the debug log. I just can't get this damn Update to register. Perhaps OnUpdate events can't be passed to a player reference? Anyone know?

 

If anyone could get the Update to register I'd be eternally grateful.

 

 

Scriptname MyHitScript extends ReferenceAlias

float currentHealth
float playersHealth
float lastdamage
float originalDamage
float damagedHealth
float playersArmour
float modifiedDamage

Event OnLoad()
Debug.Trace("Loaded")
registerForUpdate(1); Set an update occuring ever second
EndEvent

Event OnUpdate()
currentHealth = Game.GetPlayer().GetActorValue("health") as float;
Debug.Trace("Updated")
EndEvent

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
**********some stuff***********
EndEvent

Edited by xrws31
Link to comment
Share on other sites

  • Recently Browsing   0 members

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