I need help with function that would:
- calculate real number of updates that "happened" after OnUpdateGameTime that was delayed by fast travelling or waiting
- increase the 'counter' variable by number of updates
- then re- RegisterForSingleUpdateGameTime using time remainder from previous update
Example: update timer = 1.5 and fast travelling takes 10 in game hours: about 6.6 updates should happen.
What I have in mind currently, but hope someone will find better solution:
Float fUpdateTimerInt iCounter ;this variable increases by 1 every full updateEvent OnUpdateGameTime() Int numUpdates = ??? Float fTimeRemainder = ??? iCounter += numUpdates ;cant be too precise because it would keep ;re-registering for tiny values due to script lag If fTimeRemainder > 0.1 ;register using "fTimeRemainder" value Else ;ignore time remainder and register using default "fUpdateTimer" value EndIf RegisterForSingleUpdateGameTime(^read above)EndEvent
Thanks in advance!