Jump to content

Wait Time Scripting Help


ozziefire

Recommended Posts

I'm trying to make quest scripts run faster to catch up after sleeping / waiting / fast travel.

I've been going around in circles for 2 days now, I have a control script running every second and it controls the fScriptDelay time of 3 other scripts between 60 seconds and 1 second to catch up it also feeds them a modifier fScriptStep which pultiplies their effects to suit.

 

This is the script I'm stuck mainly on getting the updated time to reset at the correct time, any ideas?

scn SFSynchQSCRIPT

; *** Controls Script Speed

short iOldVer
short iNewVer
float fCurrentTime
float fLastUpdatedTime
float fMinutesMissed
float fScriptDelay
float fScriptStep
float fMinToHourConv

ref self

Begin GameMode

; *** Alter Script run times to catch up after Fast Travel / Wait / Sleep
Set fMinToHourConv to .016666
Set fScriptDelay to 60
Set fCurrentTime to GetCurrentTime

; *** Intitialise so script doesn't lockup
If fLastUpdatedTime == 0 || fMinutesMissed <= 1
	Set fLastUpdatedTime to fCurrentTime - .07
endif

; *** Midnight Wrap around
if fCurrentTime < fLastUpdatedTime
	Set fMinutesMissed to ((fCurrentTime + 24 - fLastUpdatedTime) / fMinToHourConv)
endif

; *** No Wrap around
if fCurrentTime >= fLastUpdatedTime
	Set fMinutesMissed to ((fCurrentTime - fLastUpdatedTime) / fMinToHourConv)
endif

Set fScriptDelay to 60 - fMinutesMissed
If fScriptDelay < 1
	Set fScriptDelay to 1
endif

Set fScriptStep to 60 / fScriptDelay
If fMinutesMissed > 1
	Set fLastUpdatedTime to fLastUpdatedTime + (fMinToHourConv * fScriptStep)
endif

SetQuestDelay Script3 fScriptDelay
SetQuestDelay Script2 fScriptDelay
SetQuestDelay Script3 fScriptDelay
;ShowMessage SFTimingVariableDEBUG fScriptDelay fScriptStep fCurrentTime fLastUpdatedTime fMinutesMissed

End

 

Ok got it, this seems to work ok

Edited by ozziefire
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...