Jump to content

Trying to create a recuring timed event in a quest script


dieangel68

Recommended Posts

I'm trying to implement various effects on my followers based on time, for this i need my script to "trip" every now and then (30 minutes ingame time in my case) and i also need it to compensate for fast travel, sleep and wait times, so i can't just use the time "played".

 

This is what i wrote so far:

 

short init;
float	tick_length;
float 	next_tick;

;This instruction block execute every single frame
begin GameMode
if init == 0 

	set tick_length to 0.01
	set next_tick to GetCurrentTime + tick_length
	set init to 1

else

	; with this mechanic, if the player fast forward, it should compensate by executing the function as many time as needed to catch up with the time
	if GetCurrentTime >= next_tick
		; this is what we do when the timer trip.
		ShowMessage kdcTickMessage

		set next_tick to next_tick + tick_length
	endif
endif
end

 

Can someone tell me if i am on the right path? is it a bad way to do things?

 

This part of code is not actually working properly because the time goes from 0.0 to 24.0 so it will break after one day of use. How can i write this function so when the time goes from 23.99 to 0.0 it won't bork my script?

Edited by dieangel68
Link to comment
Share on other sites

Probably not the best way, but...

float fTimer

Begin GameMode
if (fTimer > 0)
	set fTimer to (fTimer - GetSecondsPassed)
else
	; do stuff
	set fTimer to 1800 ; 30min
endif
End

Edited by Ez0n3
Link to comment
Share on other sites

Unfortunately this won't work because it aparently count "real life" seconds, so it won't be able to compensate with fast travel...

 

What's im' trying to fo is something that will do this (expressed time is ingame time):

 

*tick* 30 minutes *tick* 30 minutes *tick* 2 hours fast travel *tick* *tick* *tick* 30 minutes *tick* 30 minutes *tick*

Link to comment
Share on other sites

  • Recently Browsing   0 members

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