Smig Posted July 18, 2012 Share Posted July 18, 2012 I have a package that makes the actor cast a spell on the player under certain conditions. The problem is that, after those conditions turn true, I have to wait anywhere from 5 to 10 seconds for the package to actually activate. I assume this is just a timer on the actor, that makes him evaluate the package stack at certain intervals. My intention is to have the package activate instantly (or almost, 2 second maximum, lets say). I could make a script but I can't see suitable events on the API that I could use. Or I could force the actors (or that one in particular) to evaluate packages at smaller intervals. Is this possible? Any other ideas? Link to comment Share on other sites More sharing options...
gasti89 Posted July 18, 2012 Share Posted July 18, 2012 What are the conditions that make the package run? Link to comment Share on other sites More sharing options...
Smig Posted July 18, 2012 Author Share Posted July 18, 2012 What are the conditions that make the package run? I can't check the actual function names right now but it's basically: Player's health < 100%ANDLineOfSight with the player = 1ANDHostile with the player != 1 I attack someone in the room, I get injured and then kill him. I stand in front of the actor with the said package. He continues in another sandbox package that is in the bottom of the stack. He gets up, sits down, etc, for more than 5 seconds before the package activates. Can I assume from your question that this is not a case of package evaluation interval? That the package should activate immediately? Link to comment Share on other sites More sharing options...
gasti89 Posted July 18, 2012 Share Posted July 18, 2012 (edited) http://www.creationkit.com/OnGainLOS_-_Form This seems to do what you need. Even if you have to register the form you're attaching the script to for LOS gaining. If you want the NPC to set a single cast, there wouldbe something like this on him. Event OnLoad() RegisterForSingleLOSGain(self, Game.GetPlayer()) EndEvent Event OnGainLOS(Actor akViewer, ObjectReference akTarget) Self.EvaluatePackage() EndEvent This should register your NPC for a single LOS gain as soon as he is loaded. So leaving the cell should also unload him, giving the opportunity to re-run the script when you come back. If you have problems (it's reported that references may not unload when leaving the cell) you can try with OnCellAttach() instead of OnLoad(). This is far away from my knowledges and it's all done guessing with the CKwiki, so don't blame me if it doesn't work ;) EDIT: you may need to replace both the "self" with "(self as actor)", since i don't remember if the script will extend actor or actorbase. Edited July 18, 2012 by gasti89 Link to comment Share on other sites More sharing options...
Smig Posted July 21, 2012 Author Share Posted July 21, 2012 That works perfectly! Thanks for pointing me in the right direction. And kudus to you! You're one of the most helpful people in this forum :D Link to comment Share on other sites More sharing options...
Recommended Posts