I am having difficulty imagining why you require this unless you are running the timer on a local script and you want to account for the player leaving the cell. The calendar fix introduced by the Morrowind Code Patch has rendered local day-counters pretty unreliable so global scripts are pretty much a must. A global script could still count seconds making the need to track Gamehour passage unnecessary (and unnecessarily complicated).
It is not clear if you want the game-equivalent of 500 real-time seconds, but at the default timescale of 30 that would be 4.167 gamehours.
This business becomes problematic if the timer is started after 19.833 hours since it will require the timer run into the next day. That in itself if not a problem, but if the player leaves the cell in which a local timer is running you will require a method of keeping track of the day and month (see first paragraph). You could cut a few corners if you are willing to take a chance of your script working most of the time.
float targetHourshort currentDayif ( whatever == 1 ) set whatever to 2 set currentDay to Day set targetHour to ( Gamehour + 4.167 )endif If ( DoOnce2 == 1 ) If ( randomizer == 3 ) If ( player-> getwillpower > 85 ) If ( player-> getwillpower <= 90 ) if ( currentDay = Day ) if ( targetHour > GameHour ) return else startscript, "Were_BecomeHuman" set timer to 0 set DoOnce2 to 0 set randomizer to random 5 endif else if ( targetHour >= 24 ) if ( targetHour >= ( Gamehour + 24 ) ) return else startscript, "Were_BecomeHuman" set timer to 0 set DoOnce2 to 0 set randomizer to random 5 endif endif endif endif endif endif endif
This may return false negatives in days following the first day change (the problem with not having a reliable calendar). I suspect your code could be made to run more efficiently, but without seeing the rest of the script I just used the structure that you offered.
Again, a global script timing in seconds may be the best way to go, but you have your reasons for wanting to check Gamehour.