raverrn Posted March 25, 2012 Share Posted March 25, 2012 So I had the idea for a Shegorath-type weapon that randomly damages/helps/whatever, a real DnD Rod of Wonder type thing. Problem is I apparently have no idea how to worn an onUpdate script! This is what I have: Scriptname RodofWonder extends ObjectReference {Wand effect scripting} Event OnEquipped(Actor akActor) if akActor == Game.GetPlayer() Debug.Notification("Yeah, it's equipped.") RegisterForUpdate(5) endIfendEvent Event OnUpdate() Debug.Notification("And the timer works too!")endEvent I get the first notification, but not the second. I've been playing with it for quite a while and it has me stumped! Link to comment Share on other sites More sharing options...
tunaisafish Posted March 25, 2012 Share Posted March 25, 2012 You probably read the Note on the OnEquipped page, and like most people the reading it for the first time though... Huh?When an object is equipped it is inside a container, which means that you cannot call native functions on it. (Unless it is a persistent reference) If you'd written scripts for previous games then it's a big hint that inventory items in Skyrim will screw with your head just as much as they used to. Items in containers, in Actor inventories, or weilded (equipped) do not normally have an objectReference ID. So any of the Member functions that require the the object instance ID (self) will not work. RegisterForUpdate() is a Member function. If you turn on the Papyrus debugging then you'll probably see in the log a line like "None.RegisterForUpdate() ... ". Probably the easiest way, would be to have the OnEquipped/OnUnEquipped add a magic effect ability spell to the wearer. Also, change from using RegisterForUpdate() and instead use RegisterForSingleUpdate(), repeating the call at the end of the OnUpdate() event if needed. Link to comment Share on other sites More sharing options...
raverrn Posted March 25, 2012 Author Share Posted March 25, 2012 Thanks for the help! It's always the simple things. I guess a magic effect would be easy enough, though will OnUnEquipped be able to remove the effect? Link to comment Share on other sites More sharing options...
Recommended Posts