Ghaunadaur Posted October 19, 2012 Share Posted October 19, 2012 Hello all,I have two simple scripts which do basically the same: an object will get disabled on activation and after a specific period of time it gets enabled again. It needs to be placed on ~20 objects. I just wonder which one I should use regarding speed, CPU usage and reliability. Variant 1:Scriptname script01 extends ObjectReference int property TimeToReset auto Event OnActivate(ObjectReference akActionRef) disable() RegisterForSingleUpdateGameTime(TimeToReset) EndEvent Event OnUpdateGameTime() enable() EndEvent Variant 2:Scriptname script02 extends ObjectReference int property TimeToReset auto Event OnActivate(ObjectReference akActionRef) disable() Utility.WaitGameTime(TimeToReset) enable() EndEvent Thanks in advance for any suggestions on this! Link to comment Share on other sites More sharing options...
steve40 Posted October 22, 2012 Share Posted October 22, 2012 (edited) I think the first script would be more efficient. The running thread will terminate after the RegisterForSingleUpdateGameTime has executed, then the game engine will start a new thread only after the given time has elapsed. On the other hand, the second script will trap the running thread at the WaitGameTime function and keep that thread alive while it is waiting for the specified wait time to elapse. Edited October 22, 2012 by steve40 Link to comment Share on other sites More sharing options...
Ghaunadaur Posted October 22, 2012 Author Share Posted October 22, 2012 Thanks, Steve! That's what I needed to know. :) Link to comment Share on other sites More sharing options...
Recommended Posts