dieangel68 Posted November 26, 2010 Share Posted November 26, 2010 (edited) 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 November 26, 2010 by dieangel68 Link to comment Share on other sites More sharing options...
dieangel68 Posted November 26, 2010 Author Share Posted November 26, 2010 Or is there another time tracking function in new vegas that factor sleep/wait/travel time skips? I just realized that if the player wait 24 hours my script won't be able to realise that 24 hours just passed... Link to comment Share on other sites More sharing options...
Ez0n3 Posted November 26, 2010 Share Posted November 26, 2010 (edited) 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 November 26, 2010 by Ez0n3 Link to comment Share on other sites More sharing options...
dieangel68 Posted November 26, 2010 Author Share Posted November 26, 2010 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 More sharing options...
thc1234 Posted November 28, 2010 Share Posted November 28, 2010 float fTimer begin GameMode if fTimer == 0 ; init set fTimer to GameDaysPassed elseif fTimer < GameDaysPassed set fTimer to fTimer + (1 / 48) ; do stuff endif end Link to comment Share on other sites More sharing options...
Recommended Posts