acidzebra Posted December 2, 2012 Share Posted December 2, 2012 (edited) Okay, so I'm slowly getting into quest stuff after a couple of house mods and an overhaul. Essentially, I have a quest running which aliases the player and attaches a script to the alias. Now, the code is working and I'm not worried about whether or not my update times are sane - this is all happening when the player isn't doing anything. What I would like to know is if this is sane coding or whether it can cause breakage & bloat. The script registers for a single update on init, then relies on SKSE to check if the player presses a key, if yes then it stops whatever it was doing and stops the quest. If not, it registers for another single update (and so loops until a key is pressed). If it is stopped, some other event may start up the quest again - this may happen any number of times over the course of a game. Scriptname thisismyscript extends ReferenceAlias Quest Property thisismyquest auto Event OnInit() RegisterForSingleUpdate(0.2) EndEvent Event OnUpdate() Int iNumKeysPressed = Input.GetNumKeysPressed() If iNumKeysPressed > 0 ... [do some housekeeping stuff which is what it was all about] ... thisismyquest.stop() Else RegisterForSingleUpdate(0.2) Endif EndEvent Thanks in advance for looking it over! Edited December 2, 2012 by acidzebra Link to comment Share on other sites More sharing options...
scrivener07 Posted December 3, 2012 Share Posted December 3, 2012 http://www.creationkit.com/OnKeyDown_-_Formhttp://www.creationkit.com/RegisterForKey_-_Form:) Do something like..OnInit()>register for a key OnKeyDown()>do stuff Link to comment Share on other sites More sharing options...
acidzebra Posted December 3, 2012 Author Share Posted December 3, 2012 I'm aware of those but I don't want to register for a key, I want the script to shut down on any key. What I was after was knowing whether this (meaning the whole structure) is a safe way to do things or whether a repeatable quest set up like this would cause horrible bloat. But it's all rather academical now, I've thrown 'er out there with plenty of warning stickers. I'd still like to know though.http://skyrim.nexusmods.com/mods/27738/ Cheers. Link to comment Share on other sites More sharing options...
scrivener07 Posted December 3, 2012 Share Posted December 3, 2012 Your original script seems sound since its only polling for a key press on a quest alias and then shuts its self down. I would use something like. The only thing I dont know everything about is how an alias behaves after its owning quest is stopped. Maybe theres some special clean up an alias needs but maybe stopping the quest is all thats needed. Thats my 2cent o_O Link to comment Share on other sites More sharing options...
acidzebra Posted December 3, 2012 Author Share Posted December 3, 2012 (edited) Okay - according to the CK wiki More importantly, when a quest stops running, all its aliases are removed from their targets. (and I see this reflected in the changed behavior) and it doesn't mention any cleanup (and even if left running, the script will opt out the moment a key is pressed) so I think I'm in the clear (btw there IS a "clear" procedure in RefAlias but that's just if you want to remove an alias while the quest is still running. http://www.creationk...l_Quest_Aliases Thanks again :) Edited December 3, 2012 by acidzebra Link to comment Share on other sites More sharing options...
scrivener07 Posted December 6, 2012 Share Posted December 6, 2012 Ive been testing this myself and the CKwiki is right. An alias = none if the quest is stopped. Link to comment Share on other sites More sharing options...
Recommended Posts